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

Re: What's cooking in git.git (Jan 2010, #01; Mon, 04)

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 6, 2010, 17:07 UTC
Message-ID
<7vocl7yxef.fsf@alter.siamese.dyndns.org>
In-Reply-To
<alpine.DEB.1.00.1001061219180.11013@intel-tinevez-2-302>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 14 quoted lines
> It might be easier to understand like this:
>
> 	case "$1" in
> 	*...*)
> 		left=${1%...*} &&
> 		right=${1#*...} &&
> 		onto="$(git merge-base "${left:-HEAD}" "${right:-HEAD}")" &&
> 		test ! -z "$onto" &&
> 		echo "$onto"
> 	;;
> 	*)
> 		git rev-parse --verify "$1^0"
> 	;;
> 	esac
Double-semicolons should be indented one level deeper.

I think your version may be slightly better (avoids one "expr"), but it actually was much harder to read your cascade of && that implicitly exits with non-zero status in the first case arm than the explicit exit status given by the original patch.

As far as I can tell, both versions inherit the same bug from me when the user gave us A...B pair that has more than one merge bases. I think you need to give --all to merge-base and resurrect the "did we get more than one" test from her patch.

> Besides, why do you change the "$1" to "$1^0"?
Isn't it a bugfix?

Earlier code wouldn't have caught "--onto $blob_id" as an error, but this will do so---I actually think it is a good change.

Show 7 quoted lines
>> diff --git a/git-rebase.sh b/git-rebase.sh
>> index 6503113..43c62c0 100755
>> --- a/git-rebase.sh
>> +++ b/git-rebase.sh
>
> I would separate the patches.  rebase.sh and rebase--interactive.sh are 
> fundamentally different.

I too think splitting into two patches would make sense in this case. The patch to git-rebase.sh seems to be a bugfix in the left/right computation; I am kind of surprised that I haven't triggered it myself so far.

Thanks.
Previous: Johannes SchindelinNext: Nanako Shiraishi
Message 21 of 32 in “What's cooking in git.git (Jan 2010, #01; Mon, 04)”
  1. Junio C HamanoJan 4, 2010
  2. Matthieu MoyJan 4, 2010
  3. Junio C HamanoJan 4, 2010
  4. Johannes SixtJan 4, 2010
  5. Junio C HamanoJan 5, 2010
  6. Jeff KingJan 5, 2010
  7. Junio C HamanoJan 5, 2010
  8. Johannes SixtJan 5, 2010
  9. Junio C HamanoJan 6, 2010
  10. Johannes SixtJan 6, 2010
  11. Junio C HamanoJan 6, 2010
  12. Junio C HamanoJan 5, 2010
  13. Jeff KingJan 5, 2010
  14. Tay Ray ChuanJan 5, 2010
  15. Teach --[no-]rerere-autoupdate option to merge, revert and friendsJunio C Hamano, Jan 5, 2010
  16. Johan HerlandJan 5, 2010
  17. Ilari LiusvaaraJan 5, 2010
  18. Junio C HamanoJan 6, 2010
  19. Nanako ShiraishiJan 6, 2010
  20. Johannes SchindelinJan 6, 2010
  21. Junio C HamanoJan 6, 2010
  22. 1/2 rebase: fix --onto A...B parsing and add testsNanako Shiraishi, Jan 7, 2010
  23. 2/2 rebase -i: teach --onto A...B syntaxNanako Shiraishi, Jan 7, 2010
  24. Junio C HamanoJan 7, 2010
  25. Johannes SixtJan 7, 2010
  26. Avery PennarunJan 8, 2010
  27. Sverre RabbelierJan 8, 2010
  28. Avery PennarunJan 8, 2010
  29. Sverre RabbelierJan 8, 2010
  30. A Large Angry SCMJan 8, 2010
  31. Johannes SchindelinJan 9, 2010
  32. Avery PennarunJan 9, 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.