summaryrefslogtreecommitdiff
path: root/builtin/notes.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/notes.c')
-rw-r--r--builtin/notes.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/builtin/notes.c b/builtin/notes.c
index c05cd004ab..4996a670f7 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -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)