Re: git-prompt.sh incompatible with non-basic global grep.patternType

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> On Mon, Jul 18, 2016 at 03:56:09PM -0700, Richard Soderberg wrote:
>
>> ps. git log --basic-regexp does not fix the issue, as for unknown
>> reasons (I'll start another thread) the command-line option doesn't
>> override grep.patternType.
>
> Dscho gave a fix for your immediate issue, but this "ps" definitely
> seems like a bug to me. Command-line options should always take
> precedence over config.

This may fix it.  I think the root cause is that logic to smear
"pattern type" into various broken-down fields in grep_opt for the
short-hands like --basic-regexp option needs to leave "I am setting
this short-hand" mark to allow the grep_commit_pattern_type() that
is done as the final step of the set-up sequence before we call
compile_grep_patterns() can take notice.  The calls currently made
to grep_set_pattern_type_option() when we parse "--basic-regexp" and
friends forgets to override the "source of truth" field and only
updates the broken-down fields.

An alternative may be to update places that parse "--basic-regexp"
and friends to just write to .pattern_type_option without calling
grep_set_pattern_type_option(); that might be a cleaner, but I am
not feeling well today so I won't be able to do a deeper analysis
right now.

 grep.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/grep.c b/grep.c
index 394c856..908ed3d 100644
--- a/grep.c
+++ b/grep.c
@@ -203,6 +203,7 @@ void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, struct gr
 		opt->regflags &= ~REG_EXTENDED;
 		break;
 	}
+	opt->pattern_type_option = pattern_type;
 }
 
 static struct grep_pat *create_grep_pat(const char *pat, size_t patlen,

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]