Re: [RFC PATCH 1/2] Allow "git log --grep foo" as synonym for "git log --grep=foo".
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:49:11
On Mon, Jul 26, 2010 at 18:14, Matthieu Moy [off-list ref] 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.