jj icon indicating copy to clipboard operation
jj copied to clipboard

Won’t push commit since it has no author and/or comitter set

Open vincentberthier opened this issue 9 months ago • 9 comments

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.

Image

Since it’s in the history of the repo, there’s no way to change the commit itself. obviously.

Steps to Reproduce the Problem

  1. Fork the repo
  2. Create a new change/commit
  3. 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.

vincentberthier avatar Feb 17 '25 01:02 vincentberthier

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.

martinvonz avatar Feb 17 '25 01:02 martinvonz

The entire process was:

  1. Fork the repo
  2. Clone it locally (with git since it has submodules)
  3. Configured the repo as upstream, the fork as origin (and added the [git] section for that in .jj/repo/config.toml with fetches from both and pushes to origin only)
  4. Added two changes / commits
  5. Created a bookmark
  6. Tried to push the new bookmark

So yeah, that commit has been on the remote for a long time, it’s nothing new.

vincentberthier avatar Feb 17 '25 01:02 vincentberthier

@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?

samueltardieu avatar Feb 17 '25 16:02 samueltardieu

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.

vincentberthier avatar Feb 17 '25 22:02 vincentberthier

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.

PhilipMetzger avatar Feb 18 '25 18:02 PhilipMetzger

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.

xobs avatar Jul 25 '25 02:07 xobs

We're actively discussing fine-grained flags as --commiter and --author in https://github.com/jj-vcs/jj/pull/7136.

PhilipMetzger avatar Aug 11 '25 16:08 PhilipMetzger

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.

wmstens avatar Oct 23 '25 19:10 wmstens

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.

pluiedev avatar Nov 03 '25 20:11 pluiedev