read-tree -u one-way merge fix to check out locally modified paths.
[gitweb.git] / read-tree.c
index 26f4f7e32308d6e60d6a6e2c294bda322b34fc05..59b6a6bff9bc0b2dc7c922bf8e8b16cf36573fc7 100644 (file)
@@ -684,8 +684,11 @@ static int oneway_merge(struct cache_entry **src)
                             merge_size);
 
        if (!a)
-               return 0;
+               return deleted_entry(old, NULL);
        if (old && same(old, a)) {
+               struct stat st;
+               if (lstat(old->name, &st) || ce_match_stat(old, &st, 1))
+                       old->ce_flags |= htons(CE_UPDATE);
                return keep_entry(old);
        }
        return merged_entry(a, NULL);
@@ -794,8 +797,8 @@ int main(int argc, char **argv)
                if (1 < index_only + update)
                        usage(read_tree_usage);
 
-               if (get_sha1(arg, sha1) < 0)
-                       usage(read_tree_usage);
+               if (get_sha1(arg, sha1))
+                       die("Not a valid object name %s", arg);
                if (list_tree(sha1) < 0)
                        die("failed to unpack tree object %s", arg);
                stage++;