branch -d: refuse deleting a branch which is currently checked out
[gitweb.git] / builtin / rev-parse.c
index e92a782f7729f0e5522969238920be2b7e607366..7a4f2c0b0ccedf958b78b2bdda217bfb269c6b23 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, commit->object.sha1, 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,
-                               parents->item->object.sha1, arg);
+                               parents->item->object.oid.hash, arg);
 
        *dotdot = '^';
        return 1;
@@ -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")) {