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

Re: [RFC/PATCH 3/3] builtin/show.c: do not prune by pathspec

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Mar 31, 2011, 12:07 UTC
Message-ID
<4D946E85.9030405@drmicha.warpmail.net>
In-Reply-To
<4D94688B.1070703@viscovery.net>
Johannes Sixt venit, vidit, dixit 31.03.2011 13:42:
Show 32 quoted lines
> Am 3/31/2011 12:58, schrieb Michael J Gruber:
>> Johannes Sixt venit, vidit, dixit 31.03.2011 12:18:
>>> Am 3/31/2011 11:17, schrieb Michael J Gruber:
>>>> By design, "git show commit -- path" is not "git show commit:path", and
>>>> there is no reason to change that. But "git show commit -- path" simply
>>>> returns nothing at all "most of the time" because it prunes by pathspec
>>>> even though it does not walk commits. This is pretty useless.
>>>>
>>>> So, turn off pruning (but keep diff limiting of course) so that "git
>>>> show commit -- path" shows the commit message and the diff that the
>>>> commit introduces to path (filtered by path); only the diff will be
>>>> empty "most of the time".
>>>
>>> How does this interfere with git show --walk commit -- path? Will it now
>>> show all commits instead of just those that changed path?
>>
>> Hmpft,
>>
>> git show --walk origin/master
>> fatal: unrecognized argument: --walk
>>
>> No, that is without my patch ;)
>>
>> In other words: "ENOPARSEOPTS in revision.c", there is no "--walk".
> 
> 8-( Oops sorry, and thanks for doing research that I should have done. At
> first, I thought it's named --walk because we have --no-walk. But the name
> is --do-walk.
> 
> My question is then:
> 
> How does this interfere with git show --do-walk commit -- path?

Uh, didn't know that one. If I had thought we have a consistent interface before...

So, yes, it changes that case also. Note that nothing in git-show[1] hints at the fact that one can use rev-list arguments, especially that one could walk the commits, so it is undocumented behavior which would change.

I would even say that quite generally it is difficult to find cases where prune and no_walk make sense together. One may construe a user who feeds a list of commits to "rev-list --no-walk" and uses it as a filter, returning only those commits which touch a given pathspec. But, I'm not suggesting to change "rev-list --no-walk -- pathspec" or log.

But I do think that "show" would benefit from a better default. An alternative would be to imply --sparse (i.e. dense=0).

BTW: If you look at cmd_log_reflog() you see that already for other
log-like commands we have the problem that we have to override the
log-centric defaults from cmd_log_init(), which means ignoring certain
user specified rev-list and diff-core options!
Michael
Previous: Johannes SixtNext: Nguyen Thai Ngoc Duy
Message 12 of 29 in “Usability improvement request: git show revision -- file”
  1. Piotr KrukowieckiMar 31, 2011
  2. Michael J GruberMar 31, 2011
  3. 1/3 t1506: factor out test for "Did you mean..."Michael J Gruber, Mar 31, 2011
  4. 2/3 sha1_name: Suggest commit:./file for path in subdirMichael J Gruber, Mar 31, 2011
  5. Junio C HamanoMar 31, 2011
  6. Michael J GruberApr 1, 2011
  7. Junio C HamanoApr 1, 2011
  8. 3/3 builtin/show.c: do not prune by pathspecMichael J Gruber, Mar 31, 2011
  9. Johannes SixtMar 31, 2011
  10. Michael J GruberMar 31, 2011
  11. Johannes SixtMar 31, 2011
  12. Michael J GruberMar 31, 2011
  13. Nguyen Thai Ngoc DuyMar 31, 2011
  14. Michael J GruberMar 31, 2011
  15. Nguyen Thai Ngoc DuyMar 31, 2011
  16. Michael J GruberMar 31, 2011
  17. Junio C HamanoMar 31, 2011
  18. Michael J GruberApr 1, 2011
  19. 0/4 reflog, show and command line overridesMichael J Gruber, Apr 1, 2011
  20. 1/4 builtin/log.c: separate default and setup of cmd_log_init()Michael J Gruber, Apr 1, 2011
  21. 2/4 t/t1411: test reflog with formatsMichael J Gruber, Apr 1, 2011
  22. 3/4 reflog: fix overriding of command line optionsMichael J Gruber, Apr 1, 2011
  23. 4/4 builtin/show: do not prune by pathspecMichael J Gruber, Apr 1, 2011
  24. Junio C HamanoApr 1, 2011
  25. Junio C HamanoApr 1, 2011
  26. Michael J GruberApr 3, 2011
  27. Junio C HamanoApr 4, 2011
  28. Michael J GruberApr 5, 2011
  29. Piotr KrukowieckiMar 31, 2011

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.