summaryrefslogtreecommitdiff
path: root/builtin/notes.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/notes.c')
-rw-r--r--builtin/notes.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/builtin/notes.c b/builtin/notes.c
index 8c26e45526..d051abf6df 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -32,9 +32,9 @@
static const char *separator = "\n";
static const char * const git_notes_usage[] = {
N_("git notes [--ref <notes-ref>] [list [<object>]]"),
- N_("git notes [--ref <notes-ref>] add [-f] [--allow-empty] [--[no-]separator|--separator=<paragraph-break>] [--[no-]stripspace] [-m <msg> | -F <file> | (-c | -C) <object>] [<object>]"),
+ N_("git notes [--ref <notes-ref>] add [-f] [--allow-empty] [--[no-]separator|--separator=<paragraph-break>] [--[no-]stripspace] [-m <msg> | -F <file> | (-c | -C) <object>] [<object>] [-e]"),
N_("git notes [--ref <notes-ref>] copy [-f] <from-object> <to-object>"),
- N_("git notes [--ref <notes-ref>] append [--allow-empty] [--[no-]separator|--separator=<paragraph-break>] [--[no-]stripspace] [-m <msg> | -F <file> | (-c | -C) <object>] [<object>]"),
+ N_("git notes [--ref <notes-ref>] append [--allow-empty] [--[no-]separator|--separator=<paragraph-break>] [--[no-]stripspace] [-m <msg> | -F <file> | (-c | -C) <object>] [<object>] [-e]"),
N_("git notes [--ref <notes-ref>] edit [--allow-empty] [<object>]"),
N_("git notes [--ref <notes-ref>] show [<object>]"),
N_("git notes [--ref <notes-ref>] merge [-v | -q] [-s <strategy>] <notes-ref>"),
@@ -431,7 +431,8 @@ static struct notes_tree *init_notes_check(const char *subcommand,
return t;
}
-static int list(int argc, const char **argv, const char *prefix)
+static int list(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct notes_tree *t;
struct object_id object;
@@ -468,9 +469,11 @@ static int list(int argc, const char **argv, const char *prefix)
return retval;
}
-static int append_edit(int argc, const char **argv, const char *prefix);
+static int append_edit(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED);
-static int add(int argc, const char **argv, const char *prefix)
+static int add(int argc, const char **argv, const char *prefix,
+ struct repository *repo)
{
int force = 0, allow_empty = 0;
const char *object_ref;
@@ -489,6 +492,8 @@ static int add(int argc, const char **argv, const char *prefix)
OPT_CALLBACK_F('c', "reedit-message", &d, N_("object"),
N_("reuse and edit specified note object"), PARSE_OPT_NONEG,
parse_reedit_arg),
+ OPT_BOOL('e', "edit", &d.use_editor,
+ N_("edit note message in editor")),
OPT_CALLBACK_F('C', "reuse-message", &d, N_("object"),
N_("reuse specified note object"), PARSE_OPT_NONEG,
parse_reuse_arg),
@@ -541,7 +546,7 @@ static int add(int argc, const char **argv, const char *prefix)
* argv[0-1].
*/
argv[0] = "edit";
- return append_edit(argc, argv, prefix);
+ return append_edit(argc, argv, prefix, repo);
}
fprintf(stderr, _("Overwriting existing notes for object %s\n"),
oid_to_hex(&object));
@@ -567,7 +572,8 @@ static int add(int argc, const char **argv, const char *prefix)
return 0;
}
-static int copy(int argc, const char **argv, const char *prefix)
+static int copy(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int retval = 0, force = 0, from_stdin = 0;
const struct object_id *from_note, *note;
@@ -644,7 +650,8 @@ out:
return retval;
}
-static int append_edit(int argc, const char **argv, const char *prefix)
+static int append_edit(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int allow_empty = 0;
const char *object_ref;
@@ -667,6 +674,8 @@ static int append_edit(int argc, const char **argv, const char *prefix)
OPT_CALLBACK_F('C', "reuse-message", &d, N_("object"),
N_("reuse specified note object"), PARSE_OPT_NONEG,
parse_reuse_arg),
+ OPT_BOOL('e', "edit", &d.use_editor,
+ N_("edit note message in editor")),
OPT_BOOL(0, "allow-empty", &allow_empty,
N_("allow storing empty note")),
OPT_CALLBACK_F(0, "separator", &separator,
@@ -745,7 +754,8 @@ static int append_edit(int argc, const char **argv, const char *prefix)
return 0;
}
-static int show(int argc, const char **argv, const char *prefix)
+static int show(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
const char *object_ref;
struct notes_tree *t;
@@ -871,7 +881,8 @@ static int git_config_get_notes_strategy(const char *key,
return 0;
}
-static int merge(int argc, const char **argv, const char *prefix)
+static int merge(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct strbuf remote_ref = STRBUF_INIT, msg = STRBUF_INIT;
struct object_id result_oid;
@@ -1012,7 +1023,8 @@ static int remove_one_note(struct notes_tree *t, const char *name, unsigned flag
return (flag & IGNORE_MISSING) ? 0 : status;
}
-static int remove_cmd(int argc, const char **argv, const char *prefix)
+static int remove_cmd(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
unsigned flag = 0;
int from_stdin = 0;
@@ -1055,7 +1067,8 @@ static int remove_cmd(int argc, const char **argv, const char *prefix)
return retval;
}
-static int prune(int argc, const char **argv, const char *prefix)
+static int prune(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct notes_tree *t;
int show_only = 0, verbose = 0;
@@ -1084,7 +1097,8 @@ static int prune(int argc, const char **argv, const char *prefix)
return 0;
}
-static int get_ref(int argc, const char **argv, const char *prefix)
+static int get_ref(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = { OPT_END() };
char *notes_ref;
@@ -1105,7 +1119,7 @@ static int get_ref(int argc, const char **argv, const char *prefix)
int cmd_notes(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
const char *override_notes_ref = NULL;
parse_opt_subcommand_fn *fn = NULL;
@@ -1144,5 +1158,5 @@ int cmd_notes(int argc,
strbuf_release(&sb);
}
- return !!fn(argc, argv, prefix);
+ return !!fn(argc, argv, prefix, repo);
}