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>
This commit is contained in:
parent
8f321a3925
commit
5410a02ab9
@ -337,11 +337,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
|
|||||||
int i, as_is = 0, verify = 0;
|
int i, as_is = 0, verify = 0;
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
|
|
||||||
git_config(git_default_config);
|
|
||||||
|
|
||||||
if (argc > 1 && !strcmp("--parseopt", argv[1]))
|
if (argc > 1 && !strcmp("--parseopt", argv[1]))
|
||||||
return cmd_parseopt(argc - 1, argv + 1, prefix);
|
return cmd_parseopt(argc - 1, argv + 1, prefix);
|
||||||
|
|
||||||
|
prefix = setup_git_directory();
|
||||||
|
git_config(git_default_config);
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
const char *arg = argv[i];
|
const char *arg = argv[i];
|
||||||
|
|
||||||
|
2
git.c
2
git.c
@ -343,7 +343,7 @@ static void handle_internal_command(int argc, const char **argv)
|
|||||||
{ "rerere", cmd_rerere, RUN_SETUP },
|
{ "rerere", cmd_rerere, RUN_SETUP },
|
||||||
{ "reset", cmd_reset, RUN_SETUP },
|
{ "reset", cmd_reset, RUN_SETUP },
|
||||||
{ "rev-list", cmd_rev_list, RUN_SETUP },
|
{ "rev-list", cmd_rev_list, RUN_SETUP },
|
||||||
{ "rev-parse", cmd_rev_parse, RUN_SETUP },
|
{ "rev-parse", cmd_rev_parse },
|
||||||
{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
|
{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
|
||||||
{ "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
|
{ "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
|
||||||
{ "runstatus", cmd_runstatus, RUN_SETUP | NEED_WORK_TREE },
|
{ "runstatus", cmd_runstatus, RUN_SETUP | NEED_WORK_TREE },
|
||||||
|
Loading…
Reference in New Issue
Block a user