Git development
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: git@vger.kernel.org
Subject: RFA: untracked cache vs git reset --hard
Date: Wed, 3 May 2017 12:27:00 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1705031202470.3480@virtualbox> (raw)

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

             reply	other threads:[~2017-05-03 10:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-03 10:27 Johannes Schindelin [this message]
2017-05-03 10:54 ` RFA: untracked cache vs git reset --hard Duy Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1705031202470.3480@virtualbox \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox