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

Re: Bug Report: git ls-files -d

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 27, 2021, 21:21 UTC
Message-ID
<xmqqtui5ogt3.fsf@gitster.g>
In-Reply-To
<CAP9BFHVdg_BWZ2wvdv8t-mN3WKjW4fA+v2181WRYQGsrgmvKmA@mail.gmail.com>
    What did you expect to happen? (Expected behavior)
    git ls-files -d to show deleted files in my repository
    What happened instead? (Actual behavior)
    nothing is shown
Does not reproduce to me.
    $ git reset --hard
    $ git ls-files -s COPYING
    100644 536e55524db72bd2acf175208aef4f3dfc148d42 0	COPYING
    $ ls -1 COPYING
    COPYING
    $ git ls-files -d; echo no output
    no output
    $ rm COPYING
    $ git ls-files -d
    COPYING

Did you remove any file? "ls-files -d" reports the working tree files that have been removed that are still known by the index. So, after all of the above

    $ git rm --cached COPYING
    $ git ls-files -d; echo no output
    no output
is perfectly expected.

Unlike "git ls-files" that checks the working files against what is in the index, "git status" checks them against both the index and the HEAD, so after all of the above, it would notice the removal relative to HEAD:

    $ git status -uno --porcelain
    D  COPYING
HTH.
Previous: Calvin Taylor
Message 2 of 2 in “Bug Report: git ls-files -d”
  1. Calvin TaylorSep 27, 2021
  2. Junio C HamanoSep 27, 2021

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.