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

Re: [PATCH 2/4] add -u: get rid of "treewideupdate" configuration

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 9, 2011, 04:56 UTC
Message-ID
<7v39ls10q6.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110409043824.GA22543@do>
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
Show 6 quoted lines
> On Fri, Apr 08, 2011 at 04:18:46PM -0700, Junio C Hamano wrote:
>> It appears that we might want to further tweak the code that tries to
>> disambiguate between revs and paths (we error out when argv[i] does not
>> name a rev and lstat(argv[i]) fails)
>
> Something like below?

That's too loose for my taste. At that point in the codepath, don't we sometimes expect the argv[i] might name a blob in the index?

By "we might want to further...", I meant "when we properly redesign the get_pathspec vs init_pathspec combination".

There are places in the current code that call verify_filename() to make sure that argv[i] is a pathspec after making sure argv[i] cannot be an object name. Currently it just does lstat() on it to see if it names a path.

Instead, when we refactor get/init-pathspec API, we could expose an interface to turn one element from argv[] into a "struct pathspec_item". Then we can try to feed argv[i] to that string-to-pathspec_item function, and consider that argv[i] _is_ a proper pathspec only if it parses correctly *and* if it matches either an item in the current working tree.

That would be a moral equivalent of the current verify_filename() check but is far more precise one; e.g. the current code rejects

	git grep -e foo '*.c' ;# bad

because '*.c' is not an object name, but lstat("*.c") fails, and you need to disambiguate with '--'. If you rewrite the verify_filename() in the way I outlined above, you wouldn't have to.

Previous: Nguyen Thai Ngoc DuyNext: Nguyen Thai Ngoc Duy
Message 23 of 35 in “Redoing the "add -u" migration plan”
  1. 0/4 Redoing the "add -u" migration planJunio C Hamano, Apr 7, 2011
  2. 1/4 magic pathspec: add tentative ":/path/from/top/level" pathspec supportJunio C Hamano, Apr 7, 2011
  3. Junio C HamanoApr 7, 2011
  4. Nguyen Thai Ngoc DuyApr 7, 2011
  5. Junio C HamanoApr 7, 2011
  6. Nguyen Thai Ngoc DuyApr 8, 2011
  7. Nguyen Thai Ngoc DuyApr 7, 2011
  8. Junio C HamanoApr 7, 2011
  9. Nguyen Thai Ngoc DuyApr 8, 2011
  10. Junio C HamanoApr 8, 2011
  11. Nguyen Thai Ngoc DuyApr 8, 2011
  12. Junio C HamanoApr 8, 2011
  13. Nguyen Thai Ngoc DuyApr 8, 2011
  14. 2/4 add -u: get rid of "treewideupdate" configurationJunio C Hamano, Apr 7, 2011
  15. Jeff KingApr 8, 2011
  16. Junio C HamanoApr 8, 2011
  17. Jeff KingApr 8, 2011
  18. Junio C HamanoApr 8, 2011
  19. Jeff KingApr 8, 2011
  20. Junio C HamanoApr 8, 2011
  21. Junio C HamanoApr 8, 2011
  22. Nguyen Thai Ngoc DuyApr 9, 2011
  23. Junio C HamanoApr 9, 2011
  24. Nguyen Thai Ngoc DuyApr 9, 2011
  25. Junio C HamanoApr 9, 2011
  26. Nguyen Thai Ngoc DuyApr 9, 2011
  27. Junio C HamanoApr 9, 2011
  28. Nguyen Thai Ngoc DuyApr 9, 2011
  29. Nguyen Thai Ngoc DuyApr 9, 2011
  30. Junio C HamanoApr 9, 2011
  31. Nguyen Thai Ngoc DuyMay 3, 2011
  32. Junio C HamanoMay 3, 2011
  33. Nguyen Thai Ngoc DuyMay 3, 2011
  34. 3/4 add: make "add -u/-A" update full tree without pathspec (step 2)Junio C Hamano, Apr 7, 2011
  35. 4/4 add: make "add -u/-A" update full tree without pathspec (step 3)Junio C Hamano, Apr 7, 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.