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

Re: [PATCH/WIP 03/11] t5403: avoid doing "git add foo/bar" where foo/.git exists

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 26, 2011, 17:26 UTC
Message-ID
<7vr51z3bqx.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CACsJy8CjJnO6rDVTV1tC9rWXP51LHBtUvNsgVWNfwC+HuNQ-6Q@mail.gmail.com>
Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:
> Now look from "git add" perspective, it does not really care where
> $GIT_DIR is.
> It assumes that $(pwd) is working directory's top. So it
Now you confused me.

Doesn't it use $GIT_DIR to find the index? And it decides that it is at the top level because it is given GIT_DIR but not GIT_WORKING_TREE which is how working tree discovery is defined.

Show 9 quoted lines
>  - reads content of current directory, it sees "clone2" as a directory
>  - it descends in and see ".git" so "clone2" must be a git link
>  - because clone2 is a separate repository (again $GIT_DIR is not
> consulted), "b" should be managed by "clone2"
>  - so it stops.
>
> This is the only place I see a submodule (from the first glance) is
> actually top level repository. Yes I guess we can support this, but
> it's just too weird to be widely used in pratice..
Where did you get this idea that submodule is somehow involved in this test?

I do not see there is any submodules involved; the test uses two repositories 1 and 2 that appear in the working tree of the main repository test infrastructure created, but otherwise there is no sub/super relation among these three, and there are many other tests with "clone" or "mkdir+init" or "init <newdir>" in the main test repository.

The clone2 repository tracks a path without having a corresponding file in its working tree (i.e. it has "b" but tracks "clone2/b") which I already is said unusual, but unusual does not mean it is bad or we want to remove a test that covers the unusual case to let a change that regresses the case go unnoticed.

Show 11 quoted lines
>> Running (cd clone2 && git add b) is a _more natural_ thing to do, and it
>> will result in a path "b" added to the clone2 repository, so that the
>> result is more useful if you are going to chdir to the repository and keep
>> working on it. But that does not mean the existing test is incorrect. It
>> does not just pass somehow but the test passes by design.
>>
>> I did not check if later tests look at the contents of commit "new2" to
>> make sure it contains "clone2/b", but if they do this change should break
>> such tests.
>>
>> So I am puzzled by this change; what is this trying to achieve?
So again, what is this change trying to achieve?
Previous: Nguyen Thai Ngoc DuyNext: Nguyen Thai Ngoc Duy
Message 31 of 50 in “read_directory() rewrite to support struct pathspec”
  1. 00/11 read_directory() rewrite to support struct pathspecNguyễn Thái Ngọc Duy, Oct 24, 2011
  2. 01/11 Introduce "check-attr --excluded" as a replacement for "add --ignore-missing"Nguyễn Thái Ngọc Duy, Oct 24, 2011
  3. Junio C HamanoOct 27, 2011
  4. Nguyen Thai Ngoc DuyOct 28, 2011
  5. 02/11 notes-merge: use opendir/readdir instead of using read_directory()Nguyễn Thái Ngọc Duy, Oct 24, 2011
  6. Junio C HamanoOct 25, 2011
  7. Nguyen Thai Ngoc DuyOct 26, 2011
  8. Junio C HamanoOct 26, 2011
  9. Nguyen Thai Ngoc DuyOct 27, 2011
  10. Junio C HamanoOct 27, 2011
  11. Nguyen Thai Ngoc DuyOct 28, 2011
  12. 1/2 t3310: Add testcase demonstrating failure to --commit from within another dirJohan Herland, Mar 12, 2012
  13. 2/2 notes-merge: use opendir/readdir instead of using read_directory()Johan Herland, Mar 12, 2012
  14. Nguyen Thai Ngoc DuyMar 12, 2012
  15. fixup! t3310 on WindowsJohannes Sixt, Mar 14, 2012
  16. Johan HerlandMar 14, 2012
  17. Johannes SixtMar 14, 2012
  18. David BremnerMar 14, 2012
  19. Johan HerlandMar 14, 2012
  20. Junio C HamanoMar 14, 2012
  21. 3/2 notes-merge: Don't remove .git/NOTES_MERGE_WORKTREE; it may be the user's cwdJohan Herland, Mar 14, 2012
  22. Junio C HamanoMar 15, 2012
  23. Junio C HamanoMar 15, 2012
  24. Johan HerlandMar 15, 2012
  25. Re* [PATCH 3/2] notes-merge: Don't remove .git/NOTES_MERGE_WORKTREE; it may be the user's cwdJunio C Hamano, Mar 15, 2012
  26. Junio C HamanoMar 15, 2012
  27. Johannes SixtMar 15, 2012
  28. 03/11 t5403: avoid doing "git add foo/bar" where foo/.git existsNguyễn Thái Ngọc Duy, Oct 24, 2011
  29. Junio C HamanoOct 25, 2011
  30. Nguyen Thai Ngoc DuyOct 26, 2011
  31. Junio C HamanoOct 26, 2011
  32. Nguyen Thai Ngoc DuyOct 27, 2011
  33. Junio C HamanoOct 27, 2011
  34. Nguyen Thai Ngoc DuyOct 30, 2011
  35. Junio C HamanoOct 30, 2011
  36. Nguyen Thai Ngoc DuyOct 30, 2011
  37. Junio C HamanoOct 30, 2011
  38. 04/11 tree-walk.c: do not leak internal structure in tree_entry_len()Nguyễn Thái Ngọc Duy, Oct 24, 2011
  39. Junio C HamanoOct 25, 2011
  40. 05/11 symbolize return values of tree_entry_interesting()Nguyễn Thái Ngọc Duy, Oct 24, 2011
  41. Junio C HamanoOct 25, 2011
  42. Junio C HamanoOct 27, 2011
  43. Nguyen Thai Ngoc DuyOct 30, 2011
  44. 06/11 read_directory_recursive: reduce one indentation levelNguyễn Thái Ngọc Duy, Oct 24, 2011
  45. 07/11 tree_entry_interesting: make use of local pointer "item"Nguyễn Thái Ngọc Duy, Oct 24, 2011
  46. 08/11 tree-walk: mark useful pathspecsNguyễn Thái Ngọc Duy, Oct 24, 2011
  47. 09/11 tree_entry_interesting: differentiate partial vs full matchNguyễn Thái Ngọc Duy, Oct 24, 2011
  48. 10/11 read-dir: stop using path_simplify code in favor of tree_entry_interesting()Nguyễn Thái Ngọc Duy, Oct 24, 2011
  49. 11/11 dir.c: remove dead code after read_directory() rewriteNguyễn Thái Ngọc Duy, Oct 24, 2011
  50. Junio C HamanoOct 24, 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.