Git 2.23
[gitweb.git] / builtin / show-branch.c
index 65f4a4c83c42ec33d5ffe3f1d83d7b5465c0796d..35d7f51c236dc0b9a734809a1cee9b04a5f12397 100644 (file)
@@ -514,7 +514,6 @@ static int show_merge_base(struct commit_list *seen, int num_rev)
 
 static int show_independent(struct commit **rev,
                            int num_rev,
-                           char **ref_name,
                            unsigned int *rev_mask)
 {
        int i;
@@ -604,6 +603,7 @@ static int parse_reflog_param(const struct option *opt, const char *arg,
 {
        char *ep;
        const char **base = (const char **)opt->value;
+       BUG_ON_OPT_NEG(unset);
        if (!arg)
                arg = "";
        reflog = strtoul(arg, &ep, 10);
@@ -674,7 +674,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
                { OPTION_CALLBACK, 'g', "reflog", &reflog_base, N_("<n>[,<base>]"),
                            N_("show <n> most recent ref-log entries starting at "
                               "base"),
-                           PARSE_OPT_OPTARG,
+                           PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
                            parse_reflog_param },
                OPT_END()
        };
@@ -752,7 +752,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
                                /* Ah, that is a date spec... */
                                timestamp_t at;
                                at = approxidate(reflog_base);
-                               read_ref_at(ref, flags, at, -1, &oid, NULL,
+                               read_ref_at(get_main_ref_store(the_repository),
+                                           ref, flags, at, -1, &oid, NULL,
                                            NULL, NULL, &base);
                        }
                }
@@ -764,7 +765,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
                        timestamp_t timestamp;
                        int tz;
 
-                       if (read_ref_at(ref, flags, 0, base + i, &oid, &logmsg,
+                       if (read_ref_at(get_main_ref_store(the_repository),
+                                       ref, flags, 0, base + i, &oid, &logmsg,
                                        &timestamp, &tz, NULL)) {
                                reflog = i;
                                break;
@@ -859,7 +861,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
                return show_merge_base(seen, num_rev);
 
        if (independent)
-               return show_independent(rev, num_rev, ref_name, rev_mask);
+               return show_independent(rev, num_rev, rev_mask);
 
        /* Show list; --more=-1 means list-only */
        if (1 < num_rev || extra < 0) {