]> git.ipfire.org Git - thirdparty/git.git/commit
notes: fix minimum number of parameters to "copy" subcommand
authorDoan Tran Cong Danh <congdanhqx@gmail.com>
Wed, 16 Oct 2019 05:18:41 +0000 (12:18 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 Oct 2019 00:43:10 +0000 (09:43 +0900)
commitd58deb9c4e151d4d8380cd14223391ce0d58f588
treedf6b2fcfe848eaeb41160b20f082cf8e73c4d3a6
parent8af69cf3e214ee9df3f78bd508465b75881b17a8
notes: fix minimum number of parameters to "copy" subcommand

The builtin/notes.c::copy() function is prepared to handle either
one or two arguments given from the command line; when one argument
is given, to-obj defaults to HEAD.

bbb1b8a3 ("notes: check number of parameters to "git notes copy"",
2010-06-28) tried to make sure "git notes copy" (with *no* other
argument) does not dereference NULL by checking the number of
parameters, but it incorrectly insisted that we need two arguments,
instead of either one or two.  This disabled the defaulting to-obj
to HEAD.

Correct it.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-notes.txt
builtin/notes.c
t/t3301-notes.sh