Hi,
this question was originally posted on the Google Groups list, trying to
get help
(https://groups.google.com/d/topic/git-users/QAFKOQU4eUo/discussion).
Now that it's confirmed as a bug and I have a proposed solution, I'm
posting here.
Gitk "find commit" search function doesn't follow the "IgnCase" option
that is selectable with a combo selector on the right side of the
window; it should be searching in a case-insensitive way, but it doesn't.
Steps to reproduce:
1. Clone any repo. I'm right now using
https://github.com/Kurento/kms-core.git
<https://github.com/Kurento/kms-core.git>
2. cd into the repo and launch gitk
3. In the "Find commit" bar, select "changing lines matching"
4. In the right side of the same bar, select "IgnCase"
5. Search for a term that you know exists in uppercase, but write the
search in lowercase. In my example, I'm searching for "leaky_time".
6. No search results appear.
7. Change your search word to uppercase.
8. Some search results appear, thus proving that the search is being
done case-sensitive.
The command that gets called when searching is in lines 4804 & 4809
(https://github.com/git/git/blob/master/gitk-git/gitk#L4804
<https://github.com/git/git/blob/master/gitk-git/gitk#L4804>):
git diff-tree -r -s --stdin -G<SearchTerm>
Proposed solution is almost trivial: check if the "IgnCase" option is
enabled, and in that case add the flag "-i" to the git command. Now that
we are at it, it's probably correct to add that option to all search modes.
A diff is attached to this email, hoping that someone is able to apply
it (sorry I'm not familiarized with contributing with patch files, but
the diff is pretty small anyways).
Regards,
Juan
4809c4809,4815
< set cmd [concat | git diff-tree -r -s --stdin $gdtargs]
---
>
> set igncase_arg ""
> if {$findtype eq [mc "IgnCase"]} {
> set igncase_arg "-i"
> }
>
> set cmd [concat | git diff-tree $igncase_arg -r -s --stdin $gdtargs]