Re: Find out on which branch a commit was originally made

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In message <4C96B97D.6030209@xxxxxxxxx>, Artur Skawina writes:

    On 09/20/10 01:54, Seth Robertson wrote:

    > I'd like a command that would tell me the right branch something was
    > on whether it was on master or topic or whatever.  If instead of
    > "master" the branch was named "supertopic" and master commit AA had
    > child D would that make a difference?

    Like i said, "arguably". In theory, no, there is no difference. In
    practice, some branches will be more long-lived than others -- and
    certain conventions will apply. Hence, i think that answer /is/ the
    right one, in context -- that script was specifically looking for
    info on /another/ branch.

Only if the topic branch didn't have a merge on it.

         -AA-- subtopic
        /     \
       A---B---C topic
      /         \
 D---E---F---G---H---I---J---K---L---M---N master
                          \         /
                           O---P---Q another-topic


In the above example, the subtopic branch merge from AA to C prevents
you from finding out what branch B is on using the original script.


    > I'm not sure how you can figure out when a branch was first created.
    > We might "know" that master is older than the others, but if this
    > commit was on another-topic and supertopic we cannot use that
    > intuition..

    > Returning all possible branch names at least gives the user somewhere
    > to start and does not give them ones which are obviously insane.

    IOW, why would the right answer for 'F' be both 'master' and
    'another-topic', but for 'B' - just 'topic'?

I agree 100% that the right answer is topic for B and master for F.

I know how to get topic for B.  Finding master (and not another-topic)
for F is difficult because we have to know something that I don't know
how to get git to tell me: when another-topic branch was created.
Using git-rev-parse another-topic....master we know what commit
another-topic and master diverged, but I cannot figure out a way to
discover which branch was created at that point and which branch
pre-existed (obviously for master we know, but if this was a
supertopic branch we would not).  I thought about using merge
direction for subsequent merges as a hint, but we don't know if the
second branch has been permanently been merged or not, if there was a
K->P merge and Q-M did not happen (yet) then we would give the wrong
branch name.

If you (or anyone) can answer that question, I'll be happy to update
the script.  Otherwise getting both answers is as close as we can come.

					-Seth Robertson
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]