From: John Keeping <john@keeping.me.uk>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Johannes Sixt <j.sixt@viscovery.net>,
David Aguilar <davvid@gmail.com>,
Sitaram Chamarty <sitaramc@gmail.com>,
Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCH 2/3] t7800: fix tests when difftool uses --no-symlinks
Date: Fri, 22 Mar 2013 23:05:16 +0000 [thread overview]
Message-ID: <20130322230516.GK2283@serenity.lan> (raw)
In-Reply-To: <7v8v5f59n1.fsf@alter.siamese.dyndns.org>
On Fri, Mar 22, 2013 at 03:53:38PM -0700, Junio C Hamano wrote:
> John Keeping <john@keeping.me.uk> writes:
>
> > When 'git difftool --dir-diff' is using --no-symlinks (either explicitly
> > or implicitly because it's running on Windows), any working tree files
> > that have been copied to the temporary directory are copied back after
> > the difftool completes. This includes untracked files in the working
> > tree.
>
> Hmph. Why do we populate the temporary directory with a copy of an
> untracked path in the first place? I thought the point of dir-diff
> was to materialize only the relevant paths to two temporaries and
> compare these temporaries with a tool that knows how to compare two
> directories?
>
> Even if you had path F in HEAD that you are no longer tracking in
> the working tree, a normal
>
> $ git diff HEAD
>
> would report the path F to have been deleted, so I would imagine
> that the preimage side of the temporary directory should get a copy
> of HEAD:F at path F, while the postimage side of the temporary
> directory should not even have anything at path F, when dir-diff
> runs, no?
>
> Isn't that the real reason why the test fails? The path 'output' is
> not being tracked at any revision or in the index that is involved
> in the test, is it?
Actually it is, which is what I missed earlier.
A couple of tests before this 'setup change in subdirectory' does 'git
add .' which is far more general than it needs. Perhaps this is a
better change:
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index bba8a9d..561c993 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -314,7 +314,7 @@ test_expect_success PERL 'setup change in subdirectory' '
git commit -m "added sub/sub" &&
echo test >>file &&
echo test >>sub/sub &&
- git add . &&
+ git add file sub/sub &&
git commit -m "modified both"
'
> > During the tests, this means that the following sequence occurs:
> >
> > 1) the shell opens "output" to redirect the difftool output
> > 2) difftool copies the empty "output" to the temporary directory
> > 3) difftool runs "ls" which writes to "output"
> > 4) difftool copies the empty "output" file back over the output of the
> > command
> > 5) the output files doesn't contain the expected output, causing the
> > test to fail
> >
> > Avoid this by writing the output into .git/ which will not be copied or
> > overwritten.
>
> It is a good idea to move these test output and expect test vectore
> files to a different place to make it easier to distinguish them
> from test input (e.g. "sub", "file", etc.) in general, but the
> description of the original problem sounds like it is just working
> around a bug to me. What am I missing?
I think there is a bug, as described in the paragraph below, and this
test should be made independent of that. In light of the above I think
we can drop this patch and do this with that change instead.
> > In the longer term, difftool probably needs to learn to warn the user
> > instead of overwrite any changes that have been made to the working tree
> > file.
> >
> > Signed-off-by: John Keeping <john@keeping.me.uk>
> > ---
> > t/t7800-difftool.sh | 24 ++++++++++++------------
> > 1 file changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
> > index e694972..1eed439 100755
> > --- a/t/t7800-difftool.sh
> > +++ b/t/t7800-difftool.sh
> > @@ -319,29 +319,29 @@ test_expect_success PERL 'setup change in subdirectory' '
> > '
> >
> > test_expect_success PERL 'difftool -d' '
> > - git difftool -d --extcmd ls branch >output &&
> > - grep sub output &&
> > - grep file output
> > + git difftool -d --extcmd ls branch >.git/output &&
> > + grep sub .git/output &&
> > + grep file .git/output
> > '
> >
> > test_expect_success PERL 'difftool --dir-diff' '
> > - git difftool --dir-diff --extcmd ls branch >output &&
> > - grep sub output &&
> > - grep file output
> > + git difftool --dir-diff --extcmd ls branch >.git/output &&
> > + grep sub .git/output &&
> > + grep file .git/output
> > '
> >
> > test_expect_success PERL 'difftool --dir-diff ignores --prompt' '
> > - git difftool --dir-diff --prompt --extcmd ls branch >output &&
> > - grep sub output &&
> > - grep file output
> > + git difftool --dir-diff --prompt --extcmd ls branch >.git/output &&
> > + grep sub .git/output &&
> > + grep file .git/output
> > '
> >
> > test_expect_success PERL 'difftool --dir-diff from subdirectory' '
> > (
> > cd sub &&
> > - git difftool --dir-diff --extcmd ls branch >output &&
> > - grep sub output &&
> > - grep file output
> > + git difftool --dir-diff --extcmd ls branch >../.git/output &&
> > + grep sub ../.git/output &&
> > + grep file ../.git/output
> > )
> > '
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-03-22 23:05 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-21 4:03 [PATCH v3 1/4] difftool: silence uninitialized variable warning David Aguilar
2013-02-21 4:03 ` [PATCH 2/4] t7800: update copyright notice David Aguilar
2013-02-21 4:03 ` [PATCH v3 3/4] t7800: modernize tests David Aguilar
2013-02-21 4:03 ` [PATCH v3 4/4] t7800: "defaults" is no longer a builtin tool name David Aguilar
2013-02-21 4:55 ` Junio C Hamano
2013-02-21 5:00 ` Junio C Hamano
2013-02-21 23:31 ` David Aguilar
2013-03-20 9:48 ` [PATCH v3 3/4] t7800: modernize tests Johannes Sixt
2013-03-20 22:59 ` David Aguilar
2013-03-21 7:41 ` Johannes Sixt
2013-03-22 7:13 ` Johannes Sixt
2013-03-22 10:00 ` John Keeping
2013-03-22 11:14 ` Johannes Sixt
2013-03-22 11:53 ` John Keeping
2013-03-22 19:36 ` [PATCH 0/3] Improve difftool --dir-diff tests John Keeping
2013-03-22 19:36 ` [PATCH 1/3] t7800: don't hide grep output John Keeping
2013-03-22 22:32 ` Johannes Sixt
2013-03-22 22:45 ` Junio C Hamano
2013-03-22 19:36 ` [PATCH 2/3] t7800: fix tests when difftool uses --no-symlinks John Keeping
2013-03-22 22:27 ` Johannes Sixt
2013-03-22 22:53 ` Junio C Hamano
2013-03-22 23:05 ` John Keeping [this message]
2013-03-23 3:24 ` David Aguilar
2013-03-22 19:36 ` [PATCH 3/3] t7800: run --dir-diff tests with and without symlinks John Keeping
2013-03-22 21:05 ` [PATCH 3/3 v2] " John Keeping
2013-03-23 13:31 ` [PATCH v2 0/3] difftool --dir-diff test improvements John Keeping
2013-03-23 13:31 ` [PATCH v2 1/3] t7800: don't hide grep output John Keeping
2013-03-23 13:31 ` [PATCH v2 2/3] t7800: fix tests when difftool uses --no-symlinks John Keeping
2013-03-24 5:19 ` Junio C Hamano
2013-03-24 12:36 ` John Keeping
2013-03-24 13:31 ` Matt McClure
2013-03-24 15:15 ` John Keeping
2013-03-25 7:41 ` Johannes Sixt
2013-03-25 10:42 ` John Keeping
2013-03-25 21:44 ` [PATCH v2] difftool: don't overwrite modified files John Keeping
2013-03-26 8:38 ` Johannes Sixt
2013-03-26 8:47 ` Johannes Sixt
2013-03-26 9:31 ` John Keeping
2013-03-26 9:53 ` Johannes Sixt
2013-03-26 19:34 ` John Keeping
2013-03-26 20:52 ` Matt McClure
2013-03-26 21:01 ` John Keeping
2013-03-25 16:15 ` [PATCH v2 2/3] t7800: fix tests when difftool uses --no-symlinks Junio C Hamano
2013-03-24 21:29 ` David Aguilar
2013-03-25 10:57 ` John Keeping
2013-03-25 14:54 ` Junio C Hamano
2013-03-24 13:24 ` Matt McClure
2013-03-24 6:20 ` Eric Sunshine
2013-03-23 13:31 ` [PATCH v2 3/3] t7800: run --dir-diff tests with and without symlinks John Keeping
2013-03-25 7:26 ` Johannes Sixt
2013-03-25 10:35 ` John Keeping
2013-03-25 10:59 ` Johannes Sixt
2013-03-25 11:02 ` John Keeping
2013-03-25 21:50 ` Junio C Hamano
2013-03-26 9:22 ` John Keeping
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130322230516.GK2283@serenity.lan \
--to=john@keeping.me.uk \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=jrnieder@gmail.com \
--cc=sitaramc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.