Merge master into aw/mirror-push
[gitweb.git] / git.c
diff --git a/git.c b/git.c
index 4e10581101c26444da5c7c44a80219b11607705b..6c5f9af13af5a59606008efe29291d53b3c0cdc0 100644 (file)
--- a/git.c
+++ b/git.c
@@ -249,14 +249,9 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)
                prefix = setup_git_directory();
        if (p->option & USE_PAGER)
                setup_pager();
-       if (p->option & NEED_WORK_TREE) {
-               const char *work_tree = get_git_work_tree();
-               const char *git_dir = get_git_dir();
-               if (!is_absolute_path(git_dir))
-                       set_git_dir(make_absolute_path(git_dir));
-               if (!work_tree || chdir(work_tree))
-                       die("%s must be run in a work tree", p->cmd);
-       }
+       if (p->option & NEED_WORK_TREE)
+               setup_work_tree();
+
        trace_argv_printf(argv, argc, "trace: built-in: git");
 
        status = p->fn(argc, argv, prefix);
@@ -326,6 +321,7 @@ static void handle_internal_command(int argc, const char **argv)
                { "log", cmd_log, RUN_SETUP | USE_PAGER },
                { "ls-files", cmd_ls_files, RUN_SETUP },
                { "ls-tree", cmd_ls_tree, RUN_SETUP },
+               { "ls-remote", cmd_ls_remote },
                { "mailinfo", cmd_mailinfo },
                { "mailsplit", cmd_mailsplit },
                { "merge-base", cmd_merge_base, RUN_SETUP },
@@ -333,6 +329,7 @@ static void handle_internal_command(int argc, const char **argv)
                { "mv", cmd_mv, RUN_SETUP | NEED_WORK_TREE },
                { "name-rev", cmd_name_rev, RUN_SETUP },
                { "pack-objects", cmd_pack_objects, RUN_SETUP },
+               { "peek-remote", cmd_ls_remote },
                { "pickaxe", cmd_blame, RUN_SETUP },
                { "prune", cmd_prune, RUN_SETUP },
                { "prune-packed", cmd_prune_packed, RUN_SETUP },
@@ -345,8 +342,9 @@ static void handle_internal_command(int argc, const char **argv)
                { "rev-list", cmd_rev_list, RUN_SETUP },
                { "rev-parse", cmd_rev_parse, RUN_SETUP },
                { "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
-               { "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
+               { "rm", cmd_rm, RUN_SETUP },
                { "runstatus", cmd_runstatus, RUN_SETUP | NEED_WORK_TREE },
+               { "send-pack", cmd_send_pack, RUN_SETUP },
                { "shortlog", cmd_shortlog, RUN_SETUP | USE_PAGER },
                { "show-branch", cmd_show_branch, RUN_SETUP },
                { "show", cmd_show, RUN_SETUP | USE_PAGER },