threads / patch / 46546

patchbuiltin/add: add detail to a 'cannot chmod' error message

Subject: [PATCH] builtin/add: add detail to a 'cannot chmod' error message

## tl;dr

3 messages between Aug 9, 2017 and Aug 9, 2017. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Ramsay Jones· Aug 9, 2017, 00:51 UTC · lore

In addition to adding the missing newline, add the x-ecutable bit 'mode change' character to the error message. This message now has the same form as similar messages output by 'update-index'.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Junio,
This is v2 of the earlier "add a newline" patch. Thanks!

ATB, Ramsay Jones

 builtin/add.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Show changes to builtin/add.c +3 −3
diff --git a/builtin/add.c b/builtin/add.c
index e888fb8c5..5d5773d5c 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -32,7 +32,7 @@ struct update_callback_data {
 	int add_errors;
 };
 
-static void chmod_pathspec(struct pathspec *pathspec, int force_mode)
+static void chmod_pathspec(struct pathspec *pathspec, char flip)
 {
 	int i;
 
@@ -42,8 +42,8 @@ static void chmod_pathspec(struct pathspec *pathspec, int force_mode)
 		if (pathspec && !ce_path_match(ce, pathspec, NULL))
 			continue;
 
-		if (chmod_cache_entry(ce, force_mode) < 0)
-			fprintf(stderr, "cannot chmod '%s'", ce->name);
+		if (chmod_cache_entry(ce, flip) < 0)
+			fprintf(stderr, "cannot chmod %cx '%s'\n", flip, ce->name);
 	}
 }
 
-- 
2.14.0
Junio C Hamano· Aug 9, 2017, 05:45 UTC · re: Ramsay Jones · lore

Re: [PATCH] builtin/add: add detail to a 'cannot chmod' error message

Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
Show 10 quoted lines
> In addition to adding the missing newline, add the x-ecutable bit
> 'mode change' character to the error message. This message now has
> the same form as similar messages output by 'update-index'.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Junio,
>
> This is v2 of the earlier "add a newline" patch. Thanks!

Thanks; here is me reminding myself to apply this with Jonathan's reviewed-by in the morning.

Show 30 quoted lines
>
> ATB,
> Ramsay Jones
>
>  builtin/add.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/builtin/add.c b/builtin/add.c
> index e888fb8c5..5d5773d5c 100644
> --- a/builtin/add.c
> +++ b/builtin/add.c
> @@ -32,7 +32,7 @@ struct update_callback_data {
>  	int add_errors;
>  };
>  
> -static void chmod_pathspec(struct pathspec *pathspec, int force_mode)
> +static void chmod_pathspec(struct pathspec *pathspec, char flip)
>  {
>  	int i;
>  
> @@ -42,8 +42,8 @@ static void chmod_pathspec(struct pathspec *pathspec, int force_mode)
>  		if (pathspec && !ce_path_match(ce, pathspec, NULL))
>  			continue;
>  
> -		if (chmod_cache_entry(ce, force_mode) < 0)
> -			fprintf(stderr, "cannot chmod '%s'", ce->name);
> +		if (chmod_cache_entry(ce, flip) < 0)
> +			fprintf(stderr, "cannot chmod %cx '%s'\n", flip, ce->name);
>  	}
>  }
Jonathan Nieder· Aug 9, 2017, 06:54 UTC · re: Ramsay Jones · lore

Re: [PATCH] builtin/add: add detail to a 'cannot chmod' error message

Ramsay Jones wrote:
Show 10 quoted lines
> In addition to adding the missing newline, add the x-ecutable bit
> 'mode change' character to the error message. This message now has
> the same form as similar messages output by 'update-index'.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
> This is v2 of the earlier "add a newline" patch. Thanks!
>
>  builtin/add.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Thanks.

← back to recent threads