Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-05-04 02:01:26 +0400
committerJunio C Hamano <gitster@pobox.com>2009-05-04 02:01:26 +0400
commit3f3e2c26fa0325f4df952363f8f5046ca8158bb3 (patch)
treec1fd36e7ba69f1b24f38a47d7cae407b26abd899 /diff.c
parent652f0c8f1df362755253fe9c5a975be7e5a5cbdc (diff)
parent150115aded2e1e0a83db7366f59e4b5bf1aa8135 (diff)
Merge branch 'jc/maint-1.6.0-diff-borrow-carefully' into maint-1.6.1
* jc/maint-1.6.0-diff-borrow-carefully: diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index 416c5aa722..635fbc9d98 100644
--- a/diff.c
+++ b/diff.c
@@ -1649,7 +1649,8 @@ static int reuse_worktree_file(const char *name, const unsigned char *sha1, int
struct stat st;
int pos, len;
- /* We do not read the cache ourselves here, because the
+ /*
+ * We do not read the cache ourselves here, because the
* benchmark with my previous version that always reads cache
* shows that it makes things worse for diff-tree comparing
* two linux-2.6 kernel trees in an already checked out work
@@ -1690,6 +1691,13 @@ static int reuse_worktree_file(const char *name, const unsigned char *sha1, int
return 0;
/*
+ * If ce is marked as "assume unchanged", there is no
+ * guarantee that work tree matches what we are looking for.
+ */
+ if (ce->ce_flags & CE_VALID)
+ return 0;
+
+ /*
* If ce matches the file in the work tree, we can reuse it.
*/
if (ce_uptodate(ce) ||