summaryrefslogtreecommitdiff
path: root/builtin-notes.c
diff options
context:
space:
mode:
authorLibravatar Johan Herland <johan@herland.net>2010-02-13 22:28:34 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-02-13 19:36:16 -0800
commitaaec9bcf6d85a084725e8386bf314a6ef6842468 (patch)
treeac81dd7ed75b64aed4e51f3739e343be05116249 /builtin-notes.c
parentbuiltin-notes: Add "append" subcommand for appending to note objects (diff)
downloadtgif-aaec9bcf6d85a084725e8386bf314a6ef6842468.tar.xz
builtin-notes: Deprecate the -m/-F options for "git notes edit"
The semantics for "git notes edit -m/-F" overlap with those for "git notes add -f", and the behaviour (i.e. overwriting existing notes with the given message/file) is more intuitively captured by (and better documented with) "git notes add -f". Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-notes.c')
-rw-r--r--builtin-notes.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/builtin-notes.c b/builtin-notes.c
index c88df00b3a..572b47746b 100644
--- a/builtin-notes.c
+++ b/builtin-notes.c
@@ -21,7 +21,7 @@ static const char * const git_notes_usage[] = {
"git notes [list [<object>]]",
"git notes add [-f] [-m <msg> | -F <file>] [<object>]",
"git notes append [-m <msg> | -F <file>] [<object>]",
- "git notes edit [-m <msg> | -F <file>] [<object>]",
+ "git notes edit [<object>]",
"git notes show [<object>]",
"git notes remove [<object>]",
"git notes prune",
@@ -233,7 +233,7 @@ int cmd_notes(int argc, const char **argv, const char *prefix)
const char *msgfile = NULL;
struct msg_arg msg = { 0, STRBUF_INIT };
struct option options[] = {
- OPT_GROUP("Notes edit options"),
+ OPT_GROUP("Notes options"),
OPT_CALLBACK('m', "message", &msg, "msg",
"note contents as a string", parse_msg_arg),
OPT_FILENAME('F', "file", &msgfile, "note contents in a file"),
@@ -270,6 +270,12 @@ int cmd_notes(int argc, const char **argv, const char *prefix)
usage_with_options(git_notes_usage, options);
}
+ if ((msg.given || msgfile) && edit) {
+ fprintf(stderr, "The -m and -F options has been deprecated for"
+ " the 'edit' subcommand.\n"
+ "Please use 'git notes add -f -m/-F' instead.\n");
+ }
+
if (msg.given && msgfile) {
error("mixing -m and -F options is not allowed.");
usage_with_options(git_notes_usage, options);