On Wed, Jan 9, 2013 at 9:01 AM, Jeff King <p...@peff.net> wrote: > On Wed, Jan 09, 2013 at 12:16:13AM -0800, Martin von Zweigbergk wrote: > >> "git reset [--mixed]" without --quiet refreshes the index in order to >> display the "Unstaged changes after reset". When --quiet is given, >> that output is suppressed, removing the need to refresh the index. >> Other porcelain commands that care about a refreshed index should >> already be refreshing it, so running e.g. "git reset -q && git diff" >> is still safe. > > Hmm. But "git reset -q && git diff-files" would not be?
Right. Actually, "git reset -q && git diff" was perhaps not a good example, because its analogous plumbing command would be "git reset -q && git diff-files -p", which is also safe. But, as you say, "git reset -q && git diff-files" (without -p) might list files for which only the stat information has changed. > We have never been very clear about which commands refresh the index. Yes, git-reset's documentation doesn't mention it. > Since "reset" is about manipulating the index, I'd expect it to be > refreshed afterwards. On the other hand, since we have never guaranteed > anything, perhaps a careful script should always use "git update-index > --refresh". Since "git diff-files" is a plumbing command, users of it to a hopefully a bit more careful than regular users, but you never know. > I would not be too surprised if some of our own scripts are > not that careful, though. I didn't find any, but I might have missed something. Regardless, this patch was tangential. The goal of this series can be achieved independently of this patch, so if it's too risky, we can drop easily drop it. Also, even though it does make "git reset -q" faster, I'm not sure how important that is in practice. Most use cases would probably refresh the index afterwards anyway. In such cases, the improvement on warm cache would still be there, but the relative improvement in the cold cache case would be pretty much gone (since the entire tree would be stat'ed by the following refresh anyway). Martin -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html