Re: [git-users] (Bug report) gitk "IgnCase" search doesn't work

2018-06-14 Thread Juan Navarro
I've tested and it works fine if "-i" is added when IgnCase is the selected 
option. I will send a diff to the Mailing List!


On Thursday, June 14, 2018 at 2:29:52 PM UTC+2, Juan Navarro wrote:
>
> I'm a programmer myself, so it wasn't much of a hassle to dive into gitk's 
> source code.
>
> That said, it's been quite a time sink (which is why I hoped that this 
> program had some active maintainers); the code is very badly organized if 
> you ask me, not-quite spaguetti style but close. There isn't a single point 
> of entry for search functions, instead they are spread around, which makes 
> it quite difficult to reason about the logic path that the code will 
> follow. Some times naming of stuff could be clearer, too. Not to mention 
> that doing ad-hoc checks of the literal text from the combo-boxes is a big 
> code smell, in my book... All this makes it difficult to read and follow 
> the code.
>
> elseif {$gdttype eq [mc "changing lines matching:"]} {  # everywhere
>
> Anyhow. At this point I've populated the code with tons of printf-style 
> debugging, to try and get an idea of how it works. The line you linked 
> seemed to be reasonable... "if IgnCase, then match some text while ignoring 
> case". Except that doesn't get called when searching, at all. Turns out the 
> actual command that gets called when searching is in line 4804 & 4809 (
> https://github.com/git/git/blob/master/gitk-git/gitk#L4804).
>
> The effective command is: git diff-tree -r -s --stdin -G
>
> I don't know much about git diff-tree, but recognize that "-G" (and also 
> the nearby "-S") as pickaxe commands, which I've used in the past like this:
>
> Case-insensitive search for any occurrences of some pattern:
> git log -i -G""
>
> Case-insensitive search for additions/removals of some text:
> git log -i -S""
>
> Seems all that's missing here is a "-i" switch! I'll test and report back.
>
>
>
> On Thursday, June 14, 2018 at 1:18:28 AM UTC+2, Philip Oakley wrote:
>>
>> The menu is defijned at ~line  2329 
>>
>> The match function check is ~line 4878 
>>
>> https://github.com/git/git/blob/master/gitk-git/gitk#L4878 
>>
>> It looks like it was coded to do as you ask, but that some update to the 
>> tcl 
>> itself (maybe i18n, or utf8 capabilities) has caused the `-nocase` check 
>> to 
>> fail. 
>>
>> my reading of https://www.tcl.tk/man/tcl8.0/TclCmd/string.htm suggests 
>> there 
>> is no `-nocase` option in that version. 
>>
>> https://wiki.tcl.tk/4385 https://www.tcl.tk/man/tcl8.5/TclCmd/string.htm 
>> give more for that version. needs close reading. 
>>
>> - Original Message - 
>> From: "Philip Oakley"  
>> To:  
>> Sent: Wednesday, June 13, 2018 10:05 PM 
>> Subject: Re: [git-users] (Bug report) gitk "IgnCase" search doesn't work 
>>
>>
>> > Hi Juan, 
>> > 
>> > I think it will be option 3 
>> > Have a dive into the tcl code (it's not that hard once you realise it's 
>> > just code), search for the bit that does the IgnCase and see if you can 
>> > spot what should have been done (at least where the issue may be). 
>> > 
>> > The git list will be interested and supportive of a researched bug 
>> report 
>> > with pointer to the are to be fixed. 
>> > 
>> > Have a look at "https://public-inbox.org/git/?q=; or 
>> > https://public-inbox.org/git/ and search for either gitk or 'git gui' 
>> to 
>> > see the recent contributors in that area (and their solutions). 
>> > 
>> > The current issue with gitk / git gui is that there isn't an active 
>> > maintainer for those parts of the eco-system, so the uptake by Git and 
>> GfW 
>> > can be sporadic. 
>> > 
>> > Philip 
>> > 
>> > - Original Message - 
>> > From: "Juan Navarro"  
>> > To: "Git for human beings"  
>> > Sent: Monday, June 11, 2018 4:04 PM 
>> > Subject: [git-users] (Bug report) gitk "IgnCase" search doesn't work 
>> > 
>> > 
>> >> I'm genuinely surprised that this doesn't seem to have been reported, 
>> but 
>> >> I 
>> >> swear I did my homework searching in Google, in this users list, and 
>> in 
>> >> the 
>> >> Git Community Mailing List, without relevant results. So, here it 
>> goes. 
>> >> 
>> >> 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 
>> >> 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 

Re: [git-users] (Bug report) gitk "IgnCase" search doesn't work

2018-06-14 Thread Juan Navarro
I'm a programmer myself, so it wasn't much of a hassle to dive into gitk's 
source code.

That said, it's been quite a time sink (which is why I hoped that this 
program had some active maintainers); the code is very badly organized if 
you ask me, not-quite spaguetti style but close. There isn't a single point 
of entry for search functions, instead they are spread around, which makes 
it quite difficult to reason about the logic path that the code will 
follow. Some times naming of stuff could be clearer, too. Not to mention 
that doing ad-hoc checks of the literal text from the combo-boxes is a big 
code smell, in my book... All this makes it difficult to read and follow 
the code.

