]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/checkout.c
restore: fault --staged --worktree with merge opts
authorAndy Koppe <andy.koppe@gmail.com>
Sun, 26 Feb 2023 18:43:54 +0000 (18:43 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Feb 2023 17:33:20 +0000 (09:33 -0800)
commitee8a88826af1137f0b192caa39b016032ac96af2
tree95153ee1300eb2e2c4d039414cb4813a1f68c96f
parent7556e5d737b917d31ac3729b0f5e2391da7e132a
restore: fault --staged --worktree with merge opts

The 'restore' command already rejects the --merge, --conflict, --ours
and --theirs options when combined with --staged, but accepts them when
--worktree is added as well.

Unfortunately that doesn't appear to do anything useful. The --ours and
--theirs options seem to be ignored when both --staged and --worktree
are given, whereas with --merge or --conflict, the command has the same
effect as if the --staged option wasn't present.

So reject those options with '--staged --worktree' as well, using
opts->accept_ref to distinguish restore from checkout.

Add test for both '--staged' and '--staged --worktree'.

Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c
t/t2070-restore.sh