mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
Merge branch 'jc/show-branch-g-current'
The "--current" option of "git show-branch" should have been made incompatible with the "--reflog" mode, but this was not enforced, which has been corrected. * jc/show-branch-g-current: show-branch: -g and --current are incompatible
This commit is contained in:
commit
18254f14f2
|
@ -712,6 +712,10 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
|
||||||
"--all/--remotes/--independent/--merge-base");
|
"--all/--remotes/--independent/--merge-base");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (with_current_branch && reflog)
|
||||||
|
die(_("options '%s' and '%s' cannot be used together"),
|
||||||
|
"--reflog", "--current");
|
||||||
|
|
||||||
/* If nothing is specified, show all branches by default */
|
/* If nothing is specified, show all branches by default */
|
||||||
if (ac <= topics && all_heads + all_remotes == 0)
|
if (ac <= topics && all_heads + all_remotes == 0)
|
||||||
all_heads = 1;
|
all_heads = 1;
|
||||||
|
|
|
@ -161,4 +161,18 @@ test_expect_success 'show branch --reflog=2' '
|
||||||
test_cmp actual expect
|
test_cmp actual expect
|
||||||
'
|
'
|
||||||
|
|
||||||
|
# incompatible options
|
||||||
|
while read combo
|
||||||
|
do
|
||||||
|
test_expect_success "show-branch $combo (should fail)" '
|
||||||
|
test_must_fail git show-branch $combo 2>error &&
|
||||||
|
grep -e "cannot be used together" -e "usage:" error
|
||||||
|
'
|
||||||
|
done <<\EOF
|
||||||
|
--all --reflog
|
||||||
|
--merge-base --reflog
|
||||||
|
--list --merge-base
|
||||||
|
--reflog --current
|
||||||
|
EOF
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Reference in a new issue