All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] difftool: silence warning
@ 2012-08-21  6:59 Ross Lagerwall
  2012-08-21  9:04 ` David Aguilar
  0 siblings, 1 reply; 4+ messages in thread
From: Ross Lagerwall @ 2012-08-21  6:59 UTC (permalink / raw)
  To: git; +Cc: Ross Lagerwall

Silence a warning given when running git difftool --dir-diff and
there are no changes.
This is because command_oneline returns undef when the command has no
output, not ''.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
---
 git-difftool.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-difftool.perl b/git-difftool.perl
index ae1e052..1cfcbb3 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -117,7 +117,7 @@ sub setup_dir_diff
 	# by Git->repository->command*.
 	my $diffrepo = Git->repository(Repository => $repo_path, WorkingCopy => $workdir);
 	my $diffrtn = $diffrepo->command_oneline('diff', '--raw', '--no-abbrev', '-z', @ARGV);
-	exit(0) if (length($diffrtn) == 0);
+	exit(0) unless defined($diffrtn);
 
 	# Setup temp directories
 	my $tmpdir = tempdir('git-diffall.XXXXX', CLEANUP => 1, TMPDIR => 1);
-- 
1.7.11.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] difftool: silence warning
  2012-08-21  6:59 [PATCH] difftool: silence warning Ross Lagerwall
@ 2012-08-21  9:04 ` David Aguilar
  2012-08-21  9:42   ` Ross Lagerwall
  0 siblings, 1 reply; 4+ messages in thread
From: David Aguilar @ 2012-08-21  9:04 UTC (permalink / raw)
  To: Ross Lagerwall; +Cc: git

On Mon, Aug 20, 2012 at 11:59 PM, Ross Lagerwall
<rosslagerwall@gmail.com> wrote:
> Silence a warning given when running git difftool --dir-diff and
> there are no changes.
> This is because command_oneline returns undef when the command has no
> output, not ''.
>
> Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>

Thanks

This patch is obviously correct, but it won't apply in git's "next" branch.
Can you please prepare a patch based on the version in next?


A small question on Perl style for the list... is it better say this?

   exit(0) unless $diffrtn;

or is it better to explicitly check for undef using defined($diffrtn)
like was done in this patch? I would assume that explicit is preferred.


> ---
>  git-difftool.perl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-difftool.perl b/git-difftool.perl
> index ae1e052..1cfcbb3 100755
> --- a/git-difftool.perl
> +++ b/git-difftool.perl
> @@ -117,7 +117,7 @@ sub setup_dir_diff
>         # by Git->repository->command*.
>         my $diffrepo = Git->repository(Repository => $repo_path, WorkingCopy => $workdir);
>         my $diffrtn = $diffrepo->command_oneline('diff', '--raw', '--no-abbrev', '-z', @ARGV);
> -       exit(0) if (length($diffrtn) == 0);
> +       exit(0) unless defined($diffrtn);
>
>         # Setup temp directories
>         my $tmpdir = tempdir('git-diffall.XXXXX', CLEANUP => 1, TMPDIR => 1);
> --
> 1.7.11.4
-- 
David

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] difftool: silence warning
  2012-08-21  9:04 ` David Aguilar
@ 2012-08-21  9:42   ` Ross Lagerwall
  0 siblings, 0 replies; 4+ messages in thread
From: Ross Lagerwall @ 2012-08-21  9:42 UTC (permalink / raw)
  To: David Aguilar; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

On 08/21/2012 11:04 AM, David Aguilar wrote:
> This patch is obviously correct, but it won't apply in git's "next" branch.
> Can you please prepare a patch based on the version in next?
> 
Sure.

> 
> A small question on Perl style for the list... is it better say this?
> 
>    exit(0) unless $diffrtn;
> 
> or is it better to explicitly check for undef using defined($diffrtn)
> like was done in this patch? I would assume that explicit is preferred.
> 

It seems like defined() is used throughout git-difftool so I just used that.

Regards
-- 
Ross Lagerwall


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] difftool: silence warning
@ 2012-08-21 10:21 Ross Lagerwall
  0 siblings, 0 replies; 4+ messages in thread
From: Ross Lagerwall @ 2012-08-21 10:21 UTC (permalink / raw)
  To: git; +Cc: Ross Lagerwall

Silence a warning given when running git difftool --dir-diff and
there are no changes.
This is because command_oneline returns undef when the command has no
output, not ''.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
---
 git-difftool.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-difftool.perl b/git-difftool.perl
index 17d4de6..edd0493 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -138,7 +138,7 @@ sub setup_dir_diff
 
 	my @gitargs = ('diff', '--raw', '--no-abbrev', '-z', @ARGV);
 	my $diffrtn = $diffrepo->command_oneline(@gitargs);
-	exit(0) if (length($diffrtn) == 0);
+	exit(0) unless defined($diffrtn);
 
 	# Build index info for left and right sides of the diff
 	my $submodule_mode = '160000';
-- 
1.7.11.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-21 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-21  6:59 [PATCH] difftool: silence warning Ross Lagerwall
2012-08-21  9:04 ` David Aguilar
2012-08-21  9:42   ` Ross Lagerwall
2012-08-21 10:21 Ross Lagerwall

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.