Re: [RFC PATCH 1/2] Allow "git log --grep foo" as synonym for "git log --grep=foo".
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 27, 2010, 10:18 UTC
- Message-ID
- <AANLkTim1S_IYbPArQqX91OOPtoh2-rIWmTRon50_j2p3@mail.gmail.com>
- In-Reply-To
- <1280168078-31147-2-git-send-email-Matthieu.Moy@imag.fr>
On Mon, Jul 26, 2010 at 18:14, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
> + } else if (!strcmp(arg, "--grep")) {
> + add_message_grep(revs, optarg);
> + return 2;This looks good. I've been bitten by git-log's non-standard option parsing. But there's still a lot of options that need the =, no?:
21 matches for "="" in buffer: revision.c
1163: if (!prefixcmp(arg, "--max-count=")) {
1166: } else if (!prefixcmp(arg, "--skip=")) {
1181: } else if (!prefixcmp(arg, "--max-age=")) {
1183: } else if (!prefixcmp(arg, "--since=")) {
1185: } else if (!prefixcmp(arg, "--after=")) {
1187: } else if (!prefixcmp(arg, "--min-age=")) {
1189: } else if (!prefixcmp(arg, "--before=")) {
1191: } else if (!prefixcmp(arg, "--until=")) {
1272: } else if (!prefixcmp(arg, "--unpacked=")) {
1297: } else if (!prefixcmp(arg, "--pretty=") ||
!prefixcmp(arg, "--format=")) {
1304: } else if (!prefixcmp(arg, "--show-notes=")) {
1346: } else if (!prefixcmp(arg, "--abbrev=")) {
1362: } else if (!strncmp(arg, "--date=", 7)) {
1371: else if (!prefixcmp(arg, "--author=")) {
1373: } else if (!prefixcmp(arg, "--committer=")) {
1375: } else if (!prefixcmp(arg, "--grep=")) {
1385: } else if (!prefixcmp(arg, "--encoding=")) {
1515: if (!prefixcmp(arg, "--glob=")) {
1521: if (!prefixcmp(arg, "--branches=")) {
1527: if (!prefixcmp(arg, "--tags=")) {
1533: if (!prefixcmp(arg, "--remotes=")) {I think changing the option parsing so that it handles all the long options consistently would be very nice (along with some tests). But just making --grep a special case is more confusing than requiring = everywhere.