Re: Find out on which branch a commit was originally made) (was ANNOUNCE git-what-branch)
- From
- Seth Robertson <in-gitvger@baka.org>
- Date
- Sep 24, 2010, 20:57 UTC
- Message-ID
- <201009242057.o8OKvJRE024995@no.baka.org>
- In-Reply-To
- <4C9BC757.3050803@gmail.com>
In message <4C9BC757.3050803@gmail.com>, Artur Skawina writes:
$ time git-show-merge-path 86ab04c8c1df51df master release
b1bc81a0ef86 M: 'master'@$KO/linville/wireless-next-2.6 090607 11:24
36432dae73cf M: 'master'@$KO/davem/net-next-2.6 090611 14:00
2ed0e21b30b5 M: $KO/davem/net-next-2.6 090615 16:40
# Merged into release and master
0m3.056s user 0m0.207s system 0m3.154s elapsed 103.46% CPU Script below; w/ one or two args works like the previous
git-find-branch-for, except it's ~two times faster for expensive
queries and does that silly five old branch request in <13s, for
*all* 150 headsThanks to your suggestion about using git rev-list with more than two references I was able to massively increase the performance of my script, from 26 minutes to 26 seconds, for the linux kernel search test.
I have updated http://github.com/SethRobertson/git-what-branch to release v0.2.1 with the performance boost and some display enhancements.
-------------------------------------------------- time git-what-branch --reference master 86ab04c8c1df51df 86ab04c8c1df51df used the following minimal temporal path: merged to v2.6.30-rc6-1103-gb1bc81a @Sun Jun 7 07:24:21 2009 merged to v2.6.30-5398-g2ed0e21 @Mon Jun 15 12:40:05 2009 v2.6.30-5398-g2ed0e21 is on master 5.97user 0.45system 0:06.08elapsed --------------------------------------------------
Still no ff-detection, mostly due to lack of (real) test case.
Here are some fake test cases. The question is which branch do tags masterE and newbrBB appear on.
# Demonstrates picking wrong branch for "master" MERGE="git merge" mkdir foo; cd foo; git init; echo A > A; git add A; git commit -a -m "initial" echo B >> A; git commit -a -m "B"; echo C >> A; git commit -a -m "C" git branch newbr; echo AB > B; git add B; git commit -a -m "newbr" git checkout master; echo D >> A; git commit -a -m "D"; git tag masterD; git checkout newbr; $MERGE master; echo BB >> B; git commit -a -m "BB"; git tag newbrBB git checkout master; echo E >> A; git commit -a -m "E"; git tag masterE; git checkout newbr; $MERGE master; echo CB >> B; git commit -a -m "CB" git checkout master; echo F >> A; git commit -a -m "F" git checkout newbr; $MERGE master; echo DB >> B; git commit -a -m "DB" git checkout master; $MERGE newbr; echo G >> A; git commit -a -m "G" echo H >> A; git commit -a -m "H"; echo J >> A; git commit -a -m "J"; git tag masterJ git checkout newbr; $MERGE master; echo eB >> B; git commit -a -m "EB"; git tag newbrEB git checkout master; echo K >> A; git commit -a -m "K"; $MERGE newbr unset MERGE
# Demonstrates picking the wrong branch for "newbr" MERGE="git merge" mkdir foo; cd foo; git init; echo A > A; git add A; git commit -a -m "initial" echo B >> A; git commit -a -m "B"; echo C >> A; git commit -a -m "C" git branch newbr; echo AB > B; git add B; git commit -a -m "newbr" git checkout master; echo D >> A; git commit -a -m "D"; git tag masterD; git checkout newbr; $MERGE master; echo BB >> B; git commit -a -m "BB"; git tag newbrBB git checkout master; echo E >> A; git commit -a -m "E"; git tag masterE; git checkout newbr; $MERGE master; echo CB >> B; git commit -a -m "CB" git checkout master; echo F >> A; git commit -a -m "F" git checkout newbr; echo DB >> B; git commit -a -m "DB" git checkout master; $MERGE newbr; echo G >> A; git commit -a -m "G" echo H >> A; git commit -a -m "H"; echo J >> A; git commit -a -m "J"; git tag masterJ git checkout newbr; $MERGE master; echo eB >> B; git commit -a -m "EB"; git tag newbrEB git checkout master; echo K >> A; git commit -a -m "K"; $MERGE newbr unset MERGE
-Seth Robertson