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>
Johan Herland committed
Feb 13, 2010 at 22:28 UTC
aaec9bcf6d85a084725e8386bf314a6ef6842468
5 files changed
+14
-8
Documentation/git-notes.txt
+1
-1
@@ -11,7 +11,7 @@ SYNOPSIS
11
'git notes' [list [<object>]]
12
'git notes' add [-f] [-F <file> | -m <msg>] [<object>]
13
'git notes' append [-F <file> | -m <msg>] [<object>]
14
-'git notes' edit [-F <file> | -m <msg>] [<object>]
14
+'git notes' edit [<object>]
15
'git notes' show [<object>]
16
'git notes' remove [<object>]
17
'git notes' prune
builtin-notes.c
+8
-2
@@ -21,7 +21,7 @@ static const char * const git_notes_usage[] = {
21
"git notes [list [<object>]]",
22
"git notes add [-f] [-m <msg> | -F <file>] [<object>]",
23
"git notes append [-m <msg> | -F <file>] [<object>]",
24
- "git notes edit [-m <msg> | -F <file>] [<object>]",
24
+ "git notes edit [<object>]",
25
"git notes show [<object>]",
26
"git notes remove [<object>]",
27
"git notes prune",
@@ -233,7 +233,7 @@ int cmd_notes(int argc, const char **argv, const char *prefix)
233
const char *msgfile = NULL;
234
struct msg_arg msg = { 0, STRBUF_INIT };
235
struct option options[] = {
236
- OPT_GROUP("Notes edit options"),
236
+ OPT_GROUP("Notes options"),
237
OPT_CALLBACK('m', "message", &msg, "msg",
238
"note contents as a string", parse_msg_arg),
239
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)
270
usage_with_options(git_notes_usage, options);
271
}
272
273
+ if ((msg.given || msgfile) && edit) {
274
+ fprintf(stderr, "The -m and -F options has been deprecated for"
275
+ " the 'edit' subcommand.\n"
276
+ "Please use 'git notes add -f -m/-F' instead.\n");
277
+ }
278
+
279
if (msg.given && msgfile) {
280
error("mixing -m and -F options is not allowed.");
281
usage_with_options(git_notes_usage, options);
t/t3304-notes-mixed.sh
+1
-1
@@ -188,7 +188,7 @@ test_expect_success "verify contents of non-notes" '
188
test_expect_success "git-notes preserves non-notes" '
189
190
test_tick &&
191
- git notes edit -m "foo bar"
191
+ git notes add -f -m "foo bar"
192
'
193
194
test_expect_success "verify contents of non-notes after git-notes" '
t/t3305-notes-fanout.sh
+1
-1
@@ -14,7 +14,7 @@ test_expect_success 'creating many notes with git-notes' '
14
echo "file for commit #$i" > file &&
15
git add file &&
16
git commit -q -m "commit #$i" &&
17
- git notes edit -m "note #$i" || return 1
17
+ git notes add -m "note #$i" || return 1
18
done
19
'
20
t/t3306-notes-prune.sh
+3
-3
@@ -10,17 +10,17 @@ test_expect_success 'setup: create a few commits with notes' '
10
git add file1 &&
11
test_tick &&
12
git commit -m 1st &&
13
- git notes edit -m "Note #1" &&
13
+ git notes add -m "Note #1" &&
14
: > file2 &&
15
git add file2 &&
16
test_tick &&
17
git commit -m 2nd &&
18
- git notes edit -m "Note #2" &&
18
+ git notes add -m "Note #2" &&
19
: > file3 &&
20
git add file3 &&
21
test_tick &&
22
git commit -m 3rd &&
23
- git notes edit -m "Note #3"
23
+ git notes add -m "Note #3"
24
'
25
26
cat > expect <<END_OF_LOG