]> git.ipfire.org Git - thirdparty/git.git/commit
add: propagate --chmod errors to exit status
authorMatheus Tavares <matheus.bernardino@usp.br>
Tue, 23 Feb 2021 01:10:35 +0000 (22:10 -0300)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Feb 2021 20:14:51 +0000 (12:14 -0800)
commit9ebd7fe15869910c81c42290bd80296664597dec
tree468e6cdeefb78a29eff87e4e7d649cb188a5f286
parent48960894f5a89639809bdad5618439ba59869522
add: propagate --chmod errors to exit status

If `add` encounters an error while applying the --chmod changes, it
prints a message to stderr, but exits with a success code. This might
have been an oversight, as the command does exit with a non-zero code in
other situations where it cannot (or refuses to) update all of the
requested paths (e.g. when some of the given paths are ignored). So make
the exit behavior more consistent by also propagating --chmod errors to
the exit status.

Note: the test "all statuses changed in folder if . is given" uses paths
added by previous test cases, some of which might be symbolic links.
Because `git add --chmod` will now fail with such paths, this test would
depend on whether all the previous tests were executed, or only some
of them. Avoid that by running the test on a fresh repo with only
regular files.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/add.c
t/t3700-add.sh