elseif {$gdttype eq [mc "changing lines matching:"]} {  # everywhere

Anyhow. At this point I've populated the code with tons of printf-style 
debugging, to try and get an idea of how it works. The line you linked 
seemed to be reasonable... "if IgnCase, then match some text while ignoring 
case". Except that doesn't get called when searching, at all. Turns out the 
actual command that gets called when searching is in line 4804 & 4809 
(https://github.com/git/git/blob/master/gitk-git/gitk#L4804).

The effective command is: git diff-tree -r -s --stdin -G

I don't know much about git diff-tree, but recognize that "-G" (and also 
the nearby "-S") as pickaxe commands, which I've used in the past like this:

Case-insensitive search for any occurrences of some pattern:
git log -i -G""

Case-insensitive search for additions/removals of some text:
git log -i -S""

Seems all that's missing here is a "-i" switch! I'll test and report back.



On Thursday, June 14, 2018 at 1:18:28 AM UTC+2, Philip Oakley wrote:
>
> The menu is defijned at ~line  2329 
>
> The match function check is ~line 4878 
>
> https://github.com/git/git/blob/master/gitk-git/gitk#L4878 
>
> It looks like it was coded to do as you ask, but that some update to the 
> tcl 
> itself (maybe i18n, or utf8 capabilities) has caused the `-nocase` check 
> to 
> fail. 
>
> my reading of https://www.tcl.tk/man/tcl8.0/TclCmd/string.htm suggests 
> there 
> is no `-nocase` option in that version. 
>
> https://wiki.tcl.tk/4385 https://www.tcl.tk/man/tcl8.5/TclCmd/string.htm 
> give more for that version. needs close reading. 
>
> - Original Message - 
> From: "Philip Oakley" > 
> To: > 
> Sent: Wednesday, June 13, 2018 10:05 PM 
> Subject: Re: [git-users] (Bug report) gitk "IgnCase" search doesn't work 
>
>
> > Hi Juan, 
> > 
> > I think it will be option 3 
> > Have a dive into the tcl code (it's not that hard once you realise it's 
> > just code), search for the bit that does the IgnCase and see if you can 
> > spot what should have been done (at least where the issue may be). 
> > 
> > The git list will be interested and supportive of a researched bug 
> report 
> > with pointer to the are to be fixed. 
> > 
> > Have a look at "https://public-inbox.org/git/?q=; or 
> > https://public-inbox.org/git/ and search for either gitk or 'git gui' 
> to 
> > see the recent contributors in that area (and their solutions). 
> > 
> > The current issue with gitk / git gui is that there isn't an active 
> > maintainer for those parts of the eco-system, so the uptake by Git and 
> GfW 
> > can be sporadic. 
> > 
> > Philip 
> > 
> > - Original Message - 
> > From: "Juan Navarro" > 
> > To: "Git for human beings" > 
> > Sent: Monday, June 11, 2018 4:04 PM 
> > Subject: [git-users] (Bug report) gitk "IgnCase" search doesn't work 
> > 
> > 
> >> I'm genuinely surprised that this doesn't seem to have been reported, 
> but 
> >> I 
> >> swear I did my homework searching in Google, in this users list, and in 
> >> the 
> >> Git Community Mailing List, without relevant results. So, here it goes. 
> >> 
> >> 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 
> >> 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 only direct mention of this issue that I was able to find was this 
> >> answer that seems to confirm that this is a bug, but doesn't help much: 
> >> 
> https://stackoverflow.com/questions/11964704/msysgit-how-do-i-use-gitk-to-search-for-string-in-commit-ignoring-case
>  
> >> 
> >> Should I follow