{"thread":{"id":"31305","subject":"[PATCH] difftool: silence warning","startedAt":"2012-08-21T06:59:18Z","lastAt":"2012-08-21T09:42:14Z","messageCount":3,"participants":["Ross Lagerwall","David Aguilar"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"197512","messageId":"1345532358-11742-1-git-send-email-rosslagerwall@gmail.com","threadId":"31305","inReplyTo":null,"subject":"[PATCH] difftool: silence warning","fromName":"Ross Lagerwall","fromEmail":"rosslagerwall@gmail.com","sentAt":"2012-08-21T06:59:18Z","receivedAt":"2012-08-21T06:59:18Z","isPatch":true,"sender":{"key":"rosslagerwall@gmail.com","avatar":"https://avatars.githubusercontent.com/u/878055?v=4"},"body":"Silence a warning given when running git difftool --dir-diff and\nthere are no changes.\nThis is because command_oneline returns undef when the command has no\noutput, not ''.\n\nSigned-off-by: Ross Lagerwall <rosslagerwall@gmail.com>\n---\n git-difftool.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-difftool.perl b/git-difftool.perl\nindex ae1e052..1cfcbb3 100755\n--- a/git-difftool.perl\n+++ b/git-difftool.perl\n@@ -117,7 +117,7 @@ sub setup_dir_diff\n \t# by Git->repository->command*.\n \tmy $diffrepo = Git->repository(Repository => $repo_path, WorkingCopy => $workdir);\n \tmy $diffrtn = $diffrepo->command_oneline('diff', '--raw', '--no-abbrev', '-z', @ARGV);\n-\texit(0) if (length($diffrtn) == 0);\n+\texit(0) unless defined($diffrtn);\n \n \t# Setup temp directories\n \tmy $tmpdir = tempdir('git-diffall.XXXXX', CLEANUP => 1, TMPDIR => 1);\n-- \n1.7.11.4\n"},{"id":"197521","messageId":"CAJDDKr5W5YJoMEkX7_ax_pvwdibJ81LMzsM0Rnkn1=9=Nu25EA@mail.gmail.com","threadId":"31305","inReplyTo":"1345532358-11742-1-git-send-email-rosslagerwall@gmail.com","subject":"Re: [PATCH] difftool: silence warning","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2012-08-21T09:04:04Z","receivedAt":"2012-08-21T09:04:04Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Mon, Aug 20, 2012 at 11:59 PM, Ross Lagerwall\n<rosslagerwall@gmail.com> wrote:\n> Silence a warning given when running git difftool --dir-diff and\n> there are no changes.\n> This is because command_oneline returns undef when the command has no\n> output, not ''.\n>\n> Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>\n\nThanks\n\nThis patch is obviously correct, but it won't apply in git's \"next\" branch.\nCan you please prepare a patch based on the version in next?\n\n\nA small question on Perl style for the list... is it better say this?\n\n   exit(0) unless $diffrtn;\n\nor is it better to explicitly check for undef using defined($diffrtn)\nlike was done in this patch? I would assume that explicit is preferred.\n\n\n> ---\n>  git-difftool.perl | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/git-difftool.perl b/git-difftool.perl\n> index ae1e052..1cfcbb3 100755\n> --- a/git-difftool.perl\n> +++ b/git-difftool.perl\n> @@ -117,7 +117,7 @@ sub setup_dir_diff\n>         # by Git->repository->command*.\n>         my $diffrepo = Git->repository(Repository => $repo_path, WorkingCopy => $workdir);\n>         my $diffrtn = $diffrepo->command_oneline('diff', '--raw', '--no-abbrev', '-z', @ARGV);\n> -       exit(0) if (length($diffrtn) == 0);\n> +       exit(0) unless defined($diffrtn);\n>\n>         # Setup temp directories\n>         my $tmpdir = tempdir('git-diffall.XXXXX', CLEANUP => 1, TMPDIR => 1);\n> --\n> 1.7.11.4\n-- \nDavid\n"},{"id":"197523","messageId":"503357F6.2020907@gmail.com","threadId":"31305","inReplyTo":"CAJDDKr5W5YJoMEkX7_ax_pvwdibJ81LMzsM0Rnkn1=9=Nu25EA@mail.gmail.com","subject":"Re: [PATCH] difftool: silence warning","fromName":"Ross Lagerwall","fromEmail":"rosslagerwall@gmail.com","sentAt":"2012-08-21T09:42:14Z","receivedAt":"2012-08-21T09:42:14Z","isPatch":true,"sender":{"key":"rosslagerwall@gmail.com","avatar":"https://avatars.githubusercontent.com/u/878055?v=4"},"body":"On 08/21/2012 11:04 AM, David Aguilar wrote:\n> This patch is obviously correct, but it won't apply in git's \"next\" branch.\n> Can you please prepare a patch based on the version in next?\n> \nSure.\n\n> \n> A small question on Perl style for the list... is it better say this?\n> \n>    exit(0) unless $diffrtn;\n> \n> or is it better to explicitly check for undef using defined($diffrtn)\n> like was done in this patch? I would assume that explicit is preferred.\n> \n\nIt seems like defined() is used throughout git-difftool so I just used that.\n\nRegards\n-- \nRoss Lagerwall\n\n"}]}