Skip to content

Commit 5adba90

Browse files
moygitster
authored andcommitted
log: parse separate option for --glob
Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7d7b86f commit 5adba90

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

revision.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
14841484
{
14851485
int i, flags, left, seen_dashdash, read_from_stdin, got_rev_arg = 0;
14861486
const char **prune_data = NULL;
1487+
const char *optarg;
1488+
int argcount;
14871489

14881490
/* First, search for "--" */
14891491
seen_dashdash = 0;
@@ -1530,10 +1532,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
15301532
handle_refs(revs, flags, for_each_remote_ref);
15311533
continue;
15321534
}
1533-
if (!prefixcmp(arg, "--glob=")) {
1535+
if ((argcount = parse_long_opt("glob", argv + i, &optarg))) {
15341536
struct all_refs_cb cb;
1537+
i += argcount - 1;
15351538
init_all_refs_cb(&cb, revs, flags);
1536-
for_each_glob_ref(handle_one_ref, arg + 7, &cb);
1539+
for_each_glob_ref(handle_one_ref, optarg, &cb);
15371540
continue;
15381541
}
15391542
if (!prefixcmp(arg, "--branches=")) {

t/t6018-rev-list-glob.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ test_expect_success 'rev-list --glob=refs/heads/subspace/*' '
123123
124124
'
125125

126+
test_expect_success 'rev-list --glob refs/heads/subspace/*' '
127+
128+
compare rev-list "subspace/one subspace/two" "--glob refs/heads/subspace/*"
129+
130+
'
131+
126132
test_expect_success 'rev-list --glob=heads/subspace/*' '
127133
128134
compare rev-list "subspace/one subspace/two" "--glob=heads/subspace/*"

0 commit comments

Comments
 (0)