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

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> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramsay Jones committed Aug 9, 2017 at 01:51 UTC 1e22a9917b48809a1825f79c66e58e9b1b1da08a
1 file changed +3 -3
builtin/add.c
+3 -3
@@ -30,7 +30,7 @@ struct update_callback_data {
30 int add_errors;
31 };
32
33 -static void chmod_pathspec(struct pathspec *pathspec, int force_mode)
33 +static void chmod_pathspec(struct pathspec *pathspec, char flip)
34 {
35 int i;
36
@@ -40,8 +40,8 @@ static void chmod_pathspec(struct pathspec *pathspec, int force_mode)
40 if (pathspec && !ce_path_match(ce, pathspec, NULL))
41 continue;
42
43 - if (chmod_cache_entry(ce, force_mode) < 0)
44 - fprintf(stderr, "cannot chmod '%s'", ce->name);
43 + if (chmod_cache_entry(ce, flip) < 0)
44 + fprintf(stderr, "cannot chmod %cx '%s'\n", flip, ce->name);
45 }
46 }
47