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

Re: [PATCH 0/2] [RFD] Using gitrevisions :/search style with other operators

From
Kevin Ballard <kevin@sb.org>
Date
Dec 10, 2010, 23:11 UTC
Message-ID
<64905EED-F368-4D3F-9D2D-C08D9B460D67@sb.org>
In-Reply-To
<7vipz1b4zm.fsf@alter.siamese.dyndns.org>
On Dec 10, 2010, at 3:08 PM, Junio C Hamano wrote:
Show 19 quoted lines
> Kevin Ballard <kevin@sb.org> writes:
> 
>> On Dec 10, 2010, at 11:03 AM, Jonathan Nieder wrote:
>> 
>>> - What is the intended use for this family of modifiers?  I sort
>>>  of understand ^{:i/... } for people that forget what case they
>>>  have used, but why the :nth and others?
>> 
>> In my particular case, I was glancing through the logs, and I wanted to grab
>> the second branch that someone else had made that was merged into pu. I would
>> have loved to be able to run something like
>> 
>>  git merge origin/pu^{:nth(2)/nd/}
>> 
>> While we're speaking of modifiers, could we use one that says "only search
>> the first parent hierarchy", e.g. something equivalent to git log's --first-parent
>> flag?
> 
> Both feels like a very made-up example to me.

And yet the example I gave is pretty much precisely what prompted me to start this discussion in the first place.

Show 18 quoted lines
> The reason you can so sure that you can to give nth(2) not nth(3) nor
> nth(1) and run "merge" in the example is probably because you looked at
> the output from "git log --first-parent --oneline origin..origin/pu", no?
> 
>  d414638 Merge branch 'rj/msvc-fix' into pu
>  e5f5e49 Merge branch 'ak/describe-exact' into pu
>  439932d Merge branch 'jn/svn-fe' into pu
>  d60b33b Merge branch 'pd/bash-4-completion' into pu
>  09cbbde Merge branch 'tf/commit-list-prefix' into pu
>  1b2ea00 Merge branch 'mg/cvsimport' into pu
>  c6d41f4 Merge branch 'nd/maint-relative' into pu
>  81f395e Merge branch 'ab/i18n' into pu
>  9f5471f Merge branch 'nd/setup' into pu
>  06f74a4 Merge branch 'yd/dir-rename' into pu
>  d8a2ec8 Merge branch 'en/object-list-with-pathspec' into pu
> 
> After looking at this output, do you really want to say ":nth(2)/nd/"
> instead of 9f5471f?

Yep. Doing the latter either requires me to swap over to my mouse, copy the sha1, and paste in, or requires me to peer at the sha1 and re-type enough characters. It's a lot easier to just glance at that list, realize the 2nd one is the one I want, and type `git merge :^{nth(2)/nd/}`. It may not necessarily be faster than retyping the sha1, but it's a lot less prone to transcription errors.

-Kevin Ballard
Previous: Junio C HamanoNext: Junio C Hamano
Message 22 of 32 in “[RFD] Using gitrevisions :/search style with other operators”
  1. 0/2 [RFD] Using gitrevisions :/search style with other operatorsNguyễn Thái Ngọc Duy, Dec 8, 2010
  2. 1/2 get_sha1_oneline: allow to input commit_listNguyễn Thái Ngọc Duy, Dec 8, 2010
  3. Thiago FarinaDec 8, 2010
  4. 2/2 get_sha1: support ref^{/regex} syntaxNguyễn Thái Ngọc Duy, Dec 8, 2010
  5. Junio C HamanoDec 8, 2010
  6. Jonathan NiederDec 8, 2010
  7. Jakub NarebskiDec 8, 2010
  8. Nguyen Thai Ngoc DuyDec 9, 2010
  9. Jakub NarebskiDec 9, 2010
  10. Jonathan NiederDec 9, 2010
  11. Kevin BallardDec 9, 2010
  12. Nguyen Thai Ngoc DuyDec 9, 2010
  13. Jonathan NiederDec 9, 2010
  14. Junio C HamanoDec 9, 2010
  15. Jakub NarebskiDec 9, 2010
  16. Nguyen Thai Ngoc DuyDec 10, 2010
  17. Jonathan NiederDec 10, 2010
  18. Jakub NarebskiDec 10, 2010
  19. Kevin BallardDec 10, 2010
  20. Jeff KingDec 10, 2010
  21. Junio C HamanoDec 10, 2010
  22. Kevin BallardDec 10, 2010
  23. Junio C HamanoDec 10, 2010
  24. Junio C HamanoDec 9, 2010
  25. Jakub NarebskiDec 8, 2010
  26. Jonathan NiederDec 8, 2010
  27. Nguyen Thai Ngoc DuyDec 9, 2010
  28. Jakub NarebskiDec 9, 2010
  29. Nguyen Thai Ngoc DuyDec 9, 2010
  30. Kevin BallardDec 9, 2010
  31. Jakub NarebskiDec 9, 2010
  32. Nguyen Thai Ngoc DuyDec 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.