summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9eafa12)
raw | patch | inline | side by side (parent: 9eafa12)
author | Jeff King <peff@peff.net> | |
Mon, 28 Jun 2010 08:59:07 +0000 (04:59 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 28 Jun 2010 16:15:15 +0000 (09:15 -0700) |
Otherwise we may segfault with too few parameters.
Signed-off-by: Jeff King <peff@peff.net>
Tested-by: Bert Wesarg <Bert.Wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Tested-by: Bert Wesarg <Bert.Wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/notes.c | patch | blob | history | |
t/t3301-notes.sh | patch | blob | history |
diff --git a/builtin/notes.c b/builtin/notes.c
index da504ee0af5dab303add0ddf210a7953ca87ae9d..f678f9cb520fa331de4899e372502cffccd9682c 100644 (file)
--- a/builtin/notes.c
+++ b/builtin/notes.c
}
}
+ if (argc < 2) {
+ error("too few parameters");
+ usage_with_options(git_notes_copy_usage, options);
+ }
if (2 < argc) {
error("too many parameters");
usage_with_options(git_notes_copy_usage, options);
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index 64f32ad94dfe842746774596b88c91e873da864f..2d67a40fc16385b8bee37968f4058b094a174a98 100755 (executable)
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
git log -1 > output &&
test_cmp expect output
'
+
+test_expect_success 'git notes copy diagnoses too many or too few parameters' '
+ test_must_fail git notes copy &&
+ test_must_fail git notes copy one two three
+'
+
test_done