summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 542c264)
raw | patch | inline | side by side (parent: 542c264)
author | Linus Torvalds <torvalds@linux-foundation.org> | |
Tue, 11 Mar 2008 06:51:13 +0000 (23:51 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 11 Mar 2008 06:51:13 +0000 (23:51 -0700) |
When skip_unmerged option is not given, unpack_trees() should not just
skip unmerged cache entries but keep them in the result for the caller to
sort them out.
For callers other than diff-index, the incoming index should never be
unmerged, but diff-index is a special case caller.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
skip unmerged cache entries but keep them in the result for the caller to
sort them out.
For callers other than diff-index, the incoming index should never be
unmerged, but diff-index is a special case caller.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-lib.c | patch | blob | history | |
unpack-trees.c | patch | blob | history |
diff --git a/diff-lib.c b/diff-lib.c
index 9520773f3b94a6bc4dadb3e9c92d9add0ada75b3..52dbac34a40b2ca7bcbb7c2343a0487e5cb90ccf 100644 (file)
--- a/diff-lib.c
+++ b/diff-lib.c
show_modified(revs, tree, idx, 1, cached, match_missing);
}
+static inline void skip_same_name(struct cache_entry *ce, struct unpack_trees_options *o)
+{
+ int len = ce_namelen(ce);
+ const struct index_state *index = o->src_index;
+
+ while (o->pos < index->cache_nr) {
+ struct cache_entry *next = index->cache[o->pos];
+ if (len != ce_namelen(next))
+ break;
+ if (memcmp(ce->name, next->name, len))
+ break;
+ o->pos++;
+ }
+}
+
/*
* The unpack_trees() interface is designed for merging, so
* the different source entries are designed primarily for
@@ -662,6 +677,9 @@ static int oneway_diff(struct cache_entry **src, struct unpack_trees_options *o)
struct cache_entry *tree = src[1];
struct rev_info *revs = o->unpack_data;
+ if (idx && ce_stage(idx))
+ skip_same_name(idx, o);
+
/*
* Unpack-trees generates a DF/conflict entry if
* there was a directory in the index and a tree
diff --git a/unpack-trees.c b/unpack-trees.c
index 5a0f0382b8fac910f71eddfc77a42058c67da576..be89d52e8c55d71fe7dff2e7e2f6d6d5f8a7ca16 100644 (file)
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -116,7 +116,6 @@ static int unpack_index_entry(struct cache_entry *ce, struct unpack_trees_option
add_entry(o, ce, 0, 0);
return 0;
}
- return 0;
}
return call_unpack_fn(src, o);
}
@@ -286,7 +285,6 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
add_entry(o, ce, 0, 0);
return mask;
}
- continue;
}
src[0] = ce;
}