[PATCH 12/19] rev-parseopt: convert --indexed-objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 revision.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/revision.c b/revision.c
index 6efa9bee1e..9cfa4dc151 100644
--- a/revision.c
+++ b/revision.c
@@ -2438,6 +2438,18 @@ static int rev_opt_exclude(const struct option *opt,
 	return 0;
 }
 
+static int rev_opt_indexed_objects(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_index_objects_to_pending(revs, flags);
+	return 0;
+}
+
 static int rev_opt_glob(const struct option *opt,
 			const char *arg, int unset)
 {
@@ -2543,6 +2555,9 @@ static void make_pseudo_options(struct rev_info *revs)
 		OPT_REV_NOARG(0, "reflog",
 			      N_("include all refs from reflog"),
 			      rev_opt_reflog),
+		OPT_REV_NOARG(0, "indexed-objects",
+			      N_("include all trees and blobs used by the index"),
+			      rev_opt_indexed_objects),
 		OPT_END()
 	};
 	ALLOC_ARRAY(revs->pseudo_options, ARRAY_SIZE(options));
@@ -2582,9 +2597,7 @@ static int handle_revision_pseudo_opt(const char *submodule,
 	if (argc)
 		return argc;
 
-	if (!strcmp(arg, "--indexed-objects")) {
-		add_index_objects_to_pending(revs, *flags);
-	} else if (!strcmp(arg, "--not")) {
+	if (!strcmp(arg, "--not")) {
 		*flags ^= UNINTERESTING | BOTTOM;
 	} else if (!strcmp(arg, "--no-walk")) {
 		revs->no_walk = REVISION_WALK_NO_WALK_SORTED;
-- 
2.21.0.1141.gd54ac2cb17




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux