ls-remote: run setup_git_directory_gently() sooner
ls-remote already runs a repository search unconditionally to learn about remote nicknames and "[url] insteadof" shortcuts. Run that search a little sooner, and now one can try [pager] ls-remote to automatically paginate ls-remote output, or use repository-local [core] pager = whatever with "git --paginate ls-remote <url>". Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Aug 5, 2010 at 22:20 UTC
f0ef6a6eff15a3df8dc9ec61d93e3f7e540ed0ac
2 files changed
+2
-5
builtin/ls-remote.c
-3
@@ -32,7 +32,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
32
{
33
int i;
34
const char *dest = NULL;
35
- int nongit;
35
unsigned flags = 0;
36
int quiet = 0;
37
const char *uploadpack = NULL;
@@ -42,8 +41,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
41
struct transport *transport;
42
const struct ref *ref;
43
45
- setup_git_directory_gently(&nongit);
46
-
44
for (i = 1; i < argc; i++) {
45
const char *arg = argv[i];
46
git.c
+2
-2
@@ -345,7 +345,7 @@ static void handle_internal_command(int argc, const char **argv)
345
{ "log", cmd_log, RUN_SETUP | USE_PAGER },
346
{ "ls-files", cmd_ls_files, RUN_SETUP },
347
{ "ls-tree", cmd_ls_tree, RUN_SETUP },
348
- { "ls-remote", cmd_ls_remote },
348
+ { "ls-remote", cmd_ls_remote, RUN_SETUP_GENTLY },
349
{ "mailinfo", cmd_mailinfo },
350
{ "mailsplit", cmd_mailsplit },
351
{ "merge", cmd_merge, RUN_SETUP | NEED_WORK_TREE },
@@ -366,7 +366,7 @@ static void handle_internal_command(int argc, const char **argv)
366
{ "pack-objects", cmd_pack_objects, RUN_SETUP },
367
{ "pack-redundant", cmd_pack_redundant, RUN_SETUP },
368
{ "patch-id", cmd_patch_id },
369
- { "peek-remote", cmd_ls_remote },
369
+ { "peek-remote", cmd_ls_remote, RUN_SETUP_GENTLY },
370
{ "pickaxe", cmd_blame, RUN_SETUP },
371
{ "prune", cmd_prune, RUN_SETUP },
372
{ "prune-packed", cmd_prune_packed, RUN_SETUP },