Subject: Re: [PATCH] t7800-difftool: don't accidentally match tmp dirs

From: SZEDER Gábor <[email-masked]>
Date: Fri, 8 Jan 2021 10:20:36 +0100

On Wed, Jan 06, 2021 at 10:24:27PM -0800, Junio C Hamano wrote:
> SZEDER Gábor <[email-masked]> writes:
> 
> > diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
> > index a578b35761..fe02fe1688 100755
> > --- a/t/t7800-difftool.sh
> > +++ b/t/t7800-difftool.sh
> > @@ -439,73 +439,104 @@ run_dir_diff_test () {
> >  }
> >  
> >  run_dir_diff_test 'difftool -d' '
> > +	cat >expect <<-\EOF &&
> > +	file
> > +	file2
> > +
> > +	file
> > +	file2
> > +	sub
> > +	EOF
> >  	git difftool -d $symlinks --extcmd ls branch >output &&
> > -	grep sub output &&
> > -	grep file output
> > +	grep -v ^/ output >actual &&
> 
> This unfortunately would not catch full paths on certain platforms.
> 
> See https://github.com/git/git/runs/1660588243?check_suite_focus=true#step:7:4186
> for an example X-<.

Hrm, one has to log in to view those CI logs?  Really?! :(

Anyway, I (apparently falsely) assumed that the output these tests
look at come from Git itself, and therefore we can rely on difftool's
temporary directories being normalized UNIX-style absolute paths...
But it seems they don't actually come from Git but from 'ls', because
that's what those '--extcmd ls' options do, and I now going to assume
that 'ls' prints those absolute paths with drive letter prefixes and
whatnot on Windows.

The initial version of this patch just tightened all potentially
problematic 'grep' patterns, e.g. 'grep ^sub$ output && grep ^file$
output'.  That should work on Windows as well, shouldn't it.  Will see
whether I can dig it out from the reflogs.