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

Re: [RFH] cleaning up "add across symlinks"

From
TTarmigan <tarmigan+git@gmail.com>
Date
Apr 16, 2008, 21:26 UTC
Message-ID
<905315640804161426l442c2812k3c36c1bafe484157@mail.gmail.com>
In-Reply-To
<7vd4oppllw.fsf@gitster.siamese.dyndns.org>
On Wed, Apr 16, 2008 at 1:53 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
> If you have this structure in your work tree:
>
>         lrwxrwxrwx a -> c
>         drwxrwxrwx c
>         -rw-rw-rw- c/b
>
>  and let million monkeys give random paths to "git-update-index --add" or
>  "git add", you should end up with the index with two entries, a symlink
>  "a" and file "c/b".
>
>  Not so.  If an unfortunate monkey says "git add a/b", we happily add it to
>  the index, because we notice lstat("a/b") succeeds and assume that there
>  is such a path.  There isn't, as far as git is concerned, because we track
>  symbolic links.
Thanks Junio, I'll try to do some testing with it later.
Show 9 quoted lines
>  +test_expect_success 'add confusion (3)' '
>  +
>  +       test_must_fail git add "a/*" &&
>  +
>  +       git ls-files >actual &&
>  +       test_cmp expect actual
>  +'
>  +
>  +test_done

That's almost the case I used. The exact test to add to these, without the '*' after a/, would be something like this (warning: cut and paste):

+test_expect_success 'add confusion (4)' '
+
+       test_must_fail git add "a/" &&
+
+       git ls-files >actual &&
+       test_cmp expect actual
+'

Thanks, Tarmigan

Previous: Junio C HamanoNext: Tarmigan
Message 2 of 3 in “[RFH] cleaning up "add across symlinks"”
  1. Junio C HamanoApr 16, 2008
  2. TarmiganApr 16, 2008
  3. TarmiganApr 17, 2008

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.