ref-filter: make combining --merged & --no-merged an error
Change the behavior of specifying --merged & --no-merged to be an error, instead of silently picking the option that was provided last. Subsequent changes of mine add a --no-contains option in addition to the existing --contains. Providing both of those isn't an error, and has actual meaning. Making its cousins have different behavior in this regard would be confusing to the user, especially since we'd be silently disregarding some of their command-line input. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
8881d35cac
commit
17d6c744dc
11
ref-filter.c
11
ref-filter.c
@ -2084,8 +2084,17 @@ int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset)
|
||||
{
|
||||
struct ref_filter *rf = opt->value;
|
||||
unsigned char sha1[20];
|
||||
int no_merged = starts_with(opt->long_name, "no");
|
||||
|
||||
rf->merge = starts_with(opt->long_name, "no")
|
||||
if (rf->merge) {
|
||||
if (no_merged) {
|
||||
return opterror(opt, "is incompatible with --merged", 0);
|
||||
} else {
|
||||
return opterror(opt, "is incompatible with --no-merged", 0);
|
||||
}
|
||||
}
|
||||
|
||||
rf->merge = no_merged
|
||||
? REF_FILTER_MERGED_OMIT
|
||||
: REF_FILTER_MERGED_INCLUDE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user