checkout -m: refine autostash fallback - #2364
Conversation
Add a conflicted parameter to apply_save_autostash_oid() and apply_save_autostash_ref() so callers can learn whether applying the stash resulted in conflicts. Thread the parameter through apply_autostash_ref() and update existing callers to pass NULL. Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
When unpack_trees() fails under "git checkout -m", only create an autostash and retry if there are tracked local changes. Without such changes, the fallback cannot help and merely repeats the same failure. Use the conflict result from apply_autostash_ref() to print a blank line before the branch-switch message, visually separating it from the conflict advice. Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
10747bc to
37becf3
Compare
|
/submit |
|
Submitted as pull.2364.git.git.1784993669.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
| @@ -838,10 +838,11 @@ static void init_topts(struct unpack_trees_options *topts, | |||
| static int merge_working_tree(const struct checkout_opts *opts, | |||
There was a problem hiding this comment.
Junio C Hamano wrote on the Git mailing list (how to reply to this email):
"Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Harald Nordgren <haraldnordgren@gmail.com>
>
> When unpack_trees() fails under "git checkout -m", only create an
> autostash and retry if there are tracked local changes. Without such
> changes, the fallback cannot help and merely repeats the same failure.
>
> Use the conflict result from apply_autostash_ref() to print a blank line
> before the branch-switch message, visually separating it from the
> conflict advice.
>
> Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
> ---
> builtin/checkout.c | 17 +++++++++++++----
> t/t7201-co.sh | 17 ++++++++++++++++-
> 2 files changed, 29 insertions(+), 5 deletions(-)
Thanks. Will queue.|
This patch series was integrated into seen via e6126a3. |
|
This branch is now known as |
|
There was a status update in the "Cooking" section about the branch The autostash fallback in 'git checkout -m' has been refined to only retry when there are local changes. Additionally, a blank line now visually separates autostash conflict advice from the subsequent branch-switch message. Needs review. cf. <xmqqwluebuhb.fsf@gitster.g> source: <pull.2364.git.git.1784993669.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch The autostash fallback in 'git checkout -m' has been refined to only retry when there are local changes. Additionally, a blank line now visually separates autostash conflict advice from the subsequent branch-switch message. Needs review. cf. <xmqqwluebuhb.fsf@gitster.g> source: <pull.2364.git.git.1784993669.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch The autostash fallback in 'git checkout -m' has been refined to only retry when there are local changes. Additionally, a blank line now visually separates autostash conflict advice from the subsequent branch-switch message. Needs review. cf. <xmqqwluebuhb.fsf@gitster.g> source: <pull.2364.git.git.1784993669.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch The autostash fallback in 'git checkout -m' has been refined to only retry when there are local changes. Additionally, a blank line now visually separates autostash conflict advice from the subsequent branch-switch message. Needs review. cf. <xmqqwluebuhb.fsf@gitster.g> source: <pull.2364.git.git.1784993669.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch The autostash fallback in 'git checkout -m' has been refined to only retry when there are local changes. Additionally, a blank line now visually separates autostash conflict advice from the subsequent branch-switch message. Needs review. cf. <xmqqwluebuhb.fsf@gitster.g> source: <pull.2364.git.git.1784993669.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch The autostash fallback in 'git checkout -m' has been refined to only retry when there are local changes. Additionally, a blank line now visually separates autostash conflict advice from the subsequent branch-switch message. Needs review. cf. <xmqqwluebuhb.fsf@gitster.g> source: <pull.2364.git.git.1784993669.gitgitgadget@gmail.com> |
|
There was a status update in the "Cooking" section about the branch The autostash fallback in 'git checkout -m' has been refined to only retry when there are local changes. Additionally, a blank line now visually separates autostash conflict advice from the subsequent branch-switch message. Needs review. cf. <xmqqwluebuhb.fsf@gitster.g> source: <pull.2364.git.git.1784993669.gitgitgadget@gmail.com> |
Avoiding
checkout -mautostash retries when no tracked local changes exist and visually separating autostash conflict advice from the subsequent branch-switch message.Addresses #leftoverbits from here: https://lore.kernel.org/git/cfd09dbf-8d77-4464-8030-3a0ffb4aeae7@gmail.com/