checkout: finish switch when tracking config cannot be written
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 1 replyIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | branch: return an error from setup_tracking()branch.c branch.h builtin/ +1 more | +55 | 0 replies | |
| 2/2 | checkout: finish switching when the tracking config cannot be writtenbuiltin/ t/ t/ +1 more | +67 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] checkout: finish switch when tracking config cannot be written
When the tracking config cannot be written (for example, because .git/config.lock exists), git switch -c and checkout -b stop halfway. The worktree, the index and the new branch ref are already updated, but HEAD stays on the old branch, and the changes are left staged.
* 1/2 makes setup_tracking() return an error instead of calling exit(). No behavior change yet.
* 2/2 makes switch and checkout finish the switch and exit with status 0, as push -u, clone and fetch already do. git branch still fails.
These patches were first sent as part of v2 of a series that also fixed the hint
(https://lore.kernel.org/git/[email protected]/).
Junio asked whether they can be treated separately from the hint fix
(https://lore.kernel.org/git/[email protected]/), and I replied that they can
(https://lore.kernel.org/git/CAP8tz2KOXHLjc5V1o1tZZWSsgOjVrp-ekH7H5KszBGK+hRqwrg@mail.gmail.com/).
The direction was agreed in the bug report thread
(https://lore.kernel.org/git/[email protected]/).
Making the switch fully atomic, so that a failure undoes the worktree, the index, the ref and the config, is left for a separate topic.
tsukasa inoue (2):
branch: return an error from setup_tracking()
checkout: finish switching when the tracking config cannot be written
branch.c | 35 +++++++++++++++++++++-------------- branch.h | 21 +++++++++++++-------- builtin/branch.c | 17 ++++++++++++----- builtin/checkout.c | 6 ++++++ t/t2027-checkout-track.sh | 20 ++++++++++++++++++++ t/t2060-switch.sh | 20 ++++++++++++++++++++ t/t3200-branch.sh | 13 +++++++++++++ 7 files changed, 105 insertions(+), 27 deletions(-)
base-commit: 47fdf2208c5b94c8cc01c106b8f7c85efb91c926
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2275%2FtsukasaI%2Ffix%2Fcheckout-tracking-config-failure-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2275/tsukasaI/fix/checkout-tracking-config-failure-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2275
Signature · 1 line
gitgitgadget