Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew DeVore <matvore@google.com>2019-06-28 01:54:09 +0300
committerJunio C Hamano <gitster@pobox.com>2019-06-28 18:41:53 +0300
commitf56f764279be2433ecf3cb3a484210bcaffea70c (patch)
tree211ef3c804dccbfffcc66ab35941c79a15efd5b9 /list-objects-filter-options.c
parente987df5fe62b8b29be4cdcdeb3704681ada2b29e (diff)
list-objects-filter-options: move error check up
Move the check that filter_options->choice is set to higher in the call stack. This can only be set when the gentle parse function is called from one of the two call sites. This is important because in an upcoming patch this may or may not be an error, and whether it is an error is only known to the parse_list_objects_filter function. Signed-off-by: Matthew DeVore <matvore@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'list-objects-filter-options.c')
-rw-r--r--list-objects-filter-options.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
index 75d0236ee2..5fe2814841 100644
--- a/list-objects-filter-options.c
+++ b/list-objects-filter-options.c
@@ -35,11 +35,8 @@ static int gently_parse_list_objects_filter(
{
const char *v0;
- if (filter_options->choice) {
- strbuf_addstr(
- errbuf, _("multiple filter-specs cannot be combined"));
- return 1;
- }
+ if (filter_options->choice)
+ BUG("filter_options already populated");
if (!strcmp(arg, "blob:none")) {
filter_options->choice = LOFC_BLOB_NONE;
@@ -185,6 +182,8 @@ int parse_list_objects_filter(struct list_objects_filter_options *filter_options
const char *arg)
{
struct strbuf buf = STRBUF_INIT;
+ if (filter_options->choice)
+ die(_("multiple filter-specs cannot be combined"));
filter_options->filter_spec = strdup(arg);
if (gently_parse_list_objects_filter(filter_options, arg, &buf))
die("%s", buf.buf);