]> asedeno.scripts.mit.edu Git - git.git/blobdiff - diff-lib.c
Git.pm: Don't require a repository instance for config
[git.git] / diff-lib.c
index 9520773f3b94a6bc4dadb3e9c92d9add0ada75b3..52dbac34a40b2ca7bcbb7c2343a0487e5cb90ccf 100644 (file)
@@ -641,6 +641,21 @@ static void do_oneway_diff(struct unpack_trees_options *o,
        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