Merge git://github.com/git-l10n/git-po
[gitweb.git] / builtin / rev-parse.c
index 4c19f844a977b6413afcd5df6b4f8bc0875775a8..13495b88f5da1efc2094c0e69abfe93605ee8c03 100644 (file)
@@ -468,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);
 
@@ -478,7 +486,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
 
                if (as_is) {
                        if (show_file(arg) && as_is < 2)
-                               verify_filename(prefix, arg);
+                               verify_filename(prefix, arg, 0);
                        continue;
                }
                if (!strcmp(arg,"-n")) {
@@ -626,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")) {
@@ -724,7 +734,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                as_is = 1;
                if (!show_file(arg))
                        continue;
-               verify_filename(prefix, arg);
+               verify_filename(prefix, arg, 1);
        }
        if (verify) {
                if (revs_count == 1) {