Re: [PATCH] fix "git log -i --grep"
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:13
Jeff King [off-list ref] writes:
I worked up this patch, and it is below. However, I think it may not be a good idea, because...quoted
The only issue I still have, which I suspect your fix has made it easier to address, is to complain if sub-options to grep like -i and -E are given without --grep. That's not something v1.5.6 series did, though.This is trivial with my first patch, but not with the second. With grep_filter kept as a pointer, we know that if the pointer is non-NULL but there are no patterns, then the user asked for grep options but never --grep.
Hmm, that's true --- instead you would need to introduce a new flag in rev_info that records if you saw any grep sub-options, if we want to check this condition.
I guess this might be a helpful thing for some users, but I wonder if it is being too unpredictable for script usage. I.e., a script like: git log -E `for i in "$@"; do echo --author=$i`
Ok, that's true, so let's not worry about making "log -i without --grep" an error.
Anyway, the non-allocating patch is below. Aside from the test case, it deletes more lines than it adds, which is always nice.
Yeah, thanks.