git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Aug 9, 2017, 00:51 UTC
Message-ID
<aa004526-3e0d-66d4-287f-30abd29758fc@ramsayjones.plus.com>

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(-)
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
Next: Junio C Hamano
Message 1 of 3 in “builtin/add: add detail to a 'cannot chmod' error message”
  1. builtin/add: add detail to a 'cannot chmod' error messageRamsay Jones, Aug 9, 2017
  2. Junio C HamanoAug 9, 2017
  3. Jonathan NiederAug 9, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.