git-rev-parse --parseopt
The "parseopt mode" of git-rev-parse does not need to be run inside a git repository, although the normal mode does. Most notabily, lack of this fix breaks git-clone script, as noticed by Nico. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Nov 6, 2007 at 12:23 UTC
5410a02ab9e6a1987147724f8ea65e6a077b3832
2 files changed
+3
-3
builtin-rev-parse.c
+2
-2
@@ -337,11 +337,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
337
int i, as_is = 0, verify = 0;
338
unsigned char sha1[20];
339
340
- git_config(git_default_config);
341
-
340
if (argc > 1 && !strcmp("--parseopt", argv[1]))
341
return cmd_parseopt(argc - 1, argv + 1, prefix);
342
343
+ prefix = setup_git_directory();
344
+ git_config(git_default_config);
345
for (i = 1; i < argc; i++) {
346
const char *arg = argv[i];
347
git.c
+1
-1
@@ -343,7 +343,7 @@ static void handle_internal_command(int argc, const char **argv)
343
{ "rerere", cmd_rerere, RUN_SETUP },
344
{ "reset", cmd_reset, RUN_SETUP },
345
{ "rev-list", cmd_rev_list, RUN_SETUP },
346
- { "rev-parse", cmd_rev_parse, RUN_SETUP },
346
+ { "rev-parse", cmd_rev_parse },
347
{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
348
{ "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
349
{ "runstatus", cmd_runstatus, RUN_SETUP | NEED_WORK_TREE },