]> git.ipfire.org Git - thirdparty/git.git/commit
diff: don't crash with empty argument to -G or -S
authorbrian m. carlson <sandals@crustytoothpaste.net>
Mon, 17 Feb 2025 17:57:59 +0000 (17:57 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Feb 2025 18:17:02 +0000 (10:17 -0800)
commita620046b29d3a9b8a0337c0396441c26ac84ebe9
tree3f907e65d6e6b04a324e0c4bb7e086b7ffe1a326
parentf93ff170b93a1782659637824b25923245ac9dd1
diff: don't crash with empty argument to -G or -S

The pickaxe options, -G and -S, need either a regex or a string to look
through the history for.  An empty value isn't very useful since it
would either match everything or nothing, and what's worse, we presently
crash with a BUG like so when the user provides one:

    BUG: diffcore-pickaxe.c:241: should have needle under -G or -S

Since it's not very nice of us to crash and this wouldn't do anything
useful anyway, let's simply inform the user that they must provide a
non-empty argument and exit with an error if they provide an empty one
instead.

Reported-by: Jared Van Bortel <cebtenzzre@gmail.com>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
t/t4209-log-pickaxe.sh