hex.c: reduce memory footprint of sha1_to_hex static buffers
[gitweb.git] / builtin-rev-parse.c
index 37d02335212dea9672e2472970f66dc4ac95dfd1..cbe5b428ad23708338dc7b11cb0105f53b045527 100644 (file)
@@ -581,6 +581,12 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                                for_each_remote_ref(show_reference, NULL);
                                continue;
                        }
+                       if (!strcmp(arg, "--show-toplevel")) {
+                               const char *work_tree = get_git_work_tree();
+                               if (work_tree)
+                                       puts(work_tree);
+                               continue;
+                       }
                        if (!strcmp(arg, "--show-prefix")) {
                                if (prefix)
                                        puts(prefix);