git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'
[gitweb.git] / unpack-trees.c
index 0cdf19817d65ef8b054b8399981be164c8ee7542..be89d52e8c55d71fe7dff2e7e2f6d6d5f8a7ca16 100644 (file)
@@ -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);
 }
@@ -144,8 +143,7 @@ int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conf
                        sha1 = names[i].sha1;
                fill_tree_descriptor(t+i, sha1);
        }
-       traverse_trees(n, t, &newinfo);
-       return 0;
+       return traverse_trees(n, t, &newinfo);
 }
 
 /*
@@ -287,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;
                        }
@@ -306,7 +303,9 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
                        if (src[0])
                                conflicts |= 1;
                }
-               traverse_trees_recursive(n, dirmask, conflicts, names, info);
+               if (traverse_trees_recursive(n, dirmask, conflicts,
+                                            names, info) < 0)
+                       return -1;
                return mask;
        }
 
@@ -315,6 +314,7 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
 
 static int unpack_failed(struct unpack_trees_options *o, const char *message)
 {
+       discard_index(&o->result);
        if (!o->gently) {
                if (message)
                        return error(message);