Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--diffcore-pickaxe.c6
-rwxr-xr-xt/t4209-log-pickaxe.sh6
2 files changed, 9 insertions, 3 deletions
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index 953b6ec1b4..88b6ca840f 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -132,9 +132,6 @@ static int pickaxe_match(struct diff_filepair *p, struct diff_options *o,
oidset_contains(o->objfind, &p->two->oid));
}
- if (!o->pickaxe[0])
- return 0;
-
if (o->flags.allow_textconv) {
textconv_one = get_textconv(o->repo, p->one);
textconv_two = get_textconv(o->repo, p->two);
@@ -230,6 +227,9 @@ void diffcore_pickaxe(struct diff_options *o)
kwset_t kws = NULL;
pickaxe_fn fn;
+ if (opts & ~DIFF_PICKAXE_KIND_OBJFIND &&
+ (!needle || !*needle))
+ BUG("should have needle under -G or -S");
if (opts & (DIFF_PICKAXE_REGEX | DIFF_PICKAXE_KIND_G)) {
int cflags = REG_EXTENDED | REG_NEWLINE;
if (o->pickaxe_opts & DIFF_PICKAXE_IGNORE_CASE)
diff --git a/t/t4209-log-pickaxe.sh b/t/t4209-log-pickaxe.sh
index 16166ffd3e..3f9aad0fdb 100755
--- a/t/t4209-log-pickaxe.sh
+++ b/t/t4209-log-pickaxe.sh
@@ -56,6 +56,12 @@ test_expect_success setup '
'
test_expect_success 'usage' '
+ test_expect_code 129 git log -S 2>err &&
+ test_i18ngrep "switch.*requires a value" err &&
+
+ test_expect_code 129 git log -G 2>err &&
+ test_i18ngrep "switch.*requires a value" err &&
+
test_expect_code 128 git log -Gregex -Sstring 2>err &&
grep "mutually exclusive" err &&