Subject: Re: ANNOUNCE git-what-branch (was Re: Find out on which branch a commit was originally made)

From: Artur Skawina <[email-masked]>
Date: Wed, 22 Sep 2010 22:27:27 +0200

On 09/22/10 18:35, Seth Robertson wrote:
> looking at just one branch, it is looking at 150+ branches.  If you
> use --reference-branch to specify the one branch you are looking at,
> it takes a much more reasonable 15-20 seconds.  Likewise if you select

This started in a thread about locating dead topic branches, but what
you want is something slightly different, hence the confusion. 
AFAIUI it now, your case is basically this: you have several
independently developed topic (or side-) branches, which are
periodically merged into a master branch, the side branches
themselves are also merging 'master' to receive changes happening
elsewhere. So the graph could look like this:

 m-> m -> m -> m -> m -> m -> m ->   master
  \        \       /         /
   b -> b -> b -> b -> b -> b ->    side-branch#1

Ditto for the other n side-branches. 

What you're asking for is: given commit C and a list of several side
branches, tell me where (ie on which branch) this commit originated.

Two things make the above trivial history a bit more complicated.
A) one side-branch can merge another, and build on top of changes that
   are not yet available on 'master'; the result can then appear in master
   via either one or both paths. This is why showing when and how a change
   became visible on every side branch can be interesting.
B) when a side branch does not contain any new changes, but is made uptodate
   wrt master, the resulting history could end up like this:

 m-> m -> m -> m -> m -> m -> m ->   master
  \           /      \       /
   b -> b -> b        c ->  c ->    side-branch#1
    
   What happened was -- git "optimized" the simple merge away, turning it
   into a fast-forward, saving one merge commit, but loosing the link
   connecting the 'c' and 'b' parts of 'side-branch#1'.   

Do you (anybody) happen to know a public repo, w/ history as above, ie
w/ more then one long-lived branch that has seen some fast-forwards? 
I wonder how reliable recovering the missing link would be...

And there's no reason why this operation should take ~20 minutes, even
for the randomly chosen, but real, worst case. But finding a good repo
to test w/ would take longer than writing the code...

artur