git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'
[gitweb.git] / builtin-rm.c
index bca2bd97036fdaf2e2bf99e308ba62e1acf4d9e8..c0a8bb6cf5675d671a2cca50bf72d5c60f155313 100644 (file)
@@ -155,6 +155,9 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
        if (!argc)
                usage_with_options(builtin_rm_usage, builtin_rm_options);
 
+       if (!index_only)
+               setup_work_tree();
+
        pathspec = get_pathspec(prefix, argv);
        seen = NULL;
        for (i = 0; pathspec[i] ; i++)
@@ -247,7 +250,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 
        if (active_cache_changed) {
                if (write_cache(newfd, active_cache, active_nr) ||
-                   close(newfd) || commit_locked_index(&lock_file))
+                   commit_locked_index(&lock_file))
                        die("Unable to write new index file");
        }