git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
SRSeth 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 heads

Thanks 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
Previous: Artur SkawinaNext: Seth Robertson
Message 30 of 33 in “Find out on which branch a commit was originally made”
  1. Stefan HallerSep 18, 2010
  2. Ævar Arnfjörð BjarmasonSep 18, 2010
  3. Ævar Arnfjörð BjarmasonSep 18, 2010
  4. Tor ArntsenSep 18, 2010
  5. Stefan HallerSep 18, 2010
  6. Artur SkawinaSep 18, 2010
  7. Stefan HallerSep 19, 2010
  8. Clemens BuchacherSep 19, 2010
  9. Artur SkawinaSep 19, 2010
  10. Stefan HallerSep 19, 2010
  11. Artur SkawinaSep 19, 2010
  12. Robin RosenbergSep 19, 2010
  13. Seth RobertsonSep 19, 2010
  14. Artur SkawinaSep 19, 2010
  15. Seth RobertsonSep 19, 2010
  16. Artur SkawinaSep 20, 2010
  17. Seth RobertsonSep 20, 2010
  18. Stefan HallerSep 20, 2010
  19. Artur SkawinaSep 20, 2010
  20. Artur SkawinaSep 20, 2010
  21. Seth RobertsonSep 21, 2010
  22. Artur SkawinaSep 21, 2010
  23. ANNOUNCE git-what-branch (was Re: Find out on which branch a commit was originally made)Seth Robertson, Sep 22, 2010
  24. Artur SkawinaSep 22, 2010
  25. Seth RobertsonSep 22, 2010
  26. Stephen BashSep 23, 2010
  27. Ævar Arnfjörð BjarmasonSep 23, 2010
  28. Artur SkawinaSep 23, 2010
  29. Artur SkawinaSep 24, 2010
  30. Seth RobertsonSep 24, 2010
  31. Seth RobertsonSep 23, 2010
  32. Stefan HallerSep 20, 2010
  33. Bryan DrewerySep 24, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.