Web lists-archives.com

[PATCH 18/19] rev-parseopt: convert --skip




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

diff --git a/revision.c b/revision.c
index c53347d362..42d466cd08 100644
--- a/revision.c
+++ b/revision.c
@@ -1996,6 +1996,9 @@ static void make_rev_options(struct rev_info *revs)
 		OPT_REV('n', "max-count", N_("<n>"),
 			N_("limit the number of commis to stdout"),
 			rev_opt_max_count),
+		OPT_INTEGER_F(0, "skip", &revs->skip_count,
+			      N_("skip a number of commits before starting to show"),
+			      PARSE_OPT_NONEG),
 		OPT_END(),
 	};
 	revs->options = parse_options_concat(options, revs->diffopt.parseopts);
@@ -2036,10 +2039,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 	if (argc)
 		return argc;
 
-	if ((argcount = parse_long_opt("skip", argv, &optarg))) {
-		revs->skip_count = atoi(optarg);
-		return argcount;
-	} else if ((*arg == '-') && isdigit(arg[1])) {
+	if ((*arg == '-') && isdigit(arg[1])) {
 		/* accept -<digit>, like traditional "head" */
 		if (strtol_i(arg + 1, 10, &revs->max_count) < 0 ||
 		    revs->max_count < 0)
-- 
2.21.0.1141.gd54ac2cb17