Merge branch 'maint'
[gitweb.git] / builtin / rev-parse.c
index adb1cae4f27ad3993aa2418f7b0fd355d19cdab9..733f626f6c3e4ef54d54df923230f7ae4fbb2d7d 100644 (file)
@@ -44,6 +44,7 @@ static int is_rev_argument(const char *arg)
                "--branches=",
                "--branches",
                "--header",
+               "--ignore-missing",
                "--max-age=",
                "--max-count=",
                "--min-age=",
@@ -467,6 +468,14 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                return 0;
        }
 
+       if (argc > 2 && !strcmp(argv[1], "--resolve-git-dir")) {
+               const char *gitdir = resolve_gitdir(argv[2]);
+               if (!gitdir)
+                       die("not a gitdir '%s'", argv[2]);
+               puts(gitdir);
+               return 0;
+       }
+
        if (argc > 1 && !strcmp("-h", argv[1]))
                usage(builtin_rev_parse_usage);
 
@@ -625,6 +634,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                        if (!strcmp(arg, "--show-prefix")) {
                                if (prefix)
                                        puts(prefix);
+                               else
+                                       putchar('\n');
                                continue;
                        }
                        if (!strcmp(arg, "--show-cdup")) {