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

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

 



Artur Skawina <art.08.09@xxxxxxxxx> wrote:

> >>          -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.
> >
> >   Called with "B" "master", it returns H
> 
> No, it will return both C and H, just like my one-liner;

Right, there was a bug in my script: it doesn't work if B is a direct
parent of the next merge. (For A, it would correctly return only H.)  To
fix that, you'd need this version:

#!/bin/sh

git rev-list --ancestry-path --merges --reverse "$1".."${2-master}" \
  | while read ref
do
  if [ "$1" != "$ref"^ -a -z "$(git rev-list --ancestry-path "$1".."$ref"^)" ]
  then
    git --no-pager log -1 --pretty=oneline "$ref"
  fi
done

But of course, since your version is so much faster, I'll no longer
bother with mine.  Thanks!

-Stefan


-- 
Stefan Haller
Berlin, Germany
http://www.haller-berlin.de/
--
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]