@@ -2452,6 +2452,18 @@ static int rev_opt_glob(const struct option *opt,
return 0;
}
+static int rev_opt_reflog(const struct option *opt,
+ const char *arg, int unset)
+{
+ struct rev_info *revs = opt->value;
+ int flags = *revs->pseudo_flags;
+
+ BUG_ON_OPT_NEG(unset);
+ BUG_ON_OPT_ARG(arg);
+ add_reflogs_to_pending(revs, flags);
+ return 0;
+}
+
static int rev_opt_remotes(const struct option *opt,
const char *arg, int unset)
{
@@ -2528,6 +2540,9 @@ static void make_pseudo_options(struct rev_info *revs)
OPT_REV(0, "exclude", N_("<pattern>"),
N_("exclude refs matching glob pattern"),
rev_opt_exclude),
+ OPT_REV_NOARG(0, "reflog",
+ N_("include all refs from reflog"),
+ rev_opt_reflog),
OPT_END()
};
ALLOC_ARRAY(revs->pseudo_options, ARRAY_SIZE(options));
@@ -2567,9 +2582,7 @@ static int handle_revision_pseudo_opt(const char *submodule,
if (argc)
return argc;
- if (!strcmp(arg, "--reflog")) {
- add_reflogs_to_pending(revs, *flags);
- } else if (!strcmp(arg, "--indexed-objects")) {
+ if (!strcmp(arg, "--indexed-objects")) {
add_index_objects_to_pending(revs, *flags);
} else if (!strcmp(arg, "--not")) {
*flags ^= UNINTERESTING | BOTTOM;
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> --- revision.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)