diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-06-07 10:32:20 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-07 10:32:20 -0700 |
| commit | f5598fcb7ba8588c78a8ab3212e94dc84155d137 (patch) | |
| tree | 64860f1ef3b2184e8364814bae1bc50a4b179c34 | |
| parent | 79864519637f58c79d15ec5b49272c0580201af3 (diff) | |
| parent | 56f4f4a29d32e177ef9af0907a17e431e8b3737e (diff) | |
| download | git-f5598fcb7ba8588c78a8ab3212e94dc84155d137.tar.gz | |
Merge branch 'jc/t1517-more' into jk/imap-send-plug-all-msgs-leak
* jc/t1517-more:
imap-send: minimum leakfix
t1517: more coverage for commands that work without repository
| -rw-r--r-- | imap-send.c | 1 | ||||
| -rwxr-xr-x | t/t1517-outside-repo.sh | 52 |
2 files changed, 53 insertions, 0 deletions
diff --git a/imap-send.c b/imap-send.c index da3e7ec17e..e602edc4be 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1555,6 +1555,7 @@ int cmd_main(int argc, const char **argv) } if (all_msgs.len == 0) { + strbuf_release(&all_msgs); fprintf(stderr, "nothing to send\n"); ret = 1; goto out; diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh index 557808ffa7..990a036582 100755 --- a/t/t1517-outside-repo.sh +++ b/t/t1517-outside-repo.sh @@ -56,4 +56,56 @@ test_expect_success 'grep outside repository' ' test_cmp expect actual ' +test_expect_success 'imap-send outside repository' ' + test_config_global imap.host imaps://localhost && + test_config_global imap.folder Drafts && + + echo nothing to send >expect && + test_must_fail git imap-send -v </dev/null 2>actual && + test_cmp expect actual && + + ( + cd non-repo && + test_must_fail git imap-send -v </dev/null 2>../actual + ) && + test_cmp expect actual +' + +test_expect_success 'check-ref-format outside repository' ' + git check-ref-format --branch refs/heads/xyzzy >expect && + nongit git check-ref-format --branch refs/heads/xyzzy >actual && + test_cmp expect actual +' + +test_expect_success 'diff outside repository' ' + echo one >one && + echo two >two && + test_must_fail git diff --no-index one two >expect.raw && + ( + cd non-repo && + cp ../one . && + cp ../two . && + test_must_fail git diff one two >../actual.raw + ) && + # outside repository diff falls back to SHA-1 but + # GIT_DEFAULT_HASH may be set to sha256 on the in-repo side. + sed -e "/^index /d" expect.raw >expect && + sed -e "/^index /d" actual.raw >actual && + test_cmp expect actual +' + +test_expect_success 'stripspace outside repository' ' + nongit git stripspace -s </dev/null +' + +test_expect_success 'remote-http outside repository' ' + test_must_fail git remote-http 2>actual && + test_grep "^error: remote-curl" actual && + ( + cd non-repo && + test_must_fail git remote-http 2>../actual + ) && + test_grep "^error: remote-curl" actual +' + test_done |
