]> git.ipfire.org Git - thirdparty/git.git/commit - t/t3903-stash.sh
builtin/stash: report failure to write to index
authorPatrick Steinhardt <ps@pks.im>
Tue, 6 Feb 2024 05:34:41 +0000 (06:34 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 6 Feb 2024 20:08:38 +0000 (12:08 -0800)
commitd2058cb2f00ae4c174b44193b039790dc8015c40
tree8b829603500c2157c9cd3682c7265eb64e8af9da
parent564d0252ca632e0264ed670534a51d18a689ef5d
builtin/stash: report failure to write to index

The git-stash(1) command needs to write to the index for many of its
operations. When the index is locked by a concurrent writer it will thus
fail to operate, which is expected. What is not expected though is that
we do not print any error message at all in this case. The user can thus
easily miss the fact that the command didn't do what they expected it to
do and would be left wondering why that is.

Fix this bug and report failures to write to the index. Add tests for
the subcommands which hit the respective code paths.

While at it, unify error messages when writing to the index fails. The
chosen error message is already used in "builtin/stash.c".

Reported-by: moti sd <motisd8@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/stash.c
t/t3903-stash.sh