diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-01-10 11:52:57 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-10 11:52:57 -0800 |
commit | 6e223455917954f414cea98b00b67aac91e2b619 (patch) | |
tree | 11660c11d32fa367ecb6e666830a192a84c366f2 /builtin | |
parent | Merge branch 'ms/t-readme-typofix' (diff) | |
parent | stash: do not return before restoring untracked files (diff) | |
download | tgif-6e223455917954f414cea98b00b67aac91e2b619.tar.xz |
Merge branch 'en/stash-df-fix'
"git stash apply" forgot to attempt restoring untracked files when
it failed to restore changes to tracked ones.
* en/stash-df-fix:
stash: do not return before restoring untracked files
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/stash.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/builtin/stash.c b/builtin/stash.c index 6b4eb5c258..1ef2017c59 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -561,18 +561,19 @@ static int do_apply_stash(const char *prefix, struct stash_info *info, if (index) fprintf_ln(stderr, _("Index was not unstashed.")); - return ret; + goto restore_untracked; } if (has_index) { if (reset_tree(&index_tree, 0, 0)) - return -1; + ret = -1; } else { unstage_changes_unless_new(&c_tree); } +restore_untracked: if (info->has_u && restore_untracked(&info->u_tree)) - return error(_("could not restore untracked files from stash")); + ret = error(_("could not restore untracked files from stash")); if (!quiet) { struct child_process cp = CHILD_PROCESS_INIT; @@ -592,7 +593,7 @@ static int do_apply_stash(const char *prefix, struct stash_info *info, run_command(&cp); } - return 0; + return ret; } static int apply_stash(int argc, const char **argv, const char *prefix) |