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

RFA: untracked cache vs git reset --hard

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 3, 2017, 10:27 UTC
Message-ID
<alpine.DEB.2.20.1705031202470.3480@virtualbox>
Hi all,
I have a problem and would like to solicit advice how to fix it.

The untracked cache has made a real difference on rather large repositories with tons of directories, and it is really, really useful.

But. One innocuous `git reset --hard` will just blow it away.

How? reset_index() calls unpack_trees() which in turn tries to populate a new index and then discards the old one:

	https://github.com/git/git/blob/v2.12.2/unpack-trees.c#L1293

That discard_index() unfortunately also blows away each and every index extension that had been read carefully before.

All users of `git reset --hard` (including `git stash`) suffer this.

In fact, it looks as if *any* caller of unpack_trees() would suffer the same problem: git-am, git-checkout, git-commit, git-merge, etc

Now, I could imagine that maybe we could just "move" o->dst_index.untracked to o->result.untracked, and that the machinery then would do the right thing.

However, I am far from an expert in this area, so I would appreciate all the helpful advice I could get.

Thoughts?

Thanks, Johannes

Next: Duy Nguyen
Message 1 of 2 in “RFA: untracked cache vs git reset --hard”
  1. Johannes SchindelinMay 3, 2017
  2. Duy NguyenMay 3, 2017

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.