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

Re: git-send-mail in sh

From
Andreas Ericsson <ae@op5.se>
Date
Nov 27, 2005, 23:34 UTC
Message-ID
<438A426B.7070607@op5.se>
In-Reply-To
<7v4q5xbvip.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 10 quoted lines
> Andreas Ericsson <ae@op5.se> writes:
> 
>>            # single commit
>>            com1="${com1##*^}"
>>            range="$com1^1..$com1"
>>            ;;
> 
> 
> I wonder if you meant "${com1%^}" here, to remove the trailing '^'.
> 
I did/do/done. :)
Show 12 quoted lines
> 
>>        ?*^[0-9]|?*^[0-9][0-9])
>>            # series of commits, ranging back from <commit-ish>
>>            range="$com1..${com1%%^*}"
>>            ;;
>>        ^[0-9]|^[0-9][0-9])
>>            # series of commits, ranging back from HEAD
>>            range="HEAD$com1..HEAD"
>>            ;;
> 
> 
> N generation back in extended SHA1 notation uses a tilde '~',

I just noticed that after sending the original email. I've changed it to take tilde instead.

Show 13 quoted lines
> Also limiting to between 0 and 99
> generations misinterprets "HEAD~123".
> 
> Although checking only the letter that follows the tilde is a
> digit mistakenly accepts something like "master~1-bad-one", that
> is already malformed and whatever comes downstream would barf,
> so that may be fine.  How about something like:
> 
> 	?*'~'[1-9]*)
>         	range="$com1..${com1%~*}" ;;
> 	'~'[1-9]*)
>         	range="HEAD$com1..HEAD" ;;
> 
Fine by me, although that 99 patches limit was sort of semi-intentional. 
Doing it this way makes case order matter since
	?*'~'[1-9]*
will also match
	<commit>~3..HEAD

I'll stick with your way though and put a comment there so people don't touch the ordering.

Thanks for the expr lesson btw.
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Junio C HamanoNext: Nikolai Weibull
Message 13 of 22 in “git-send-mail in sh”
  1. Andreas EricssonNov 25, 2005
  2. Nikolai WeibullNov 25, 2005
  3. Andreas EricssonNov 25, 2005
  4. Fernando J. PeredaNov 25, 2005
  5. Johannes SchindelinNov 25, 2005
  6. Andreas EricssonNov 25, 2005
  7. A Large Angry SCMNov 25, 2005
  8. Junio C HamanoNov 25, 2005
  9. Andreas EricssonNov 25, 2005
  10. Junio C HamanoNov 25, 2005
  11. Andreas EricssonNov 26, 2005
  12. Junio C HamanoNov 27, 2005
  13. Andreas EricssonNov 27, 2005
  14. Nikolai WeibullNov 28, 2005
  15. Junio C HamanoNov 26, 2005
  16. Yann DirsonNov 26, 2005
  17. Ryan AndersonNov 25, 2005
  18. Andreas EricssonNov 25, 2005
  19. Ryan AndersonNov 28, 2005
  20. Andreas EricssonNov 28, 2005
  21. Junio C HamanoNov 28, 2005
  22. Andreas EricssonNov 29, 2005

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.