Re: [PATCH v2 3/3] difftool --dir-diff: symlink all files matching the working tree
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 14, 2013, 21:28 UTC
- Message-ID
- <7v620ty8lc.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <ae17a152cadc650920c6446a4493384cc2e77309.1363291949.git.john@keeping.me.uk>
John Keeping <john@keeping.me.uk> writes:
Show 15 quoted lines
> diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh > index 3aab6e1..70e09b6 100755 > --- a/t/t7800-difftool.sh > +++ b/t/t7800-difftool.sh > @@ -340,6 +340,28 @@ test_expect_success PERL 'difftool --dir-diff' ' > stdin_contains file <output > ' > > +write_script .git/CHECK_SYMLINKS <<\EOF > +for f in file file2 sub/sub > +do > + echo "$f" > + readlink "$2/$f" > +done >actual > +EOF
When you later want to enhance the test to check a combination of difftool arguments where some paths are expected to become links and others are expected to become real files, wouldn't this helper become a bit awkward to use? The element that expects a real file could be an empty line to what corresponds to the output from readlink, but still...
If t/ directory (or when the test is run with --root=<there>) is aliased with symlinks in such a way that "cd <there> && $(pwd)" does not match <there>, would this check with $(pwd) still work, I have to wonder?
Show 9 quoted lines
> +test_expect_success PERL,SYMLINKS 'difftool --dir-diff --symlink without unstaged changes' ' > + cat <<EOF >expect && > +file > +$(pwd)/file > +file2 > +$(pwd)/file2 > +sub/sub > +$(pwd)/sub/sub > +EOF
You can do this to align them nicer (note the "-" before EOF):
cat >expect <<-EOF &&
file
$(pwd)/file
...
EOFShow 5 quoted lines
> + git difftool --dir-diff --symlink \ > + --extcmd "./.git/CHECK_SYMLINKS" branch HEAD && > + test_cmp actual expect > +' > +
Thanks.