1526
*prune_data = prune;
1527
}
1528
1529
+static int handle_revision_pseudo_opt(const char *submodule,
1530
+ struct rev_info *revs,
1531
+ int argc, const char **argv, int *flags)
1532
+{
1533
+ const char *arg = argv[0];
1534
+ const char *optarg;
1535
+ int argcount;
1536
+
1537
+ if (!strcmp(arg, "--all")) {
1538
+ handle_refs(submodule, revs, *flags, for_each_ref_submodule);
1539
+ handle_refs(submodule, revs, *flags, head_ref_submodule);
1540
+ } else if (!strcmp(arg, "--branches")) {
1541
+ handle_refs(submodule, revs, *flags, for_each_branch_ref_submodule);
1542
+ } else if (!strcmp(arg, "--bisect")) {
1543
+ handle_refs(submodule, revs, *flags, for_each_bad_bisect_ref);
1544
+ handle_refs(submodule, revs, *flags ^ UNINTERESTING, for_each_good_bisect_ref);
1545
+ revs->bisect = 1;
1546
+ } else if (!strcmp(arg, "--tags")) {
1547
+ handle_refs(submodule, revs, *flags, for_each_tag_ref_submodule);
1548
+ } else if (!strcmp(arg, "--remotes")) {
1549
+ handle_refs(submodule, revs, *flags, for_each_remote_ref_submodule);
1550
+ } else if ((argcount = parse_long_opt("glob", argv, &optarg))) {
1551
+ struct all_refs_cb cb;
1552
+ init_all_refs_cb(&cb, revs, *flags);
1553
+ for_each_glob_ref(handle_one_ref, optarg, &cb);
1554
+ return argcount;
1555
+ } else if (!prefixcmp(arg, "--branches=")) {
1556
+ struct all_refs_cb cb;
1557
+ init_all_refs_cb(&cb, revs, *flags);
1558
+ for_each_glob_ref_in(handle_one_ref, arg + 11, "refs/heads/", &cb);
1559
+ } else if (!prefixcmp(arg, "--tags=")) {
1560
+ struct all_refs_cb cb;
1561
+ init_all_refs_cb(&cb, revs, *flags);
1562
+ for_each_glob_ref_in(handle_one_ref, arg + 7, "refs/tags/", &cb);
1563
+ } else if (!prefixcmp(arg, "--remotes=")) {
1564
+ struct all_refs_cb cb;
1565
+ init_all_refs_cb(&cb, revs, *flags);
1566
+ for_each_glob_ref_in(handle_one_ref, arg + 10, "refs/remotes/", &cb);
1567
+ } else if (!strcmp(arg, "--reflog")) {
1568
+ handle_reflog(revs, *flags);
1569
+ } else if (!strcmp(arg, "--not")) {
1570
+ *flags ^= UNINTERESTING;
1571
+ } else if (!strcmp(arg, "--no-walk")) {
1572
+ revs->no_walk = 1;
1573
+ } else if (!strcmp(arg, "--do-walk")) {
1574
+ revs->no_walk = 0;
1575
+ } else {
1576
+ return 0;
1577
+ }
1578
+
1579
+ return 1;
1580
+}
1581
+
1582
/*
1583
* Parse revision information, filling in the "rev_info" structure,
1584
* and removing the used arguments from the argument list.
1591
int i, flags, left, seen_dashdash, read_from_stdin, got_rev_arg = 0;
1592
const char **prune_data = NULL;
1593
const char *submodule = NULL;
1541
- const char *optarg;
1542
- int argcount;
1594
1595
if (opt)
1596
submodule = opt->submodule;
1617
if (*arg == '-') {
1618
int opts;
1619
1569
- if (!strcmp(arg, "--all")) {
1570
- handle_refs(submodule, revs, flags, for_each_ref_submodule);
1571
- handle_refs(submodule, revs, flags, head_ref_submodule);
1572
- continue;
1573
- }
1574
- if (!strcmp(arg, "--branches")) {
1575
- handle_refs(submodule, revs, flags, for_each_branch_ref_submodule);
1576
- continue;
1577
- }
1578
- if (!strcmp(arg, "--bisect")) {
1579
- handle_refs(submodule, revs, flags, for_each_bad_bisect_ref);
1580
- handle_refs(submodule, revs, flags ^ UNINTERESTING, for_each_good_bisect_ref);
1581
- revs->bisect = 1;
1582
- continue;
1583
- }
1584
- if (!strcmp(arg, "--tags")) {
1585
- handle_refs(submodule, revs, flags, for_each_tag_ref_submodule);
1586
- continue;
1587
- }
1588
- if (!strcmp(arg, "--remotes")) {
1589
- handle_refs(submodule, revs, flags, for_each_remote_ref_submodule);
1590
- continue;
1591
- }
1592
- if ((argcount = parse_long_opt("glob", argv + i, &optarg))) {
1593
- struct all_refs_cb cb;
1594
- i += argcount - 1;
1595
- init_all_refs_cb(&cb, revs, flags);
1596
- for_each_glob_ref(handle_one_ref, optarg, &cb);
1597
- continue;
1598
- }
1599
- if (!prefixcmp(arg, "--branches=")) {
1600
- struct all_refs_cb cb;
1601
- init_all_refs_cb(&cb, revs, flags);
1602
- for_each_glob_ref_in(handle_one_ref, arg + 11, "refs/heads/", &cb);
1603
- continue;
1604
- }
1605
- if (!prefixcmp(arg, "--tags=")) {
1606
- struct all_refs_cb cb;
1607
- init_all_refs_cb(&cb, revs, flags);
1608
- for_each_glob_ref_in(handle_one_ref, arg + 7, "refs/tags/", &cb);
1609
- continue;
1610
- }
1611
- if (!prefixcmp(arg, "--remotes=")) {
1612
- struct all_refs_cb cb;
1613
- init_all_refs_cb(&cb, revs, flags);
1614
- for_each_glob_ref_in(handle_one_ref, arg + 10, "refs/remotes/", &cb);
1615
- continue;
1616
- }
1617
- if (!strcmp(arg, "--reflog")) {
1618
- handle_reflog(revs, flags);
1619
- continue;
1620
- }
1621
- if (!strcmp(arg, "--not")) {
1622
- flags ^= UNINTERESTING;
1623
- continue;
1624
- }
1625
- if (!strcmp(arg, "--no-walk")) {
1626
- revs->no_walk = 1;
1627
- continue;
1628
- }
1629
- if (!strcmp(arg, "--do-walk")) {
1630
- revs->no_walk = 0;
1620
+ opts = handle_revision_pseudo_opt(submodule,
1621
+ revs, argc - i, argv + i,
1622
+ &flags);
1623
+ if (opts > 0) {
1624
+ i += opts - 1;
1625
continue;
1626
}
1627
+
1628
if (!strcmp(arg, "--stdin")) {
1629
if (revs->disable_stdin) {
1630
argv[left++] = arg;