Merge branch 'jk/rev-parse-local-env-vars'
authorJunio C Hamano <gitster@pobox.com>
Sun, 3 Apr 2016 17:29:26 +0000 (10:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 3 Apr 2016 17:29:27 +0000 (10:29 -0700)
The "--local-env-vars" and "--resolve-git-dir" options of "git
rev-parse" failed to work outside a repository when the command's
option parsing was rewritten in 1.8.5 era.

* jk/rev-parse-local-env-vars:
rev-parse: let some options run outside repository
t1515: add tests for rev-parse out-of-repo helpers

1  2 
builtin/rev-parse.c
index cf8487b3b95fcca9a8a96a1562646ee8ddd5b354,3116d29d83564f899e2d75e710c76eefa1b5ab91..c961b74c5aaae41153b89f4e877437ba7f0d70c7
@@@ -763,20 -787,9 +787,10 @@@ int cmd_rev_parse(int argc, const char 
                                continue;
                        }
                        if (!strcmp(arg, "--git-common-dir")) {
 -                              puts(get_git_common_dir());
 +                              const char *pfx = prefix ? prefix : "";
 +                              puts(prefix_filename(pfx, strlen(pfx), get_git_common_dir()));
                                continue;
                        }
-                       if (!strcmp(arg, "--resolve-git-dir")) {
-                               const char *gitdir = argv[++i];
-                               if (!gitdir)
-                                       die("--resolve-git-dir requires an argument");
-                               gitdir = resolve_gitdir(gitdir);
-                               if (!gitdir)
-                                       die("not a gitdir '%s'", argv[i]);
-                               puts(gitdir);
-                               continue;
-                       }
                        if (!strcmp(arg, "--is-inside-git-dir")) {
                                printf("%s\n", is_inside_git_dir() ? "true"
                                                : "false");