Merge branch 'ce/https-public-key-pinning'
[gitweb.git] / builtin / rev-parse.c
index 9985949ccc1d64a6ee0284487ccf4e1776cb4647..cf8487b3b95fcca9a8a96a1562646ee8ddd5b354 100644 (file)
@@ -282,7 +282,7 @@ static int try_difference(const char *arg)
                        exclude = get_merge_bases(a, b);
                        while (exclude) {
                                struct commit *commit = pop_commit(&exclude);
-                               show_rev(REVERSED, get_object_hash(commit->object), NULL);
+                               show_rev(REVERSED, commit->object.oid.hash, NULL);
                        }
                }
                *dotdot = '.';
@@ -319,7 +319,7 @@ static int try_parent_shorthands(const char *arg)
        commit = lookup_commit_reference(sha1);
        for (parents = commit->parents; parents; parents = parents->next)
                show_rev(parents_only ? NORMAL : REVERSED,
-                               get_object_hash(parents->item->object), arg);
+                               parents->item->object.oid.hash, arg);
 
        *dotdot = '^';
        return 1;
@@ -383,7 +383,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
 
        /* get the usage up to the first line with a -- on it */
        for (;;) {
-               if (strbuf_getline(&sb, stdin, '\n') == EOF)
+               if (strbuf_getline(&sb, stdin) == EOF)
                        die("premature end of input");
                ALLOC_GROW(usage, unb + 1, usz);
                if (!strcmp("--", sb.buf)) {
@@ -396,7 +396,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
        }
 
        /* parse: (<short>|<short>,<long>|<long>)[*=?!]*<arghint>? SP+ <help> */
-       while (strbuf_getline(&sb, stdin, '\n') != EOF) {
+       while (strbuf_getline(&sb, stdin) != EOF) {
                const char *s;
                const char *help;
                struct option *o;
@@ -763,7 +763,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                                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")) {