log: parse separate option for --glob
authorMatthieu Moy <Matthieu.Moy@imag.fr>
Thu, 5 Aug 2010 08:22:56 +0000 (10:22 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Aug 2010 16:14:50 +0000 (09:14 -0700)
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c
t/t6018-rev-list-glob.sh

index 489a3c2022f8679e899dfa763aa4c178c89ec215..f241f341c77c63ca6342d31e56f432dac43fbb39 100644 (file)
@@ -1484,6 +1484,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
 {
        int i, flags, left, seen_dashdash, read_from_stdin, got_rev_arg = 0;
        const char **prune_data = NULL;
+       const char *optarg;
+       int argcount;
 
        /* First, search for "--" */
        seen_dashdash = 0;
@@ -1530,10 +1532,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
                                handle_refs(revs, flags, for_each_remote_ref);
                                continue;
                        }
-                       if (!prefixcmp(arg, "--glob=")) {
+                       if ((argcount = parse_long_opt("glob", argv + i, &optarg))) {
                                struct all_refs_cb cb;
+                               i += argcount - 1;
                                init_all_refs_cb(&cb, revs, flags);
-                               for_each_glob_ref(handle_one_ref, arg + 7, &cb);
+                               for_each_glob_ref(handle_one_ref, optarg, &cb);
                                continue;
                        }
                        if (!prefixcmp(arg, "--branches=")) {
index 58428d9f5c3d079b0e842b5851b100f9e895a239..fb8291c812854608777dd8d35edfcda78df5069a 100755 (executable)
@@ -123,6 +123,12 @@ test_expect_success 'rev-list --glob=refs/heads/subspace/*' '
 
 '
 
+test_expect_success 'rev-list --glob refs/heads/subspace/*' '
+
+       compare rev-list "subspace/one subspace/two" "--glob refs/heads/subspace/*"
+
+'
+
 test_expect_success 'rev-list --glob=heads/subspace/*' '
 
        compare rev-list "subspace/one subspace/two" "--glob=heads/subspace/*"