Merge branch 'rs/strbuf-getcwd'
[gitweb.git] / builtin / rev-parse.c
index a88123ad3e347f443425007dc5a02b7d6a33de79..c911b456dedd648e36a876c6175c23e1ef028a43 100644 (file)
@@ -11,6 +11,7 @@
 #include "parse-options.h"
 #include "diff.h"
 #include "revision.h"
+#include "split-index.h"
 
 #define DO_REVS                1
 #define DO_NOREV       2
@@ -150,6 +151,7 @@ static void show_rev(int type, const unsigned char *sha1, const char *name)
                                error("refname '%s' is ambiguous", name);
                                break;
                        }
+                       free(full);
                } else {
                        show_with_type(type, name);
                }
@@ -775,6 +777,15 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                                                : "false");
                                continue;
                        }
+                       if (!strcmp(arg, "--shared-index-path")) {
+                               if (read_cache() < 0)
+                                       die(_("Could not read the index"));
+                               if (the_index.split_index) {
+                                       const unsigned char *sha1 = the_index.split_index->base_sha1;
+                                       puts(git_path("sharedindex.%s", sha1_to_hex(sha1)));
+                               }
+                               continue;
+                       }
                        if (starts_with(arg, "--since=")) {
                                show_datestring("--max-age=", arg+8);
                                continue;