git/list[1] front-page[2] threads[3] people[4] search[5] about
 

(Bug report + fix) gitk "IgnCase" search doesn't ignore case

From
JNJuan Navarro <juan.navarro@gmx.es>
Date
Jun 14, 2018, 12:53 UTC
Message-ID
<fc6b89c5-f0be-97c8-b0e1-247d9dd3e1f0@gmx.es>
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] ---

Show 7 quoted lines
> 
>     set igncase_arg ""
>     if {$findtype eq [mc "IgnCase"]} {
>         set igncase_arg "-i"
>     }
> 
>     set cmd [concat | git diff-tree $igncase_arg -r -s --stdin $gdtargs]
Next: Eric Sunshine
Message 1 of 2 in “(Bug report + fix) gitk "IgnCase" search doesn't ignore case”
  1. Juan NavarroJun 14, 2018
  2. Eric SunshineJun 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.