Re: [PATCH v4 1/4] fetch: Protect branches checked out in all worktrees
- From
Anders Kaseorg <andersk@mit.edu>
- Date
- Nov 9, 2021, 22:52 UTC
- Message-ID
- <316e8579-d720-b40e-66fb-3280e8de1922@mit.edu>
- In-Reply-To
- <nycvar.QRO.7.76.6.2111091706290.54@tvgsbejvaqbjf.bet>
On 11/9/21 08:09, Johannes Schindelin wrote:
>> + (wt = find_shared_symref("HEAD", ref_map->peer_ref->name)))
>
> Do we need `&& !wt->is_bare` here, too?Sure (in the “future-proofing” sense), will add.
>> +test_expect_success 'refuse fetch to current branch of worktree' ' >> + test_when_finished "git worktree remove --force wt" && > > Do we also need `&& git branch -D wt` here?
Will add.
>> + git fetch -u . HEAD:wt > > Maybe even `test_path_exists wt/apple.t`, to verify that the worktree has > been updated?
Not here; git fetch -u never updates working trees, not even the main working tree. Is that a bug? I don’t know, but if it is, it’s certainly a separate one.
Anders