Issue 491: Confusing error message when pushing commits dependent on commits not found in any branch history
Status:  Accepted
Owner: ----
Reported by di...@google.com, Mar 9, 2010
Affected Version:

What steps will reproduce the problem?
1. create a "merge commit" (not fast-forward) on 2 branches, one known to 
the target repository (as it has been code reviewed) and one from another 
(not code-reviewed) repository
2. make sure the commit from the other repository was committed by someone 
else (not sure if this matters, haven't tried it without this condition)
3. make the objects of the other repository known to the target one through 
means of objects/info/alternates (so they are not part of the history of 
any of the target repository branches)
4. try to push the "merge commit" for code review in the target repository

What is the expected output? What do you see instead?
As I understand Gerrit requires that any commits dependent on by the pushed 
commit must be found in the history of at least one branch in the target 
repository. However, when this not happens I get instead a confusing 
(unrelated?) error, I get: "you are not committer ...". I was thinking 
maybe instead it should say "dependent commits are not found in any of the 
repository branches". If it does matter the fact that I'm not the committer 
of the commit not found in any branch history then I guess it should say 
both, something like "dependent commits are not found in any of the 
repository branches (and you are not the their commiter)".

Thanks!


Please provide any additional information below.

May 20, 2011
Project Member #1 nas...@grainawi.org
I don't know that Gerrit is able to distinguish between new commits that aren't yours and existing commits coming from another repository that it may or may not know about. With that in mind, I don't think we can change the error as you said above, but perhaps you have another suggestion?
Status: AwaitingInformation
May 20, 2011
#2 di...@google.com
Am I correct to assume that "git push" won't transfer over the network the objects that are not part of any branch of the target repository but are known (through the alternates setup)? I think I tested this a couple of times and indeed it did not transfer objects over the network that it knew about. Also, Gerrit creates changes (to be reviewed) only for the commits transferred over the network.

If so, then why does it complain that I'm not the committer of an object that isn't transferred over the network (and thus no change is made for it) but is known through the alternates file? That's why I thought that the error stems probably from a different check (different than the normal committer check that applies to uploaded commit) and is just the text that is confusing.
May 23, 2011
#3 sop@google.com
Git won't transfer objects from the alternate, because these are advertised to the client as a special ".have" advertisement that isn't visible to Gerrit's receive code.

When Gerrit receives the objects, it starts scanning through all commits that are not reachable from the destination branch in this repository. Which will include those commits that are being borrowed from the alternate repository, as they aren't reachable here yet but are still accessible.

The only workaround is to create references that point to the alternate repository's same commits.

I'll have to think about it more, but it may make sense to consider the tips of the alternate's references to also be not part of what the current user is pushing. Its just not very accessible inside of JGit right now. 
Status: Accepted
Labels: Component-JGit
May 23, 2011
#4 di...@google.com
Not sure if I fully understood your message but I mean to say that the destination (Gerrit hosted) Git repository had alternates setup, not the client Git repository.

"When Gerrit receives the objects, it starts scanning through all commits that are not reachable from the destination branch in this repository."

What is "this repository" here?

Anyways, if it's complicated to fix then I don't think it's worth it, it's just an error message after all.