Merge branch 'nd/the-index' into md/list-objects-filter-by-depth
[gitweb.git] / builtin / notes.c
index c05cd004abcbdcd1e4c3d140f3cf4251c416df36..4996a670f71333de09e1a0311fde85d6985c9c91 100644 (file)
@@ -215,6 +215,8 @@ static int parse_msg_arg(const struct option *opt, const char *arg, int unset)
 {
        struct note_data *d = opt->value;
 
+       BUG_ON_OPT_NEG(unset);
+
        strbuf_grow(&d->buf, strlen(arg) + 2);
        if (d->buf.len)
                strbuf_addch(&d->buf, '\n');
@@ -229,6 +231,8 @@ static int parse_file_arg(const struct option *opt, const char *arg, int unset)
 {
        struct note_data *d = opt->value;
 
+       BUG_ON_OPT_NEG(unset);
+
        if (d->buf.len)
                strbuf_addch(&d->buf, '\n');
        if (!strcmp(arg, "-")) {
@@ -250,15 +254,15 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
        enum object_type type;
        unsigned long len;
 
+       BUG_ON_OPT_NEG(unset);
+
        if (d->buf.len)
                strbuf_addch(&d->buf, '\n');
 
        if (get_oid(arg, &object))
                die(_("failed to resolve '%s' as a valid ref."), arg);
-       if (!(buf = read_object_file(&object, &type, &len))) {
-               free(buf);
+       if (!(buf = read_object_file(&object, &type, &len)))
                die(_("failed to read object '%s'."), arg);
-       }
        if (type != OBJ_BLOB) {
                free(buf);
                die(_("cannot read note data from non-blob object '%s'."), arg);
@@ -273,6 +277,7 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
 static int parse_reedit_arg(const struct option *opt, const char *arg, int unset)
 {
        struct note_data *d = opt->value;
+       BUG_ON_OPT_NEG(unset);
        d->use_editor = 1;
        return parse_reuse_arg(opt, arg, unset);
 }
@@ -808,7 +813,7 @@ static int merge(int argc, const char **argv, const char *prefix)
                usage_with_options(git_notes_merge_usage, options);
        }
 
-       init_notes_merge_options(&o);
+       init_notes_merge_options(the_repository, &o);
        o.verbosity = verbosity + NOTES_MERGE_VERBOSITY_DEFAULT;
 
        if (do_abort)