All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: iwamoto@valinux.co.jp, "Junio C Hamano" <gitster@pobox.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 3/3] diff: turn off skip_stat_unmatch on "diff --cached"
Date: Sat, 25 Jan 2014 13:46:51 +0700	[thread overview]
Message-ID: <1390632411-3596-3-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1390632411-3596-1-git-send-email-pclouds@gmail.com>

skip_stat_unmatch flag is added in fb13227 (git-diff: squelch "empty"
diffs - 2007-08-03) to ignore empty diffs caused by stat-only
dirtiness. In "diff --cached" case, stat is not invovled at all. While
the code is written in a way that no expensive I/O is done, we still
need to move all file pairs from the old queue to the new queue in
diffcore_skip_stat_unmatch(). Avoid it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/diff.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/builtin/diff.c b/builtin/diff.c
index 0f247d2..85f97d7 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -150,9 +150,10 @@ static int builtin_diff_index(struct rev_info *revs,
 			perror("read_cache_preload");
 			return -1;
 		}
-	} else if (read_cache() < 0) {
-		perror("read_cache");
-		return -1;
+	} else {
+		if (read_cache() < 0)
+			return error("read_cache: %s", strerror(errno));
+		revs->diffopt.skip_stat_unmatch = 0;
 	}
 	return run_diff_index(revs, cached);
 }
-- 
1.8.5.2.240.g8478abd

  parent reply	other threads:[~2014-01-25  6:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23  2:45 bug with git-diff --quiet IWAMOTO Toshihiro
2014-01-25  4:03 ` Duy Nguyen
2014-01-25  6:46 ` [PATCH 1/3] Move diffcore_skip_stat_unmatch core logic out for reuse later Nguyễn Thái Ngọc Duy
2014-01-25  6:46   ` [PATCH 2/3] diff: do not quit early on stat-dirty files Nguyễn Thái Ngọc Duy
2014-01-25  6:46   ` Nguyễn Thái Ngọc Duy [this message]
2014-01-27 22:59     ` [PATCH v2 3/3] diff: turn skip_stat_unmatch on selectively Nguyễn Thái Ngọc Duy
2014-01-27 23:45       ` Junio C Hamano
2014-01-28 22:51         ` Junio C Hamano
2014-01-28 23:52           ` Duy Nguyen
2014-01-29 19:25             ` Junio C Hamano
2014-01-30  5:36               ` Duy Nguyen
2014-01-31 16:17                 ` Junio C Hamano

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=1390632411-3596-3-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=iwamoto@valinux.co.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.