threads / patch / 44669

patch, 2 partsmergetools/kompare: simplify can_merge() by using "false"

Subject: [PATCH 1/2] mergetools/kompare: simplify can_merge() by using "false"

## tl;dr

5 messages between Dec 10, 2016 and Dec 12, 2016. Diffs are folded; open one to read it.

replies: 4people: 3as markdown or json

David Aguilar· Dec 10, 2016, 03:21 UTC · lore
Signed-off-by: David Aguilar <davvid@gmail.com>
---
This patch builds upon da/mergetool-trust-exit-code
 mergetools/kompare | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to mergetools/kompare +1 −1
diff --git a/mergetools/kompare b/mergetools/kompare
index e8c0bfa678..321022500b 100644
--- a/mergetools/kompare
+++ b/mergetools/kompare
@@ -1,5 +1,5 @@
 can_merge () {
-	return 1
+	false
 }
 
 diff_cmd () {
-- 
2.11.0.27.gdeff8c7
David Aguilar· Dec 10, 2016, 03:21 UTC · re: David Aguilar · lore

[PATCH 2/2] mergetools/tortoisemerge: simplify can_diff() by using "false"

Signed-off-by: David Aguilar <davvid@gmail.com>
---
This patch builds upon da/mergetool-trust-exit-code
 mergetools/tortoisemerge | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to mergetools/tortoisemerge +1 −1
diff --git a/mergetools/tortoisemerge b/mergetools/tortoisemerge
index d7ab666a59..9067d8a4e5 100644
--- a/mergetools/tortoisemerge
+++ b/mergetools/tortoisemerge
@@ -1,5 +1,5 @@
 can_diff () {
-	return 1
+	false
 }
 
 merge_cmd () {
-- 
2.11.0.27.gdeff8c7
Johannes Sixt· Dec 10, 2016, 08:15 UTC · re: David Aguilar · lore

Re: [PATCH 2/2] mergetools/tortoisemerge: simplify can_diff() by using "false"

Am 10.12.2016 um 04:21 schrieb David Aguilar:
Show 16 quoted lines
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> This patch builds upon da/mergetool-trust-exit-code
>
>  mergetools/tortoisemerge | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mergetools/tortoisemerge b/mergetools/tortoisemerge
> index d7ab666a59..9067d8a4e5 100644
> --- a/mergetools/tortoisemerge
> +++ b/mergetools/tortoisemerge
> @@ -1,5 +1,5 @@
>  can_diff () {
> -	return 1
> +	false
>  }
Why is this a simplification?

My concern is that 'false' is not necessarily a shell built-in. Then this is actually a pessimization.

-- Hannes
David Aguilar· Dec 12, 2016, 07:16 UTC · re: Johannes Sixt · lore

Re: [PATCH 2/2] mergetools/tortoisemerge: simplify can_diff() by using "false"

On Sat, Dec 10, 2016 at 09:15:34AM +0100, Johannes Sixt wrote:
Show 22 quoted lines
> Am 10.12.2016 um 04:21 schrieb David Aguilar:
> > Signed-off-by: David Aguilar <davvid@gmail.com>
> > ---
> > This patch builds upon da/mergetool-trust-exit-code
> > 
> >  mergetools/tortoisemerge | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/mergetools/tortoisemerge b/mergetools/tortoisemerge
> > index d7ab666a59..9067d8a4e5 100644
> > --- a/mergetools/tortoisemerge
> > +++ b/mergetools/tortoisemerge
> > @@ -1,5 +1,5 @@
> >  can_diff () {
> > -	return 1
> > +	false
> >  }
> 
> Why is this a simplification?
> 
> My concern is that 'false' is not necessarily a shell built-in. Then this is
> actually a pessimization.
The "simplification" is semantic only.
Motivation: if someone reads the implementation of can_diff()
and it says "false" then that communicates intent moreso than
reading "return 1", which a programmer unfamiliar with shell
conventions might misinterpret as boolean "true".

I care less about semantics then I do about making things better for Windows, so we can forget about these two patches.

-- 
David
Philip Oakley· Dec 12, 2016, 11:45 UTC · re: David Aguilar · lore

Re: [PATCH 2/2] mergetools/tortoisemerge: simplify can_diff() by using "false"

From: "David Aguilar" <davvid@gmail.com>
Show 32 quoted lines
> On Sat, Dec 10, 2016 at 09:15:34AM +0100, Johannes Sixt wrote:
>> Am 10.12.2016 um 04:21 schrieb David Aguilar:
>> > Signed-off-by: David Aguilar <davvid@gmail.com>
>> > ---
>> > This patch builds upon da/mergetool-trust-exit-code
>> >
>> >  mergetools/tortoisemerge | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/mergetools/tortoisemerge b/mergetools/tortoisemerge
>> > index d7ab666a59..9067d8a4e5 100644
>> > --- a/mergetools/tortoisemerge
>> > +++ b/mergetools/tortoisemerge
>> > @@ -1,5 +1,5 @@
>> >  can_diff () {
>> > - return 1
>> > + false
>> >  }
>>
>> Why is this a simplification?
>>
>> My concern is that 'false' is not necessarily a shell built-in. Then this 
>> is
>> actually a pessimization.
>
> The "simplification" is semantic only.
>
> Motivation: if someone reads the implementation of can_diff()
> and it says "false" then that communicates intent moreso than
> reading "return 1", which a programmer unfamiliar with shell
> conventions might misinterpret as boolean "true".
>
Is this a case where a short comment would be informative?
 + return 1 /* shell: false */
Show 5 quoted lines
> I care less about semantics then I do about making things better
> for Windows, so we can forget about these two patches.
> -- 
> David
>

-- Philip

← back to recent threads