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

Re: How do I clear the directory cache

From
Eeschvoca <eschvoca@gmail.com>
Date
Oct 21, 2005, 20:16 UTC
Message-ID
<2b05065b0510211316j632c461apbb6f2f162e5fc7ef@mail.gmail.com>
In-Reply-To
<7vmzl34ikl.fsf@assigned-by-dhcp.cox.net>
On 10/21/05, Junio C Hamano <junkio@cox.net> wrote:
Show 28 quoted lines
> eschvoca <eschvoca@gmail.com> writes:
>
> > Yes, ... is what I want (how do I do this with pure git?).
>
> How do you do *what* with pure git is something not clear to me,
> so let me try to rephrase you and see if I understood what you
> want correctly, in pure git terms:
>
>  0. Your last commit (.git/HEAD), your index file (.git/index)
>     and the files in your working tree are in sync to begin
>     with.
>
>  1. Then you do random changes in the working tree (add, modify,
>     remove) and do git-update-index on them without making a
>     commit.  If your index file is fully in sync with your
>     working tree, git-diff-files would say nothing after this.
>     If you did git-update-index on some but not all, then
>     git-diff-files would report unrecorded changes.
>
>  2. But you want to revert these changes to the index file.  By
>     "clearing the directory cache", you mean you want the index
>     file to have what it had in step 0, but you want to keep
>     what is on the filesystem intact.
>
> If that is what you want, then:
>
>         $ git-read-tree HEAD
>         $ git-update-index --refresh >/dev/null
Yes, this does exaclty what I want.  Thankyou.
Show 18 quoted lines
> would reset the index to the tree recorded in your last commit.
> You can see that
>
>         $ git diff --name-status --cached HEAD
>
> does not report any difference between HEAD and your index, while
>
>         $ git diff --name-status
>
> shows the differences between your index and your working tree.
>
> HOWEVER, the index file does not record "intent to add", so you
> would not see files you added in step 1. mentioned in the output
> of the last command.
>
>
>
>
Previous: Junio C HamanoNext: Linus Torvalds
Message 5 of 11 in “How do I clear the directory cache”
  1. eschvocaOct 17, 2005
  2. Petr BaudisOct 20, 2005
  3. eschvocaOct 21, 2005
  4. Junio C HamanoOct 21, 2005
  5. eschvocaOct 21, 2005
  6. Linus TorvaldsOct 21, 2005
  7. Petr BaudisOct 21, 2005
  8. eschvocaOct 21, 2005
  9. Petr BaudisOct 21, 2005
  10. eschvocaOct 22, 2005
  11. Petr BaudisOct 22, 2005

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.