jj
jj copied to clipboard
Won’t push commit since it has no author and/or comitter set
Description
There is a commit in the Redox repo where the author’s mail is not set for some reason: https://gitlab.redox-os.org/redox-os/redox/-/commit/bb4b3e838cc8bc6b09ba49fd5d2065fe9ffa4b71
Problem is, it prevents using jujutsu to work on that repo (at least for pushes), since it complains about that commit.
Since it’s in the history of the repo, there’s no way to change the commit itself. obviously.
Steps to Reproduce the Problem
- Fork the repo
- Create a new change/commit
- Try to push
Expected Behavior
To get the warning, but also some way to configure an override (on a per commit basis maybe) to ignore the error and keep going?
Actual Behavior
Doesn’t allow the push with no way to override / ignore the error.
To clarify, did you just clone that repo, add a commit on top, and then tried to push it to the same remote? We should not check commits the are already on the remote.
The entire process was:
- Fork the repo
- Clone it locally (with git since it has submodules)
- Configured the repo as upstream, the fork as origin (and added the [git] section for that in
.jj/repo/config.tomlwith fetches from both and pushes to origin only) - Added two changes / commits
- Created a bookmark
- Tried to push the new bookmark
So yeah, that commit has been on the remote for a long time, it’s nothing new.
@vincentberthier Did you use jj git fetch from the fork before trying to push to the fork, or did you attempt the jj git push without first fetching from it?
And as another question, if you first do a jj git fetch, can you then jj git push?
I hadn’t done the jj git fetch before trying to push.
I’ve just tried a jj git fetch && jj git push and it worked though.
This is similar to https://github.com/jj-vcs/jj/issues/2633, which was solved by an --allow-empty-description flag to jj git push. So maybe a similar flag for the commiter/author is needed.
For me, I have a brand-new repo created. Since this is a new install, I guess I didn't have the author set.
My issue now is that my output looks like this:
❯ jj git push --allow-new
Error: Won't push commit f9d1e4195787 since it has no description and it has no author and/or committer set
Hint: Rejected commit: ymvnkmmn f9d1e419 (no description set)
❯
There's a hint, but it sounds like I need to set the author or committer. What I need is the jj-equivalent of git commit --amend --reset-author --no-edit, and it would be nice if the error message included that. Instead it's just informing me that it doesn't exist and I have to try and figure out what to run.
Edit:
I tried to use git, and it didn't work, so even that's not an option:
❯ git commit --amend --reset-author --no-edit
error: invalid object 100755 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for 'Reference/HUB-GENESYS-GL3523-OTY30_C390630.pdf'
error: invalid object 100755 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for 'Reference/HUB-GENESYS-GL3523-OTY30_C390630.pdf'
error: Error building trees
❯
Final edit:
What I guess it wanted me to do was jj describe --reset-author f9d1e4195787 (or the equivalent jj commit). It would have been really nice if that were included in the error message.
We're actively discussing fine-grained flags as --commiter and --author in https://github.com/jj-vcs/jj/pull/7136.
I finally got around to trying to add a new repo to remote and was running into this issue.
What I guess it wanted me to do was
jj describe --reset-author f9d1e4195787(or the equivalent jj commit). It would have been really nice if that were included in the error message.
As of v0.34.0 jj describe/commit --reset-author has been removed and now jj metaedit --update-author [revsets] is the prescribed function.
If you run the command and it says "Nothing changed" make sure you are targeting the correct revision. If that doesn't help use JJ_USER='Foo Bar' [email protected] jj metaedit --update-author [revsets] with slightly updated versions of your username and email, or at least that's how I got out of the hole I dug myself.
This is still a problem when an existing commit is already pushed to the main repository that lacks an author name/email, and there's no way to undo that. One example of this can be found in Nixpkgs with PRs like https://github.com/NixOS/nixpkgs/pull/453871, where the PR author explicitly refused to provide an email address, and it is already too late to amend the metadata there without messing up the commit history entirely.