Code

checkout: do not lose staged removal
[git.git] / git.c
diff --git a/git.c b/git.c
index 1bfd271a711dc8b416fee8e4a8f0bfab3c52df3c..fdb0f71019a02e310e15734193c7556860956115 100644 (file)
--- a/git.c
+++ b/git.c
@@ -286,7 +286,7 @@ static void handle_internal_command(int argc, const char **argv)
                { "count-objects", cmd_count_objects, RUN_SETUP },
                { "describe", cmd_describe, RUN_SETUP },
                { "diff", cmd_diff },
-               { "diff-files", cmd_diff_files, RUN_SETUP },
+               { "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
                { "diff-index", cmd_diff_index, RUN_SETUP },
                { "diff-tree", cmd_diff_tree, RUN_SETUP },
                { "fast-export", cmd_fast_export, RUN_SETUP },
@@ -418,7 +418,6 @@ int main(int argc, const char **argv)
 {
        const char *cmd = argv[0] && *argv[0] ? argv[0] : "git-help";
        char *slash = (char *)cmd + strlen(cmd);
-       const char *cmd_path = NULL;
        int done_alias = 0;
 
        /*
@@ -431,7 +430,7 @@ int main(int argc, const char **argv)
        while (cmd <= slash && !is_dir_sep(*slash));
        if (cmd <= slash) {
                *slash++ = 0;
-               cmd_path = cmd;
+               git_set_argv0_path(cmd);
                cmd = slash;
        }
 
@@ -475,7 +474,7 @@ int main(int argc, const char **argv)
         * environment, and the $(gitexecdir) from the Makefile at build
         * time.
         */
-       setup_path(cmd_path);
+       setup_path();
 
        while (1) {
                /* See if it's an internal command */