summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/helper/test-chmtime.c2
-rw-r--r--t/helper/test-config.c2
-rw-r--r--t/helper/test-ctype.c2
-rw-r--r--t/helper/test-date.c14
-rw-r--r--t/helper/test-delta.c2
-rw-r--r--t/helper/test-dump-cache-tree.c2
-rw-r--r--t/helper/test-dump-split-index.c2
-rw-r--r--t/helper/test-dump-untracked-cache.c2
-rw-r--r--t/helper/test-fake-ssh.c2
-rw-r--r--t/helper/test-genrandom.c2
-rw-r--r--t/helper/test-hashmap.c2
-rw-r--r--t/helper/test-index-version.c2
-rw-r--r--t/helper/test-line-buffer.c2
-rw-r--r--t/helper/test-match-trees.c2
-rw-r--r--t/helper/test-mergesort.c2
-rw-r--r--t/helper/test-mktemp.c2
-rw-r--r--t/helper/test-parse-options.c2
-rw-r--r--t/helper/test-path-utils.c4
-rw-r--r--t/helper/test-prio-queue.c2
-rw-r--r--t/helper/test-read-cache.c2
-rw-r--r--t/helper/test-regex.c59
-rw-r--r--t/helper/test-revision-walking.c2
-rw-r--r--t/helper/test-run-command.c2
-rw-r--r--t/helper/test-scrap-cache-tree.c2
-rw-r--r--t/helper/test-sha1-array.c2
-rw-r--r--t/helper/test-sha1.c2
-rw-r--r--t/helper/test-sigchain.c2
-rw-r--r--t/helper/test-string-list.c2
-rw-r--r--t/helper/test-submodule-config.c8
-rw-r--r--t/helper/test-subprocess.c2
-rw-r--r--t/helper/test-svn-fe.c4
-rw-r--r--t/helper/test-urlmatch-normalization.c2
-rw-r--r--t/helper/test-wildmatch.c2
-rw-r--r--t/lib-git-daemon.sh3
-rw-r--r--t/lib-rebase.sh1
-rw-r--r--t/perf/README12
-rwxr-xr-xt/perf/p4211-line-log.sh6
-rw-r--r--t/perf/perf-lib.sh5
-rwxr-xr-xt/t0005-signals.sh17
-rwxr-xr-xt/t0006-date.sh6
-rwxr-xr-xt/t0008-ignores.sh4
-rwxr-xr-xt/t0070-fundamental.sh2
-rwxr-xr-xt/t1011-read-tree-sparse-checkout.sh4
-rwxr-xr-xt/t1300-repo-config.sh8
-rwxr-xr-xt/t1307-config-blob.sh5
-rwxr-xr-xt/t1308-config-set.sh14
-rwxr-xr-xt/t1400-update-ref.sh2
-rwxr-xr-xt/t1506-rev-parse-diagnosis.sh2
-rwxr-xr-xt/t2010-checkout-ambiguous.sh2
-rwxr-xr-xt/t2018-checkout-branch.sh2
-rwxr-xr-xt/t3200-branch.sh6
-rwxr-xr-xt/t3201-branch-contains.sh2
-rwxr-xr-xt/t3310-notes-merge-manual-resolve.sh8
-rwxr-xr-xt/t3320-notes-merge-worktrees.sh4
-rwxr-xr-xt/t3400-rebase.sh4
-rwxr-xr-xt/t3404-rebase-interactive.sh20
-rwxr-xr-xt/t3420-rebase-autostash.sh31
-rwxr-xr-xt/t3427-rebase-subtree.sh119
-rwxr-xr-xt/t4026-color.sh9
-rwxr-xr-xt/t4153-am-resume-override-opts.sh2
-rwxr-xr-xt/t4201-shortlog.sh6
-rwxr-xr-xt/t4202-log.sh32
-rwxr-xr-xt/t4208-log-magic-pathspec.sh4
-rwxr-xr-xt/t4211-line-log.sh7
-rwxr-xr-xt/t5000-tar-tree.sh74
-rw-r--r--t/t5000/19f9c8273ec45a8938e6999cb59b3ff66739902abin0 -> 2048 bytes
-rw-r--r--t/t5000/huge-and-future.tarbin0 -> 2048 bytes
-rwxr-xr-xt/t5505-remote.sh2
-rwxr-xr-xt/t5510-fetch.sh32
-rwxr-xr-xt/t5520-pull.sh2
-rwxr-xr-xt/t5523-push-upstream.sh12
-rwxr-xr-xt/t5536-fetch-conflicts.sh4
-rwxr-xr-xt/t5541-http-push-smart.sh12
-rwxr-xr-xt/t6030-bisect-porcelain.sh26
-rwxr-xr-xt/t6301-for-each-ref-errors.sh10
-rwxr-xr-xt/t7063-status-untracked-cache.sh2
-rwxr-xr-xt/t7102-reset.sh4
-rwxr-xr-xt/t7201-co.sh2
-rwxr-xr-xt/t7400-submodule-basic.sh2
-rwxr-xr-xt/t7403-submodule-sync.sh4
-rwxr-xr-xt/t7406-submodule-update.sh10
-rwxr-xr-xt/t7508-status.sh4
-rwxr-xr-xt/t7510-signed-commit.sh7
-rwxr-xr-xt/t7607-merge-overwrite.sh4
-rwxr-xr-xt/t7609-merge-co-error-msgs.sh10
-rwxr-xr-xt/t7610-mergetool.sh7
-rwxr-xr-xt/t7810-grep.sh60
-rwxr-xr-xt/t7812-grep-icase-non-ascii.sh71
-rwxr-xr-xt/t7813-grep-icase-iso.sh19
-rwxr-xr-xt/t8008-blame-formats.sh17
-rwxr-xr-xt/t9003-help-autocorrect.sh4
-rwxr-xr-xt/t9300-fast-import.sh23
-rw-r--r--t/test-lib-functions.sh31
-rw-r--r--t/test-lib.sh9
94 files changed, 764 insertions, 194 deletions
diff --git a/t/helper/test-chmtime.c b/t/helper/test-chmtime.c
index dfe8a83..e760256 100644
--- a/t/helper/test-chmtime.c
+++ b/t/helper/test-chmtime.c
@@ -56,7 +56,7 @@ static int timespec_arg(const char *arg, long int *set_time, int *set_eq)
return 1;
}
-int main(int argc, char *argv[])
+int cmd_main(int argc, const char **argv)
{
static int verbose;
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 509aeef..3c6d08c 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -66,7 +66,7 @@ static int iterate_cb(const char *var, const char *value, void *data)
return 0;
}
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
int i, val;
const char *v;
diff --git a/t/helper/test-ctype.c b/t/helper/test-ctype.c
index 707a821..bb72c47 100644
--- a/t/helper/test-ctype.c
+++ b/t/helper/test-ctype.c
@@ -28,7 +28,7 @@ static int is_in(const char *s, int ch)
#define LOWER "abcdefghijklmnopqrstuvwxyz"
#define UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
TEST_CLASS(isdigit, DIGIT);
TEST_CLASS(isspace, " \n\r\t");
diff --git a/t/helper/test-date.c b/t/helper/test-date.c
index d9ab360..506054b 100644
--- a/t/helper/test-date.c
+++ b/t/helper/test-date.c
@@ -6,7 +6,7 @@ static const char *usage_msg = "\n"
" test-date parse [date]...\n"
" test-date approxidate [date]...\n";
-static void show_relative_dates(char **argv, struct timeval *now)
+static void show_relative_dates(const char **argv, struct timeval *now)
{
struct strbuf buf = STRBUF_INIT;
@@ -18,13 +18,13 @@ static void show_relative_dates(char **argv, struct timeval *now)
strbuf_release(&buf);
}
-static void show_dates(char **argv, const char *format)
+static void show_dates(const char **argv, const char *format)
{
struct date_mode mode;
parse_date_format(format, &mode);
for (; *argv; argv++) {
- char *arg = *argv;
+ char *arg;
time_t t;
int tz;
@@ -32,7 +32,7 @@ static void show_dates(char **argv, const char *format)
* Do not use our normal timestamp parsing here, as the point
* is to test the formatting code in isolation.
*/
- t = strtol(arg, &arg, 10);
+ t = strtol(*argv, &arg, 10);
while (*arg == ' ')
arg++;
tz = atoi(arg);
@@ -41,7 +41,7 @@ static void show_dates(char **argv, const char *format)
}
}
-static void parse_dates(char **argv, struct timeval *now)
+static void parse_dates(const char **argv, struct timeval *now)
{
struct strbuf result = STRBUF_INIT;
@@ -60,7 +60,7 @@ static void parse_dates(char **argv, struct timeval *now)
strbuf_release(&result);
}
-static void parse_approxidate(char **argv, struct timeval *now)
+static void parse_approxidate(const char **argv, struct timeval *now)
{
for (; *argv; argv++) {
time_t t;
@@ -69,7 +69,7 @@ static void parse_approxidate(char **argv, struct timeval *now)
}
}
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
struct timeval now;
const char *x;
diff --git a/t/helper/test-delta.c b/t/helper/test-delta.c
index 4595cd6..59937dc 100644
--- a/t/helper/test-delta.c
+++ b/t/helper/test-delta.c
@@ -15,7 +15,7 @@
static const char usage_str[] =
"test-delta (-d|-p) <from_file> <data_file> <out_file>";
-int main(int argc, char *argv[])
+int cmd_main(int argc, const char **argv)
{
int fd;
struct stat st;
diff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c
index bb53c0a..44f3290 100644
--- a/t/helper/test-dump-cache-tree.c
+++ b/t/helper/test-dump-cache-tree.c
@@ -54,7 +54,7 @@ static int dump_cache_tree(struct cache_tree *it,
return errs;
}
-int main(int ac, char **av)
+int cmd_main(int ac, const char **av)
{
struct index_state istate;
struct cache_tree *another = cache_tree();
diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c
index 861d28c..d168924 100644
--- a/t/helper/test-dump-split-index.c
+++ b/t/helper/test-dump-split-index.c
@@ -7,7 +7,7 @@ static void show_bit(size_t pos, void *data)
printf(" %d", (int)pos);
}
-int main(int ac, char **av)
+int cmd_main(int ac, const char **av)
{
struct split_index *si;
int i;
diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
index 0a1c285..50112cc 100644
--- a/t/helper/test-dump-untracked-cache.c
+++ b/t/helper/test-dump-untracked-cache.c
@@ -40,7 +40,7 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
strbuf_setlen(base, len);
}
-int main(int ac, char **av)
+int cmd_main(int ac, const char **av)
{
struct untracked_cache *uc;
struct strbuf base = STRBUF_INIT;
diff --git a/t/helper/test-fake-ssh.c b/t/helper/test-fake-ssh.c
index 980de21..12beee9 100644
--- a/t/helper/test-fake-ssh.c
+++ b/t/helper/test-fake-ssh.c
@@ -2,7 +2,7 @@
#include "run-command.h"
#include "strbuf.h"
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
const char *trash_directory = getenv("TRASH_DIRECTORY");
struct strbuf buf = STRBUF_INIT;
diff --git a/t/helper/test-genrandom.c b/t/helper/test-genrandom.c
index 54824d0..8d11d22 100644
--- a/t/helper/test-genrandom.c
+++ b/t/helper/test-genrandom.c
@@ -6,7 +6,7 @@
#include "git-compat-util.h"
-int main(int argc, char *argv[])
+int cmd_main(int argc, const char **argv)
{
unsigned long count, next = 0;
unsigned char *c;
diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c
index cc2891d..7aa9440 100644
--- a/t/helper/test-hashmap.c
+++ b/t/helper/test-hashmap.c
@@ -138,7 +138,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
*
* perfhashmap method rounds -> test hashmap.[ch] performance
*/
-int main(int argc, char *argv[])
+int cmd_main(int argc, const char **argv)
{
char line[1024];
struct hashmap map;
diff --git a/t/helper/test-index-version.c b/t/helper/test-index-version.c
index 05d4699..f569f6b 100644
--- a/t/helper/test-index-version.c
+++ b/t/helper/test-index-version.c
@@ -1,6 +1,6 @@
#include "cache.h"
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
struct cache_header hdr;
int version;
diff --git a/t/helper/test-line-buffer.c b/t/helper/test-line-buffer.c
index 1e58f04..81575fe 100644
--- a/t/helper/test-line-buffer.c
+++ b/t/helper/test-line-buffer.c
@@ -50,7 +50,7 @@ static void handle_line(const char *line, struct line_buffer *stdin_buf)
handle_command(line, arg + 1, stdin_buf);
}
-int main(int argc, char *argv[])
+int cmd_main(int argc, const char **argv)
{
struct line_buffer stdin_buf = LINE_BUFFER_INIT;
struct line_buffer file_buf = LINE_BUFFER_INIT;
diff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c
index d446b8e..e939502 100644
--- a/t/helper/test-match-trees.c
+++ b/t/helper/test-match-trees.c
@@ -1,7 +1,7 @@
#include "cache.h"
#include "tree.h"
-int main(int ac, char **av)
+int cmd_main(int ac, const char **av)
{
struct object_id hash1, hash2, shifted;
struct tree *one, *two;
diff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c
index ea3b959..335cf6b 100644
--- a/t/helper/test-mergesort.c
+++ b/t/helper/test-mergesort.c
@@ -22,7 +22,7 @@ static int compare_strings(const void *a, const void *b)
return strcmp(x->text, y->text);
}
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
struct line *line, *p = NULL, *lines = NULL;
struct strbuf sb = STRBUF_INIT;
diff --git a/t/helper/test-mktemp.c b/t/helper/test-mktemp.c
index c8c5421..89d9b2f 100644
--- a/t/helper/test-mktemp.c
+++ b/t/helper/test-mktemp.c
@@ -3,7 +3,7 @@
*/
#include "git-compat-util.h"
-int main(int argc, char *argv[])
+int cmd_main(int argc, const char **argv)
{
if (argc != 2)
usage("Expected 1 parameter defining the temporary file template");
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c
index 2c63298..a01430c 100644
--- a/t/helper/test-parse-options.c
+++ b/t/helper/test-parse-options.c
@@ -94,7 +94,7 @@ static void show(struct string_list *expect, int *status, const char *fmt, ...)
strbuf_release(&buf);
}
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
const char *prefix = "prefix/";
const char *usage[] = {
diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c
index ba805b3..1ebe0f7 100644
--- a/t/helper/test-path-utils.c
+++ b/t/helper/test-path-utils.c
@@ -156,7 +156,7 @@ static struct test_data dirname_data[] = {
{ NULL, NULL }
};
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
if (argc == 3 && !strcmp(argv[1], "normalize_path_copy")) {
char *buf = xmallocz(strlen(argv[2]));
@@ -213,7 +213,7 @@ int main(int argc, char **argv)
}
if (argc >= 4 && !strcmp(argv[1], "prefix_path")) {
- char *prefix = argv[2];
+ const char *prefix = argv[2];
int prefix_len = strlen(prefix);
int nongit_ok;
setup_git_directory_gently(&nongit_ok);
diff --git a/t/helper/test-prio-queue.c b/t/helper/test-prio-queue.c
index 7be72f0..ae58fff 100644
--- a/t/helper/test-prio-queue.c
+++ b/t/helper/test-prio-queue.c
@@ -16,7 +16,7 @@ static void show(int *v)
free(v);
}
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
struct prio_queue pq = { intcmp };
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index b25bcf1..2a7990e 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -1,6 +1,6 @@
#include "cache.h"
-int main (int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
int i, cnt = 1;
if (argc == 2)
diff --git a/t/helper/test-regex.c b/t/helper/test-regex.c
index 0dc598e..b5ea8a9 100644
--- a/t/helper/test-regex.c
+++ b/t/helper/test-regex.c
@@ -1,6 +1,23 @@
#include "git-compat-util.h"
+#include "gettext.h"
-int main(int argc, char **argv)
+struct reg_flag {
+ const char *name;
+ int flag;
+};
+
+static struct reg_flag reg_flags[] = {
+ { "EXTENDED", REG_EXTENDED },
+ { "NEWLINE", REG_NEWLINE },
+ { "ICASE", REG_ICASE },
+ { "NOTBOL", REG_NOTBOL },
+#ifdef REG_STARTEND
+ { "STARTEND", REG_STARTEND },
+#endif
+ { NULL, 0 }
+};
+
+static int test_regex_bug(void)
{
char *pat = "[^={} \t]+";
char *str = "={}\nfred";
@@ -16,5 +33,43 @@ int main(int argc, char **argv)
if (m[0].rm_so == 3) /* matches '\n' when it should not */
die("regex bug confirmed: re-build git with NO_REGEX=1");
- exit(0);
+ return 0;
+}
+
+int cmd_main(int argc, const char **argv)
+{
+ const char *pat;
+ const char *str;
+ int flags = 0;
+ regex_t r;
+ regmatch_t m[1];
+
+ if (argc == 2 && !strcmp(argv[1], "--bug"))
+ return test_regex_bug();
+ else if (argc < 3)
+ usage("test-regex --bug\n"
+ "test-regex <pattern> <string> [<options>]");
+
+ argv++;
+ pat = *argv++;
+ str = *argv++;
+ while (*argv) {
+ struct reg_flag *rf;
+ for (rf = reg_flags; rf->name; rf++)
+ if (!strcmp(*argv, rf->name)) {
+ flags |= rf->flag;
+ break;
+ }
+ if (!rf->name)
+ die("do not recognize %s", *argv);
+ argv++;
+ }
+ git_setup_gettext();
+
+ if (regcomp(&r, pat, flags))
+ die("failed regcomp() for pattern '%s'", pat);
+ if (regexec(&r, str, 1, m, 0))
+ return 1;
+
+ return 0;
}
diff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c
index 3d03133..b8e6fe1 100644
--- a/t/helper/test-revision-walking.c
+++ b/t/helper/test-revision-walking.c
@@ -45,7 +45,7 @@ static int run_revision_walk(void)
return got_revision;
}
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
if (argc < 2)
return 1;
diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c
index 30a64a9..c71ea4f 100644
--- a/t/helper/test-run-command.c
+++ b/t/helper/test-run-command.c
@@ -49,7 +49,7 @@ static int task_finished(int result,
return 1;
}
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
struct child_process proc = CHILD_PROCESS_INIT;
int jobs;
diff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c
index 6efee31..5b2fd09 100644
--- a/t/helper/test-scrap-cache-tree.c
+++ b/t/helper/test-scrap-cache-tree.c
@@ -5,7 +5,7 @@
static struct lock_file index_lock;
-int main(int ac, char **av)
+int cmd_main(int ac, const char **av)
{
hold_locked_index(&index_lock, 1);
if (read_cache() < 0)
diff --git a/t/helper/test-sha1-array.c b/t/helper/test-sha1-array.c
index 60ea1d5..09f7790 100644
--- a/t/helper/test-sha1-array.c
+++ b/t/helper/test-sha1-array.c
@@ -6,7 +6,7 @@ static void print_sha1(const unsigned char sha1[20], void *data)
puts(sha1_to_hex(sha1));
}
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
struct sha1_array array = SHA1_ARRAY_INIT;
struct strbuf line = STRBUF_INIT;
diff --git a/t/helper/test-sha1.c b/t/helper/test-sha1.c
index e57eae1..a1c13f5 100644
--- a/t/helper/test-sha1.c
+++ b/t/helper/test-sha1.c
@@ -1,6 +1,6 @@
#include "cache.h"
-int main(int ac, char **av)
+int cmd_main(int ac, const char **av)
{
git_SHA_CTX ctx;
unsigned char sha1[20];
diff --git a/t/helper/test-sigchain.c b/t/helper/test-sigchain.c
index e499fce..b71edbd 100644
--- a/t/helper/test-sigchain.c
+++ b/t/helper/test-sigchain.c
@@ -13,7 +13,7 @@ X(two)
X(three)
#undef X
-int main(int argc, char **argv) {
+int cmd_main(int argc, const char **argv) {
sigchain_push(SIGTERM, one);
sigchain_push(SIGTERM, two);
sigchain_push(SIGTERM, three);
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c
index 14bdf9d..4a68967 100644
--- a/t/helper/test-string-list.c
+++ b/t/helper/test-string-list.c
@@ -41,7 +41,7 @@ static int prefix_cb(struct string_list_item *item, void *cb_data)
return starts_with(item->string, prefix);
}
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
if (argc == 5 && !strcmp(argv[1], "split")) {
struct string_list list = STRING_LIST_INIT_DUP;
diff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c
index dab8c27..61049b8 100644
--- a/t/helper/test-submodule-config.c
+++ b/t/helper/test-submodule-config.c
@@ -2,7 +2,7 @@
#include "submodule-config.h"
#include "submodule.h"
-static void die_usage(int argc, char **argv, const char *msg)
+static void die_usage(int argc, const char **argv, const char *msg)
{
fprintf(stderr, "%s\n", msg);
fprintf(stderr, "Usage: %s [<commit> <submodulepath>] ...\n", argv[0]);
@@ -14,9 +14,9 @@ static int git_test_config(const char *var, const char *value, void *cb)
return parse_submodule_config_option(var, value);
}
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
- char **arg = argv;
+ const char **arg = argv;
int my_argc = argc;
int output_url = 0;
int lookup_name = 0;
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
path_or_name = arg[1];
if (commit[0] == '\0')
- hashcpy(commit_sha1, null_sha1);
+ hashclr(commit_sha1);
else if (get_sha1(commit, commit_sha1) < 0)
die_usage(argc, argv, "Commit not found.");
diff --git a/t/helper/test-subprocess.c b/t/helper/test-subprocess.c
index 56881a0..30c5765 100644
--- a/t/helper/test-subprocess.c
+++ b/t/helper/test-subprocess.c
@@ -1,7 +1,7 @@
#include "cache.h"
#include "run-command.h"
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
struct child_process cp = CHILD_PROCESS_INIT;
int nogit = 0;
diff --git a/t/helper/test-svn-fe.c b/t/helper/test-svn-fe.c
index 120ec96..7667c08 100644
--- a/t/helper/test-svn-fe.c
+++ b/t/helper/test-svn-fe.c
@@ -11,7 +11,7 @@
static const char test_svnfe_usage[] =
"test-svn-fe (<dumpfile> | [-d] <preimage> <delta> <len>)";
-static int apply_delta(int argc, char *argv[])
+static int apply_delta(int argc, const char **argv)
{
struct line_buffer preimage = LINE_BUFFER_INIT;
struct line_buffer delta = LINE_BUFFER_INIT;
@@ -35,7 +35,7 @@ static int apply_delta(int argc, char *argv[])
return 0;
}
-int main(int argc, char *argv[])
+int cmd_main(int argc, const char **argv)
{
if (argc == 2) {
if (svndump_init(argv[1]))
diff --git a/t/helper/test-urlmatch-normalization.c b/t/helper/test-urlmatch-normalization.c
index 090bf21..49b6e83 100644
--- a/t/helper/test-urlmatch-normalization.c
+++ b/t/helper/test-urlmatch-normalization.c
@@ -1,7 +1,7 @@
#include "git-compat-util.h"
#include "urlmatch.h"
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
const char usage[] = "test-urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
char *url1, *url2;
diff --git a/t/helper/test-wildmatch.c b/t/helper/test-wildmatch.c
index 578b164..52be876 100644
--- a/t/helper/test-wildmatch.c
+++ b/t/helper/test-wildmatch.c
@@ -1,6 +1,6 @@
#include "cache.h"
-int main(int argc, char **argv)
+int cmd_main(int argc, const char **argv)
{
int i;
for (i = 2; i < argc; i++) {
diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
index 340534c..f9cbd47 100644
--- a/t/lib-git-daemon.sh
+++ b/t/lib-git-daemon.sh
@@ -82,8 +82,7 @@ stop_git_daemon() {
kill "$GIT_DAEMON_PID"
wait "$GIT_DAEMON_PID" >&3 2>&4
ret=$?
- # expect exit with status 143 = 128+15 for signal TERM=15
- if test $ret -ne 143
+ if test_match_signal 15 $?
then
error "git daemon exited with status: $ret"
fi
diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index 9a96e15..25a77ee 100644
--- a/t/lib-rebase.sh
+++ b/t/lib-rebase.sh
@@ -29,6 +29,7 @@ set_fake_editor () {
*/COMMIT_EDITMSG)
test -z "$EXPECT_HEADER_COUNT" ||
test "$EXPECT_HEADER_COUNT" = "$(sed -n '1s/^# This is a combination of \(.*\) commits\./\1/p' < "$1")" ||
+ test "# # GETTEXT POISON #" = "$(sed -n '1p' < "$1")" ||
exit
test -z "$FAKE_COMMIT_MESSAGE" || echo "$FAKE_COMMIT_MESSAGE" > "$1"
test -z "$FAKE_COMMIT_AMEND" || echo "$FAKE_COMMIT_AMEND" >> "$1"
diff --git a/t/perf/README b/t/perf/README
index 8848c14..49ea434 100644
--- a/t/perf/README
+++ b/t/perf/README
@@ -115,8 +115,16 @@ After that you will want to use some of the following:
At least one of the first two is required!
-You can use test_expect_success as usual. For actual performance
-tests, use
+You can use test_expect_success as usual. In both test_expect_success
+and in test_perf, running "git" points to the version that is being
+perf-tested. The $MODERN_GIT variable points to the git wrapper for the
+currently checked-out version (i.e., the one that matches the t/perf
+scripts you are running). This is useful if your setup uses commands
+that only work with newer versions of git than what you might want to
+test (but obviously your new commands must still create a state that can
+be used by the older version of git you are testing).
+
+For actual performance tests, use
test_perf 'descriptive string' '
command1 &&
diff --git a/t/perf/p4211-line-log.sh b/t/perf/p4211-line-log.sh
index 3d074b0..b7ff68d 100755
--- a/t/perf/p4211-line-log.sh
+++ b/t/perf/p4211-line-log.sh
@@ -23,11 +23,11 @@ test_perf 'git log --follow (baseline for -M)' '
git log --oneline --follow -- "$file" >/dev/null
'
-test_perf 'git log -L' '
- git log -L 1:"$file" >/dev/null
+test_perf 'git log -L (renames off)' '
+ git log --no-renames -L 1:"$file" >/dev/null
'
-test_perf 'git log -M -L' '
+test_perf 'git log -L (renames on)' '
git log -M -L 1:"$file" >/dev/null
'
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index 773f955..46f08ee 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -52,6 +52,9 @@ TEST_NO_MALLOC_CHECK=t
# need to export them for test_perf subshells
export TEST_DIRECTORY TRASH_DIRECTORY GIT_BUILD_DIR GIT_TEST_CMP
+MODERN_GIT=$GIT_BUILD_DIR/bin-wrappers/git
+export MODERN_GIT
+
perf_results_dir=$TEST_OUTPUT_DIRECTORY/test-results
mkdir -p "$perf_results_dir"
rm -f "$perf_results_dir"/$(basename "$0" .sh).subtests
@@ -81,7 +84,7 @@ test_perf_create_repo_from () {
repo="$1"
source="$2"
source_git="$(git -C "$source" rev-parse --git-dir)"
- objects_dir="$(git -C "$source" rev-parse --git-path objects)"
+ objects_dir="$("$MODERN_GIT" -C "$source" rev-parse --git-path objects)"
mkdir -p "$repo/.git"
(
cd "$source" &&
diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
index e7f27eb..46042f1 100755
--- a/t/t0005-signals.sh
+++ b/t/t0005-signals.sh
@@ -11,12 +11,13 @@ EOF
test_expect_success 'sigchain works' '
{ test-sigchain >actual; ret=$?; } &&
- case "$ret" in
- 143) true ;; # POSIX w/ SIGTERM=15
- 271) true ;; # ksh w/ SIGTERM=15
- 3) true ;; # Windows
- *) false ;;
- esac &&
+ {
+ # Signal death by raise() on Windows acts like exit(3),
+ # regardless of the signal number. So we must allow that
+ # as well as the normal signal check.
+ test_match_signal 15 "$ret" ||
+ test "$ret" = 3
+ } &&
test_cmp expect actual
'
@@ -41,12 +42,12 @@ test_expect_success 'create blob' '
test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '
OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
- test "$OUT" -eq 141
+ test_match_signal 13 "$OUT"
'
test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '
OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 ) &&
- test "$OUT" -eq 141
+ test_match_signal 13 "$OUT"
'
test_done
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index 04ce535..4c8cf58 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -31,7 +31,7 @@ check_show () {
format=$1
time=$2
expect=$3
- test_expect_${4:-success} "show date ($format:$time)" '
+ test_expect_success $4 "show date ($format:$time)" '
echo "$time -> $expect" >expect &&
test-date show:$format "$time" >actual &&
test_cmp expect actual
@@ -50,8 +50,8 @@ check_show iso-local "$TIME" '2016-06-15 14:13:20 +0000'
# arbitrary time absurdly far in the future
FUTURE="5758122296 -0400"
-check_show iso "$FUTURE" "2152-06-19 18:24:56 -0400"
-check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000"
+check_show iso "$FUTURE" "2152-06-19 18:24:56 -0400" LONG_IS_64BIT
+check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" LONG_IS_64BIT
check_parse() {
echo "$1 -> $2" >expect
diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
index b425f3a..d27f438 100755
--- a/t/t0008-ignores.sh
+++ b/t/t0008-ignores.sh
@@ -34,7 +34,7 @@ expect_from_stdin () {
test_stderr () {
expected="$1"
expect_in stderr "$1" &&
- test_cmp "$HOME/expected-stderr" "$HOME/stderr"
+ test_i18ncmp "$HOME/expected-stderr" "$HOME/stderr"
}
broken_c_unquote () {
@@ -47,7 +47,7 @@ broken_c_unquote_verbose () {
stderr_contains () {
regexp="$1"
- if grep "$regexp" "$HOME/stderr"
+ if test_i18ngrep "$regexp" "$HOME/stderr"
then
return 0
else
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
index 5ed69a6..991ed2a 100755
--- a/t/t0070-fundamental.sh
+++ b/t/t0070-fundamental.sh
@@ -31,7 +31,7 @@ test_expect_success 'git_mkstemps_mode does not fail if fd 0 is not open' '
test_expect_success 'check for a bug in the regex routines' '
# if this test fails, re-build git with NO_REGEX=1
- test-regex
+ test-regex --bug
'
test_done
diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index 0c74bee..e5fa235 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -244,10 +244,10 @@ test_expect_success 'print errors when failed to update worktree' '
error: The following untracked working tree files would be overwritten by checkout:
sub/added
sub/addedtoo
-Please move or remove them before you can switch branches.
+Please move or remove them before you switch branches.
Aborting
EOF
- test_cmp expected actual
+ test_i18ncmp expected actual
'
test_expect_success 'checkout without --ignore-skip-worktree-bits' '
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index d934a24..923bfc5 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -886,7 +886,7 @@ test_expect_success !MINGW 'get --path copes with unset $HOME' '
git config --get --path path.normal >>result &&
git config --get --path path.trailingtilde >>result
) &&
- grep "[Ff]ailed to expand.*~/" msg &&
+ test_i18ngrep "[Ff]ailed to expand.*~/" msg &&
test_cmp expect result
'
@@ -1126,7 +1126,7 @@ test_expect_success 'barf on syntax error' '
key garbage
EOF
test_must_fail git config --get section.key >actual 2>error &&
- grep " line 3 " error
+ test_i18ngrep " line 3 " error
'
test_expect_success 'barf on incomplete section header' '
@@ -1136,7 +1136,7 @@ test_expect_success 'barf on incomplete section header' '
key = value
EOF
test_must_fail git config --get section.key >actual 2>error &&
- grep " line 2 " error
+ test_i18ngrep " line 2 " error
'
test_expect_success 'barf on incomplete string' '
@@ -1146,7 +1146,7 @@ test_expect_success 'barf on incomplete string' '
key = "value string
EOF
test_must_fail git config --get section.key >actual 2>error &&
- grep " line 3 " error
+ test_i18ngrep " line 3 " error
'
test_expect_success 'urlmatch' '
diff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh
index 3c6791e..eed31ff 100755
--- a/t/t1307-config-blob.sh
+++ b/t/t1307-config-blob.sh
@@ -61,10 +61,7 @@ test_expect_success 'parse errors in blobs are properly attributed' '
git commit -m broken &&
test_must_fail git config --blob=HEAD:config some.value 2>err &&
-
- # just grep for our token as the exact error message is likely to
- # change or be internationalized
- grep "HEAD:config" err
+ test_i18ngrep "HEAD:config" err
'
test_expect_success 'can parse blob ending with CR' '
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index cf716b4..7655c94 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -197,14 +197,14 @@ test_expect_success 'proper error on error in default config files' '
echo "[" >>.git/config &&
echo "fatal: bad config line 34 in file .git/config" >expect &&
test_expect_code 128 test-config get_value foo.bar 2>actual &&
- test_cmp expect actual
+ test_i18ncmp expect actual
'
test_expect_success 'proper error on error in custom config files' '
echo "[" >>syntax-error &&
echo "fatal: bad config line 1 in file syntax-error" >expect &&
test_expect_code 128 test-config configset_get_value foo.bar syntax-error 2>actual &&
- test_cmp expect actual
+ test_i18ncmp expect actual
'
test_expect_success 'check line errors for malformed values' '
@@ -233,11 +233,19 @@ cmdline_config="'foo.bar=from-cmdline'"
test_expect_success 'iteration shows correct origins' '
echo "[foo]bar = from-repo" >.git/config &&
echo "[foo]bar = from-home" >.gitconfig &&
+ if test_have_prereq MINGW
+ then
+ # Use Windows path (i.e. *not* $HOME)
+ HOME_GITCONFIG=$(pwd)/.gitconfig
+ else
+ # Do not get fooled by symbolic links, i.e. $HOME != $(pwd)
+ HOME_GITCONFIG=$HOME/.gitconfig
+ fi &&
cat >expect <<-EOF &&
key=foo.bar
value=from-home
origin=file
- name=$HOME/.gitconfig
+ name=$HOME_GITCONFIG
scope=global
key=foo.bar
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index af1b20d..75fa654 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -361,7 +361,7 @@ test_expect_success 'stdin test setup' '
test_expect_success '-z fails without --stdin' '
test_must_fail git update-ref -z $m $m $m 2>err &&
- grep "usage: git update-ref" err
+ test_i18ngrep "usage: git update-ref" err
'
test_expect_success 'stdin works with no input' '
diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh
index 86c2ff2..79a0251 100755
--- a/t/t1506-rev-parse-diagnosis.sh
+++ b/t/t1506-rev-parse-diagnosis.sh
@@ -106,7 +106,7 @@ test_expect_success 'incorrect revision id' '
test_must_fail git rev-parse foobar:file.txt 2>error &&
grep "Invalid object name '"'"'foobar'"'"'." error &&
test_must_fail git rev-parse foobar 2> error &&
- grep "unknown revision or path not in the working tree." error
+ test_i18ngrep "unknown revision or path not in the working tree." error
'
test_expect_success 'incorrect file in sha1:path' '
diff --git a/t/t2010-checkout-ambiguous.sh b/t/t2010-checkout-ambiguous.sh
index 87bdf9c..e76e84a 100755
--- a/t/t2010-checkout-ambiguous.sh
+++ b/t/t2010-checkout-ambiguous.sh
@@ -49,7 +49,7 @@ test_expect_success 'disambiguate checking out from a tree-ish' '
test_expect_success 'accurate error message with more than one ref' '
test_must_fail git checkout HEAD master -- 2>actual &&
- grep 2 actual &&
+ test_i18ngrep 2 actual &&
test_i18ngrep "one reference expected, 2 given" actual
'
diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh
index 2741262..2131fb2 100755
--- a/t/t2018-checkout-branch.sh
+++ b/t/t2018-checkout-branch.sh
@@ -124,7 +124,7 @@ test_expect_success 'checkout -b to @{-1} fails with the right branch name' '
git checkout branch2 &&
echo >expect "fatal: A branch named '\''branch1'\'' already exists." &&
test_must_fail git checkout -b @{-1} 2>actual &&
- test_cmp expect actual
+ test_i18ncmp expect actual
'
test_expect_success 'checkout -B to an existing branch resets branch to HEAD' '
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index f3e3b6c..ac9c764 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -550,7 +550,7 @@ If you wanted to make '"'master'"' track '"'origin/master'"', do this:
git branch -d origin/master
git branch --set-upstream-to origin/master
EOF
- test_cmp expected actual
+ test_i18ncmp expected actual
'
test_expect_success '--set-upstream with two args only shows the deprecation message' '
@@ -559,7 +559,7 @@ test_expect_success '--set-upstream with two args only shows the deprecation mes
cat >expected <<EOF &&
The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to
EOF
- test_cmp expected actual
+ test_i18ncmp expected actual
'
test_expect_success '--set-upstream with one arg only shows the deprecation message if the branch existed' '
@@ -568,7 +568,7 @@ test_expect_success '--set-upstream with one arg only shows the deprecation mess
cat >expected <<EOF &&
The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to
EOF
- test_cmp expected actual
+ test_i18ncmp expected actual
'
test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '
diff --git a/t/t3201-branch-contains.sh b/t/t3201-branch-contains.sh
index 912a663..7f3ec47 100755
--- a/t/t3201-branch-contains.sh
+++ b/t/t3201-branch-contains.sh
@@ -156,7 +156,7 @@ test_expect_success 'branch --merged with --verbose' '
* topic 2c939f4 [ahead 1] foo
zzz c77a0a9 second on master
EOF
- test_cmp expect actual
+ test_i18ncmp expect actual
'
test_done
diff --git a/t/t3310-notes-merge-manual-resolve.sh b/t/t3310-notes-merge-manual-resolve.sh
index d557212..6967436 100755
--- a/t/t3310-notes-merge-manual-resolve.sh
+++ b/t/t3310-notes-merge-manual-resolve.sh
@@ -178,7 +178,7 @@ test_expect_success 'merge z into m (== y) with default ("manual") resolver => C
git config core.notesRef refs/notes/m &&
test_must_fail git notes merge z >output &&
# Output should point to where to resolve conflicts
- grep -q "\\.git/NOTES_MERGE_WORKTREE" output &&
+ test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
# Inspect merge conflicts
ls .git/NOTES_MERGE_WORKTREE >output_conflicts &&
test_cmp expect_conflicts output_conflicts &&
@@ -381,7 +381,7 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol
git config core.notesRef refs/notes/m &&
test_must_fail git notes merge z >output &&
# Output should point to where to resolve conflicts
- grep -q "\\.git/NOTES_MERGE_WORKTREE" output &&
+ test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
# Inspect merge conflicts
ls .git/NOTES_MERGE_WORKTREE >output_conflicts &&
test_cmp expect_conflicts output_conflicts &&
@@ -415,7 +415,7 @@ git rev-parse refs/notes/z > pre_merge_z
test_expect_success 'redo merge of z into m (== y) with default ("manual") resolver => Conflicting 3-way merge' '
test_must_fail git notes merge z >output &&
# Output should point to where to resolve conflicts
- grep -q "\\.git/NOTES_MERGE_WORKTREE" output &&
+ test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
# Inspect merge conflicts
ls .git/NOTES_MERGE_WORKTREE >output_conflicts &&
test_cmp expect_conflicts output_conflicts &&
@@ -496,7 +496,7 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol
git update-ref refs/notes/m refs/notes/y &&
test_must_fail git notes merge z >output &&
# Output should point to where to resolve conflicts
- grep -q "\\.git/NOTES_MERGE_WORKTREE" output &&
+ test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output &&
# Inspect merge conflicts
ls .git/NOTES_MERGE_WORKTREE >output_conflicts &&
test_cmp expect_conflicts output_conflicts &&
diff --git a/t/t3320-notes-merge-worktrees.sh b/t/t3320-notes-merge-worktrees.sh
index 1f71d58..6e05115 100755
--- a/t/t3320-notes-merge-worktrees.sh
+++ b/t/t3320-notes-merge-worktrees.sh
@@ -52,7 +52,7 @@ test_expect_success 'merge z into y while mid-merge in another workdir fails' '
cd worktree &&
git config core.notesRef refs/notes/y &&
test_must_fail git notes merge z 2>err &&
- grep "A notes merge into refs/notes/y is already in-progress at" err
+ test_i18ngrep "A notes merge into refs/notes/y is already in-progress at" err
) &&
test_path_is_missing .git/worktrees/worktree/NOTES_MERGE_REF
'
@@ -62,7 +62,7 @@ test_expect_success 'merge z into x while mid-merge on y succeeds' '
cd worktree2 &&
git config core.notesRef refs/notes/x &&
test_must_fail git notes merge z 2>&1 >out &&
- grep "Automatic notes merge failed" out &&
+ test_i18ngrep "Automatic notes merge failed" out &&
grep -v "A notes merge into refs/notes/x is already in-progress in" out
) &&
echo "ref: refs/notes/x" >expect &&
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 47b5682..f5fd15e 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -136,8 +136,8 @@ test_expect_success 'setup: recover' '
test_expect_success 'Show verbose error when HEAD could not be detached' '
>B &&
test_must_fail git rebase topic 2>output.err >output.out &&
- grep "The following untracked working tree files would be overwritten by checkout:" output.err &&
- grep B output.err
+ test_i18ngrep "The following untracked working tree files would be overwritten by checkout:" output.err &&
+ test_i18ngrep B output.err
'
rm -f B
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 66348f1..3532c48 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -60,7 +60,7 @@ test_expect_success 'setup' '
test_commit P fileP
'
-# "exec" commands are ran with the user shell by default, but this may
+# "exec" commands are run with the user shell by default, but this may
# be non-POSIX. For example, if SHELL=zsh then ">file" doesn't work
# to create a file. Unsetting SHELL avoids such non-portable behavior
# in tests. It must be exported for it to take effect where needed.
@@ -219,9 +219,9 @@ test_expect_success 'abort with error when new base cannot be checked out' '
git commit -m "remove file in base" &&
set_fake_editor &&
test_must_fail git rebase -i master > output 2>&1 &&
- grep "The following untracked working tree files would be overwritten by checkout:" \
+ test_i18ngrep "The following untracked working tree files would be overwritten by checkout:" \
output &&
- grep "file1" output &&
+ test_i18ngrep "file1" output &&
test_path_is_missing .git/rebase-merge &&
git reset --hard HEAD^
'
@@ -540,7 +540,7 @@ test_expect_success 'clean error after failed "exec"' '
echo "edited again" > file7 &&
git add file7 &&
test_must_fail git rebase --continue 2>error &&
- grep "You have staged changes in your working tree." error
+ test_i18ngrep "You have staged changes in your working tree." error
'
test_expect_success 'rebase a detached HEAD' '
@@ -1060,7 +1060,7 @@ test_expect_success 'todo count' '
EOF
test_set_editor "$(pwd)/dump-raw.sh" &&
git rebase -i HEAD~4 >actual &&
- grep "^# Rebase ..* onto ..* ([0-9]" actual
+ test_i18ngrep "^# Rebase ..* onto ..* ([0-9]" actual
'
test_expect_success 'rebase -i commits that overwrite untracked files (pick)' '
@@ -1160,7 +1160,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '
FAKE_LINES="1 2 3 4" \
git rebase -i --root 2>actual &&
test D = $(git cat-file commit HEAD | sed -ne \$p) &&
- test_cmp expect actual
+ test_i18ncmp expect actual
'
cat >expect <<EOF
@@ -1181,7 +1181,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '
set_fake_editor &&
FAKE_LINES="1 2 3 4" \
git rebase -i --root 2>actual &&
- test_cmp expect actual &&
+ test_i18ncmp expect actual &&
test D = $(git cat-file commit HEAD | sed -ne \$p)
'
@@ -1205,7 +1205,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' '
set_fake_editor &&
test_must_fail env FAKE_LINES="1 2 4" \
git rebase -i --root 2>actual &&
- test_cmp expect actual &&
+ test_i18ncmp expect actual &&
cp .git/rebase-merge/git-rebase-todo.backup \
.git/rebase-merge/git-rebase-todo &&
FAKE_LINES="1 2 drop 3 4 drop 5" \
@@ -1228,7 +1228,7 @@ test_expect_success 'static check of bad command' '
set_fake_editor &&
test_must_fail env FAKE_LINES="1 2 3 bad 4 5" \
git rebase -i --root 2>actual &&
- test_cmp expect actual &&
+ test_i18ncmp expect actual &&
FAKE_LINES="1 2 3 drop 4 5" git rebase --edit-todo &&
git rebase --continue &&
test E = $(git cat-file commit HEAD | sed -ne \$p) &&
@@ -1263,7 +1263,7 @@ test_expect_success 'static check of bad SHA-1' '
set_fake_editor &&
test_must_fail env FAKE_LINES="1 2 edit fakesha 3 4 5 #" \
git rebase -i --root 2>actual &&
- test_cmp expect actual &&
+ test_i18ncmp expect actual &&
FAKE_LINES="1 2 4 5 6" git rebase --edit-todo &&
git rebase --continue &&
test E = $(git cat-file commit HEAD | sed -ne \$p)
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index 944154b..532ff5c 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -192,4 +192,35 @@ test_expect_success 'abort rebase -i with --autostash' '
test_cmp expected file0
'
+test_expect_success 'restore autostash on editor failure' '
+ test_when_finished "git reset --hard" &&
+ echo uncommitted-content >file0 &&
+ (
+ test_set_editor "false" &&
+ test_must_fail git rebase -i --autostash HEAD^
+ ) &&
+ echo uncommitted-content >expected &&
+ test_cmp expected file0
+'
+
+test_expect_success 'autostash is saved on editor failure with conflict' '
+ test_when_finished "git reset --hard" &&
+ echo uncommitted-content >file0 &&
+ (
+ write_script abort-editor.sh <<-\EOF &&
+ echo conflicting-content >file0
+ exit 1
+ EOF
+ test_set_editor "$(pwd)/abort-editor.sh" &&
+ test_must_fail git rebase -i --autostash HEAD^ &&
+ rm -f abort-editor.sh
+ ) &&
+ echo conflicting-content >expected &&
+ test_cmp expected file0 &&
+ git checkout file0 &&
+ git stash pop &&
+ echo uncommitted-content >expected &&
+ test_cmp expected file0
+'
+
test_done
diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh
new file mode 100755
index 0000000..3780877
--- /dev/null
+++ b/t/t3427-rebase-subtree.sh
@@ -0,0 +1,119 @@
+#!/bin/sh
+
+test_description='git rebase tests for -Xsubtree
+
+This test runs git rebase and tests the subtree strategy.
+'
+. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-rebase.sh
+
+commit_message() {
+ git log --pretty=format:%s -1 "$1"
+}
+
+test_expect_success 'setup' '
+ test_commit README &&
+ mkdir files &&
+ (
+ cd files &&
+ git init &&
+ test_commit master1 &&
+ test_commit master2 &&
+ test_commit master3
+ ) &&
+ git fetch files master &&
+ git branch files-master FETCH_HEAD &&
+ git read-tree --prefix=files_subtree files-master &&
+ git checkout -- files_subtree &&
+ tree=$(git write-tree) &&
+ head=$(git rev-parse HEAD) &&
+ rev=$(git rev-parse --verify files-master^0) &&
+ commit=$(git commit-tree -p $head -p $rev -m "Add subproject master" $tree) &&
+ git update-ref HEAD $commit &&
+ (
+ cd files_subtree &&
+ test_commit master4
+ ) &&
+ test_commit files_subtree/master5
+'
+
+# FAILURE: Does not preserve master4.
+test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit 4' '
+ reset_rebase &&
+ git checkout -b rebase-preserve-merges-4 master &&
+ git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+ git commit -m "Empty commit" --allow-empty &&
+ git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
+ verbose test "$(commit_message HEAD~)" = "files_subtree/master4"
+'
+
+# FAILURE: Does not preserve master5.
+test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit 5' '
+ reset_rebase &&
+ git checkout -b rebase-preserve-merges-5 master &&
+ git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+ git commit -m "Empty commit" --allow-empty &&
+ git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
+ verbose test "$(commit_message HEAD)" = "files_subtree/master5"
+'
+
+# FAILURE: Does not preserve master4.
+test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 4' '
+ reset_rebase &&
+ git checkout -b rebase-keep-empty-4 master &&
+ git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+ git commit -m "Empty commit" --allow-empty &&
+ git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
+ verbose test "$(commit_message HEAD~2)" = "files_subtree/master4"
+'
+
+# FAILURE: Does not preserve master5.
+test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 5' '
+ reset_rebase &&
+ git checkout -b rebase-keep-empty-5 master &&
+ git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+ git commit -m "Empty commit" --allow-empty &&
+ git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
+ verbose test "$(commit_message HEAD~)" = "files_subtree/master5"
+'
+
+# FAILURE: Does not preserve Empty.
+test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto empty commit' '
+ reset_rebase &&
+ git checkout -b rebase-keep-empty-empty master &&
+ git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+ git commit -m "Empty commit" --allow-empty &&
+ git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
+ verbose test "$(commit_message HEAD)" = "Empty commit"
+'
+
+# FAILURE: fatal: Could not parse object
+test_expect_failure 'Rebase -Xsubtree --onto commit 4' '
+ reset_rebase &&
+ git checkout -b rebase-onto-4 master &&
+ git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+ git commit -m "Empty commit" --allow-empty &&
+ git rebase -Xsubtree=files_subtree --onto files-master master &&
+ verbose test "$(commit_message HEAD~2)" = "files_subtree/master4"
+'
+
+# FAILURE: fatal: Could not parse object
+test_expect_failure 'Rebase -Xsubtree --onto commit 5' '
+ reset_rebase &&
+ git checkout -b rebase-onto-5 master &&
+ git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+ git commit -m "Empty commit" --allow-empty &&
+ git rebase -Xsubtree=files_subtree --onto files-master master &&
+ verbose test "$(commit_message HEAD~)" = "files_subtree/master5"
+'
+# FAILURE: fatal: Could not parse object
+test_expect_failure 'Rebase -Xsubtree --onto empty commit' '
+ reset_rebase &&
+ git checkout -b rebase-onto-empty master &&
+ git filter-branch --prune-empty -f --subdirectory-filter files_subtree &&
+ git commit -m "Empty commit" --allow-empty &&
+ git rebase -Xsubtree=files_subtree --onto files-master master &&
+ verbose test "$(commit_message HEAD)" = "Empty commit"
+'
+
+test_done
diff --git a/t/t4026-color.sh b/t/t4026-color.sh
index 2b32c4f..ec78c5e 100755
--- a/t/t4026-color.sh
+++ b/t/t4026-color.sh
@@ -50,14 +50,19 @@ test_expect_success 'attr negation' '
color "nobold nodim noul noblink noreverse" "[22;24;25;27m"
'
+test_expect_success '"no-" variant of negation' '
+ color "no-bold no-blink" "[22;25m"
+'
+
test_expect_success 'long color specification' '
color "254 255 bold dim ul blink reverse" "[1;2;4;5;7;38;5;254;48;5;255m"
'
test_expect_success 'absurdly long color specification' '
color \
- "#ffffff #ffffff bold nobold dim nodim ul noul blink noblink reverse noreverse" \
- "[1;2;4;5;7;22;24;25;27;38;2;255;255;255;48;2;255;255;255m"
+ "#ffffff #ffffff bold nobold dim nodim italic noitalic
+ ul noul blink noblink reverse noreverse strike nostrike" \
+ "[1;2;3;4;5;7;9;22;23;24;25;27;29;38;2;255;255;255;48;2;255;255;255m"
'
test_expect_success '0-7 are aliases for basic ANSI color names' '
diff --git a/t/t4153-am-resume-override-opts.sh b/t/t4153-am-resume-override-opts.sh
index 7c013d8..8ea22d1 100755
--- a/t/t4153-am-resume-override-opts.sh
+++ b/t/t4153-am-resume-override-opts.sh
@@ -53,7 +53,7 @@ test_expect_success '--no-quiet overrides --quiet' '
# Applying side1 will be quiet.
test_must_fail git am --quiet side[123].eml >out &&
test_path_is_dir .git/rebase-apply &&
- ! test_i18ngrep "^Applying: " out &&
+ test_i18ngrep ! "^Applying: " out &&
echo side1 >file &&
git add file &&
diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh
index a977365..ae08b57 100755
--- a/t/t4201-shortlog.sh
+++ b/t/t4201-shortlog.sh
@@ -184,4 +184,10 @@ test_expect_success 'shortlog with revision pseudo options' '
git shortlog --exclude=refs/heads/m* --all
'
+test_expect_success 'shortlog with --output=<file>' '
+ git shortlog --output=shortlog -1 master >output &&
+ test ! -s output &&
+ test_line_count = 3 shortlog
+'
+
test_done
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 128ba93..803e1e6 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -860,12 +860,15 @@ test_expect_success 'dotdot is a parent directory' '
test_cmp expect actual
'
-test_expect_success GPG 'log --graph --show-signature' '
+test_expect_success GPG 'setup signed branch' '
test_when_finished "git reset --hard && git checkout master" &&
git checkout -b signed master &&
echo foo >foo &&
git add foo &&
- git commit -S -m signed_commit &&
+ git commit -S -m signed_commit
+'
+
+test_expect_success GPG 'log --graph --show-signature' '
git log --graph --show-signature -n1 signed >actual &&
grep "^| gpg: Signature made" actual &&
grep "^| gpg: Good signature" actual
@@ -890,6 +893,31 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '
grep "^| | gpg: Good signature" actual
'
+test_expect_success GPG '--no-show-signature overrides --show-signature' '
+ git log -1 --show-signature --no-show-signature signed >actual &&
+ ! grep "^gpg:" actual
+'
+
+test_expect_success GPG 'log.showsignature=true behaves like --show-signature' '
+ test_config log.showsignature true &&
+ git log -1 signed >actual &&
+ grep "gpg: Signature made" actual &&
+ grep "gpg: Good signature" actual
+'
+
+test_expect_success GPG '--no-show-signature overrides log.showsignature=true' '
+ test_config log.showsignature true &&
+ git log -1 --no-show-signature signed >actual &&
+ ! grep "^gpg:" actual
+'
+
+test_expect_success GPG '--show-signature overrides log.showsignature=false' '
+ test_config log.showsignature false &&
+ git log -1 --show-signature signed >actual &&
+ grep "gpg: Signature made" actual &&
+ grep "gpg: Good signature" actual
+'
+
test_expect_success 'log --graph --no-walk is forbidden' '
test_must_fail git log --graph --no-walk
'
diff --git a/t/t4208-log-magic-pathspec.sh b/t/t4208-log-magic-pathspec.sh
index d8f23f4..001343e 100755
--- a/t/t4208-log-magic-pathspec.sh
+++ b/t/t4208-log-magic-pathspec.sh
@@ -18,7 +18,7 @@ test_expect_success '"git log :/" should not be ambiguous' '
test_expect_success '"git log :/a" should be ambiguous (applied both rev and worktree)' '
: >a &&
test_must_fail git log :/a 2>error &&
- grep ambiguous error
+ test_i18ngrep ambiguous error
'
test_expect_success '"git log :/a -- " should not be ambiguous' '
@@ -31,7 +31,7 @@ test_expect_success '"git log -- :/a" should not be ambiguous' '
test_expect_success '"git log :" should be ambiguous' '
test_must_fail git log : 2>error &&
- grep ambiguous error
+ test_i18ngrep ambiguous error
'
test_expect_success 'git log -- :' '
diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh
index 4451127..9d87777 100755
--- a/t/t4211-line-log.sh
+++ b/t/t4211-line-log.sh
@@ -99,4 +99,11 @@ test_expect_success '-L with --first-parent and a merge' '
git log --first-parent -L 1,1:b.c
'
+test_expect_success '-L with --output' '
+ git checkout parallel-change &&
+ git log --output=log -L :main:b.c >output &&
+ test ! -s output &&
+ test_line_count = 70 log
+'
+
test_done
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 4b68bba..80b2387 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -319,4 +319,78 @@ test_expect_success 'catch non-matching pathspec' '
test_must_fail git archive -v HEAD -- "*.abc" >/dev/null
'
+# Pull the size and date of each entry in a tarfile using the system tar.
+#
+# We'll pull out only the year from the date; that avoids any question of
+# timezones impacting the result (as long as we keep our test times away from a
+# year boundary; our reference times are all in August).
+#
+# The output of tar_info is expected to be "<size> <year>", both in decimal. It
+# ignores the return value of tar. We have to do this, because some of our test
+# input is only partial (the real data is 64GB in some cases).
+tar_info () {
+ "$TAR" tvf "$1" |
+ awk '{
+ split($4, date, "-")
+ print $3 " " date[1]
+ }'
+}
+
+# See if our system tar can handle a tar file with huge sizes and dates far in
+# the future, and that we can actually parse its output.
+#
+# The reference file was generated by GNU tar, and the magic time and size are
+# both octal 01000000000001, which overflows normal ustar fields.
+test_lazy_prereq TAR_HUGE '
+ echo "68719476737 4147" >expect &&
+ tar_info "$TEST_DIRECTORY"/t5000/huge-and-future.tar >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success LONG_IS_64BIT 'set up repository with huge blob' '
+ obj_d=19 &&
+ obj_f=f9c8273ec45a8938e6999cb59b3ff66739902a &&
+ obj=${obj_d}${obj_f} &&
+ mkdir -p .git/objects/$obj_d &&
+ cp "$TEST_DIRECTORY"/t5000/$obj .git/objects/$obj_d/$obj_f &&
+ rm -f .git/index &&
+ git update-index --add --cacheinfo 100644,$obj,huge &&
+ git commit -m huge
+'
+
+# We expect git to die with SIGPIPE here (otherwise we
+# would generate the whole 64GB).
+test_expect_success LONG_IS_64BIT 'generate tar with huge size' '
+ {
+ git archive HEAD
+ echo $? >exit-code
+ } | test_copy_bytes 4096 >huge.tar &&
+ echo 141 >expect &&
+ test_cmp expect exit-code
+'
+
+test_expect_success TAR_HUGE,LONG_IS_64BIT 'system tar can read our huge size' '
+ echo 68719476737 >expect &&
+ tar_info huge.tar | cut -d" " -f1 >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success LONG_IS_64BIT 'set up repository with far-future commit' '
+ rm -f .git/index &&
+ echo content >file &&
+ git add file &&
+ GIT_COMMITTER_DATE="@68719476737 +0000" \
+ git commit -m "tempori parendum"
+'
+
+test_expect_success LONG_IS_64BIT 'generate tar with future mtime' '
+ git archive HEAD >future.tar
+'
+
+test_expect_success TAR_HUGE,LONG_IS_64BIT 'system tar can read our future mtime' '
+ echo 4147 >expect &&
+ tar_info future.tar | cut -d" " -f2 >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t5000/19f9c8273ec45a8938e6999cb59b3ff66739902a b/t/t5000/19f9c8273ec45a8938e6999cb59b3ff66739902a
new file mode 100644
index 0000000..5cbe9ec
--- /dev/null
+++ b/t/t5000/19f9c8273ec45a8938e6999cb59b3ff66739902a
Binary files differ
diff --git a/t/t5000/huge-and-future.tar b/t/t5000/huge-and-future.tar
new file mode 100644
index 0000000..63155e1
--- /dev/null
+++ b/t/t5000/huge-and-future.tar
Binary files differ
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index dd2e6ce..8198d8e 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -1182,7 +1182,7 @@ test_expect_success 'extra args: setup' '
test_extra_arg () {
test_expect_success "extra args: $*" "
test_must_fail git remote $* bogus_extra_arg 2>actual &&
- grep '^usage:' actual
+ test_i18ngrep '^usage:' actual
"
}
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 454d896..6bd4853 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -644,7 +644,7 @@ test_expect_success 'fetch --prune prints the remotes url' '
git fetch --prune origin 2>&1 | head -n1 >../actual
) &&
echo "From ${D}/." >expect &&
- test_cmp expect actual
+ test_i18ncmp expect actual
'
test_expect_success 'branchname D/F conflict resolved by --prune' '
@@ -688,4 +688,34 @@ test_expect_success 'fetching with auto-gc does not lock up' '
)
'
+test_expect_success 'fetch aligned output' '
+ git clone . full-output &&
+ test_commit looooooooooooong-tag &&
+ (
+ cd full-output &&
+ git -c fetch.output=full fetch origin 2>&1 | \
+ grep -e "->" | cut -c 22- >../actual
+ ) &&
+ cat >expect <<-\EOF &&
+ master -> origin/master
+ looooooooooooong-tag -> looooooooooooong-tag
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'fetch compact output' '
+ git clone . compact &&
+ test_commit extraaa &&
+ (
+ cd compact &&
+ git -c fetch.output=compact fetch origin 2>&1 | \
+ grep -e "->" | cut -c 22- >../actual
+ ) &&
+ cat >expect <<-\EOF &&
+ master -> origin/*
+ extraaa -> *
+ EOF
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 3159956..37ebbcf 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -211,7 +211,7 @@ test_expect_success 'fail if the index has unresolved entries' '
test -n "$(git ls-files -u)" &&
cp file expected &&
test_must_fail git pull . second 2>err &&
- test_i18ngrep "Pull is not possible because you have unmerged files" err &&
+ test_i18ngrep "Pulling is not possible because you have unmerged files." err &&
test_cmp expected file &&
git add file &&
test -z "$(git ls-files -u)" &&
diff --git a/t/t5523-push-upstream.sh b/t/t5523-push-upstream.sh
index 3683df1..d6981ba 100755
--- a/t/t5523-push-upstream.sh
+++ b/t/t5523-push-upstream.sh
@@ -75,7 +75,7 @@ test_expect_success TTY 'progress messages go to tty' '
ensure_fresh_upstream &&
test_terminal git push -u upstream master >out 2>err &&
- grep "Writing objects" err
+ test_i18ngrep "Writing objects" err
'
test_expect_success 'progress messages do not go to non-tty' '
@@ -83,7 +83,7 @@ test_expect_success 'progress messages do not go to non-tty' '
# skip progress messages, since stderr is non-tty
git push -u upstream master >out 2>err &&
- ! grep "Writing objects" err
+ test_i18ngrep ! "Writing objects" err
'
test_expect_success 'progress messages go to non-tty (forced)' '
@@ -91,22 +91,22 @@ test_expect_success 'progress messages go to non-tty (forced)' '
# force progress messages to stderr, even though it is non-tty
git push -u --progress upstream master >out 2>err &&
- grep "Writing objects" err
+ test_i18ngrep "Writing objects" err
'
test_expect_success TTY 'push -q suppresses progress' '
ensure_fresh_upstream &&
test_terminal git push -u -q upstream master >out 2>err &&
- ! grep "Writing objects" err
+ test_i18ngrep ! "Writing objects" err
'
test_expect_success TTY 'push --no-progress suppresses progress' '
ensure_fresh_upstream &&
test_terminal git push -u --no-progress upstream master >out 2>err &&
- ! grep "Unpacking objects" err &&
- ! grep "Writing objects" err
+ test_i18ngrep ! "Unpacking objects" err &&
+ test_i18ngrep ! "Writing objects" err
'
test_expect_success TTY 'quiet push' '
diff --git a/t/t5536-fetch-conflicts.sh b/t/t5536-fetch-conflicts.sh
index 6c5d3a4..2e42cf3 100755
--- a/t/t5536-fetch-conflicts.sh
+++ b/t/t5536-fetch-conflicts.sh
@@ -22,8 +22,8 @@ verify_stderr () {
cat >expected &&
# We're not interested in the error
# "fatal: The remote end hung up unexpectedly":
- grep -E '^(fatal|warning):' <error | grep -v 'hung up' >actual | sort &&
- test_cmp expected actual
+ test_i18ngrep -E '^(fatal|warning):' <error | grep -v 'hung up' >actual | sort &&
+ test_i18ncmp expected actual
}
test_expect_success 'setup' '
diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
index fd7d06b..ca6becf 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -119,7 +119,7 @@ test_expect_success 'rejected update prints status' '
git commit -m dev2 &&
test_must_fail git push origin dev2 2>act &&
sed -e "/^remote: /s/ *$//" <act >cmp &&
- test_cmp exp cmp
+ test_i18ncmp exp cmp
'
rm -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/hooks/update"
@@ -219,7 +219,7 @@ test_expect_success TTY 'push shows progress when stderr is a tty' '
cd "$ROOT_PATH"/test_repo_clone &&
test_commit noisy &&
test_terminal git push >output 2>&1 &&
- grep "^Writing objects" output
+ test_i18ngrep "^Writing objects" output
'
test_expect_success TTY 'push --quiet silences status and progress' '
@@ -233,16 +233,16 @@ test_expect_success TTY 'push --no-progress silences progress but not status' '
cd "$ROOT_PATH"/test_repo_clone &&
test_commit no-progress &&
test_terminal git push --no-progress >output 2>&1 &&
- grep "^To http" output &&
- ! grep "^Writing objects"
+ test_i18ngrep "^To http" output &&
+ test_i18ngrep ! "^Writing objects"
'
test_expect_success 'push --progress shows progress to non-tty' '
cd "$ROOT_PATH"/test_repo_clone &&
test_commit progress &&
git push --progress >output 2>&1 &&
- grep "^To http" output &&
- grep "^Writing objects" output
+ test_i18ngrep "^To http" output &&
+ test_i18ngrep "^Writing objects" output
'
test_expect_success 'http push gives sane defaults to reflog' '
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index e74662b..86d1380 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -362,7 +362,7 @@ test_expect_success 'bisect starting with a detached HEAD' '
test_expect_success 'bisect errors out if bad and good are mistaken' '
git bisect reset &&
test_must_fail git bisect start $HASH2 $HASH4 2> rev_list_error &&
- grep "mistook good and bad" rev_list_error &&
+ test_i18ngrep "mistook good and bad" rev_list_error &&
git bisect reset
'
@@ -404,7 +404,7 @@ test_expect_success 'side branch creation' '
test_expect_success 'good merge base when good and bad are siblings' '
git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
- grep "merge base must be tested" my_bisect_log.txt &&
+ test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
grep $HASH4 my_bisect_log.txt &&
git bisect good > my_bisect_log.txt &&
test_must_fail grep "merge base must be tested" my_bisect_log.txt &&
@@ -413,7 +413,7 @@ test_expect_success 'good merge base when good and bad are siblings' '
'
test_expect_success 'skipped merge base when good and bad are siblings' '
git bisect start "$SIDE_HASH7" "$HASH7" > my_bisect_log.txt &&
- grep "merge base must be tested" my_bisect_log.txt &&
+ test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
grep $HASH4 my_bisect_log.txt &&
git bisect skip > my_bisect_log.txt 2>&1 &&
grep "warning" my_bisect_log.txt &&
@@ -423,11 +423,11 @@ test_expect_success 'skipped merge base when good and bad are siblings' '
test_expect_success 'bad merge base when good and bad are siblings' '
git bisect start "$HASH7" HEAD > my_bisect_log.txt &&
- grep "merge base must be tested" my_bisect_log.txt &&
+ test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
grep $HASH4 my_bisect_log.txt &&
test_must_fail git bisect bad > my_bisect_log.txt 2>&1 &&
- grep "merge base $HASH4 is bad" my_bisect_log.txt &&
- grep "fixed between $HASH4 and \[$SIDE_HASH7\]" my_bisect_log.txt &&
+ test_i18ngrep "merge base $HASH4 is bad" my_bisect_log.txt &&
+ test_i18ngrep "fixed between $HASH4 and \[$SIDE_HASH7\]" my_bisect_log.txt &&
git bisect reset
'
@@ -460,9 +460,9 @@ test_expect_success 'many merge bases creation' '
test_expect_success 'good merge bases when good and bad are siblings' '
git bisect start "$B_HASH" "$A_HASH" > my_bisect_log.txt &&
- grep "merge base must be tested" my_bisect_log.txt &&
+ test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
git bisect good > my_bisect_log2.txt &&
- grep "merge base must be tested" my_bisect_log2.txt &&
+ test_i18ngrep "merge base must be tested" my_bisect_log2.txt &&
{
{
grep "$SIDE_HASH5" my_bisect_log.txt &&
@@ -477,14 +477,14 @@ test_expect_success 'good merge bases when good and bad are siblings' '
test_expect_success 'optimized merge base checks' '
git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt &&
- grep "merge base must be tested" my_bisect_log.txt &&
+ test_i18ngrep "merge base must be tested" my_bisect_log.txt &&
grep "$HASH4" my_bisect_log.txt &&
git bisect good > my_bisect_log2.txt &&
test -f ".git/BISECT_ANCESTORS_OK" &&
test "$HASH6" = $(git rev-parse --verify HEAD) &&
git bisect bad > my_bisect_log3.txt &&
git bisect good "$A_HASH" > my_bisect_log4.txt &&
- grep "merge base must be tested" my_bisect_log4.txt &&
+ test_i18ngrep "merge base must be tested" my_bisect_log4.txt &&
test_must_fail test -f ".git/BISECT_ANCESTORS_OK"
'
@@ -562,7 +562,7 @@ test_expect_success 'skipping away from skipped commit' '
test_expect_success 'erroring out when using bad path parameters' '
test_must_fail git bisect start $PARA_HASH7 $HASH1 -- foobar 2> error.txt &&
- grep "bad path parameters" error.txt
+ test_i18ngrep "bad path parameters" error.txt
'
test_expect_success 'test bisection on bare repo - --no-checkout specified' '
@@ -803,7 +803,7 @@ test_expect_success 'bisect terms needs 0 or 1 argument' '
test_must_fail git bisect terms 1 2 &&
test_must_fail git bisect terms 2>actual &&
echo "no terms defined" >expected &&
- test_cmp expected actual
+ test_i18ncmp expected actual
'
test_expect_success 'bisect terms shows good/bad after start' '
@@ -875,7 +875,7 @@ test_expect_success 'bisect start --term-* does store terms' '
Your current terms are two for the old state
and one for the new state.
EOF
- test_cmp expected actual &&
+ test_i18ncmp expected actual &&
git bisect terms --term-bad >actual &&
echo one >expected &&
test_cmp expected actual &&
diff --git a/t/t6301-for-each-ref-errors.sh b/t/t6301-for-each-ref-errors.sh
index cdb67a0..c734ce2 100755
--- a/t/t6301-for-each-ref-errors.sh
+++ b/t/t6301-for-each-ref-errors.sh
@@ -20,8 +20,8 @@ test_expect_success 'Broken refs are reported correctly' '
test_when_finished "rm -f .git/$r" &&
echo "warning: ignoring broken ref $r" >broken-err &&
git for-each-ref >out 2>err &&
- test_cmp full-list out &&
- test_cmp broken-err err
+ test_i18ncmp full-list out &&
+ test_i18ncmp broken-err err
'
test_expect_success 'NULL_SHA1 refs are reported correctly' '
@@ -31,10 +31,10 @@ test_expect_success 'NULL_SHA1 refs are reported correctly' '
echo "warning: ignoring broken ref $r" >zeros-err &&
git for-each-ref >out 2>err &&
test_cmp full-list out &&
- test_cmp zeros-err err &&
+ test_i18ncmp zeros-err err &&
git for-each-ref --format="%(objectname) %(refname)" >brief-out 2>brief-err &&
test_cmp brief-list brief-out &&
- test_cmp zeros-err brief-err
+ test_i18ncmp zeros-err brief-err
'
test_expect_success 'Missing objects are reported correctly' '
@@ -43,7 +43,7 @@ test_expect_success 'Missing objects are reported correctly' '
test_when_finished "rm -f .git/$r" &&
echo "fatal: missing object $MISSING for $r" >missing-err &&
test_must_fail git for-each-ref 2>err &&
- test_cmp missing-err err &&
+ test_i18ncmp missing-err err &&
(
cat brief-list &&
echo "$MISSING $r"
diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh
index a971884..38b3890 100755
--- a/t/t7063-status-untracked-cache.sh
+++ b/t/t7063-status-untracked-cache.sh
@@ -643,7 +643,7 @@ test_expect_success 'test ident field is working' '
cp -R done dthree dtwo four three ../other_worktree &&
GIT_WORK_TREE=../other_worktree git status 2>../err &&
echo "warning: Untracked cache is disabled on this system or location." >../expect &&
- test_cmp ../expect ../err
+ test_i18ncmp ../expect ../err
'
test_done
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 98bcfe2..86f23be 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -66,14 +66,14 @@ test_expect_success 'reset --hard message' '
hex=$(git log -1 --format="%h") &&
git reset --hard > .actual &&
echo HEAD is now at $hex $(commit_msg) > .expected &&
- test_cmp .expected .actual
+ test_i18ncmp .expected .actual
'
test_expect_success 'reset --hard message (ISO8859-1 logoutputencoding)' '
hex=$(git log -1 --format="%h") &&
git -c "i18n.logOutputEncoding=$test_encoding" reset --hard > .actual &&
echo HEAD is now at $hex $(commit_msg $test_encoding) > .expected &&
- test_cmp .expected .actual
+ test_i18ncmp .expected .actual
'
>.diff_expect
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 8859236..d4b217b 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -257,7 +257,7 @@ test_expect_success 'checkout to detach HEAD' '
git checkout -f renamer && git clean -f &&
git checkout renamer^ 2>messages &&
test_i18ngrep "HEAD is now at 7329388" messages &&
- test_line_count -gt 1 messages &&
+ (test_line_count -gt 1 messages || test -n "$GETTEXT_POISON") &&
H=$(git rev-parse --verify HEAD) &&
M=$(git show-ref -s --verify refs/heads/master) &&
test "z$H" = "z$M" &&
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 3570f7b..b77cce8 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -942,7 +942,7 @@ test_expect_success 'submodule deinit from subdirectory' '
cd sub &&
git submodule deinit ../init >../output
) &&
- grep "\\.\\./init" output &&
+ test_i18ngrep "\\.\\./init" output &&
test -z "$(git config --get-regexp "submodule\.example\.")" &&
test -n "$(git config --get-regexp "submodule\.example2\.")" &&
test -f example2/.git &&
diff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh
index 5503ec0..0726799 100755
--- a/t/t7403-submodule-sync.sh
+++ b/t/t7403-submodule-sync.sh
@@ -157,7 +157,7 @@ test_expect_success '"git submodule sync" should update submodule URLs - subdire
cd sub &&
git submodule sync >../../output
) &&
- grep "\\.\\./submodule" output &&
+ test_i18ngrep "\\.\\./submodule" output &&
test -d "$(
cd super-clone/submodule &&
git config remote.origin.url
@@ -188,7 +188,7 @@ test_expect_success '"git submodule sync --recursive" should update all submodul
cd sub &&
git submodule sync --recursive >../../output
) &&
- grep "\\.\\./submodule/sub-submodule" output &&
+ test_i18ngrep "\\.\\./submodule/sub-submodule" output &&
test -d "$(
cd super-clone/submodule &&
git config remote.origin.url
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 5f27879..88e9750 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -136,8 +136,8 @@ test_expect_success 'submodule update --init --recursive from subdirectory' '
cd tmp &&
git submodule update --init --recursive ../super >../../actual 2>../../actual2
) &&
- test_cmp expect actual &&
- test_cmp expect2 actual2
+ test_i18ncmp expect actual &&
+ test_i18ncmp expect2 actual2
'
apos="'";
@@ -370,7 +370,7 @@ test_expect_success 'submodule update - command in .git/config catches failure'
(cd super &&
test_must_fail git submodule update submodule 2>../actual
) &&
- test_cmp actual expect
+ test_i18ncmp actual expect
'
cat << EOF >expect
@@ -388,7 +388,7 @@ test_expect_success 'submodule update - command in .git/config catches failure -
mkdir tmp && cd tmp &&
test_must_fail git submodule update ../submodule 2>../../actual
) &&
- test_cmp actual expect
+ test_i18ncmp actual expect
'
cat << EOF >expect
@@ -408,7 +408,7 @@ test_expect_success 'recursive submodule update - command in .git/config catches
mkdir -p tmp && cd tmp &&
test_must_fail git submodule update --recursive ../super 2>../../actual
) &&
- test_cmp actual expect
+ test_i18ncmp actual expect
'
test_expect_success 'submodule init does not copy command into .git/config' '
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index c3ed7cb..b3bdd16 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1377,7 +1377,7 @@ EOF
git config --add -f .gitmodules submodule.subname.ignore all &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status > output &&
- test_cmp expect output &&
+ test_i18ncmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
@@ -1387,7 +1387,7 @@ test_expect_success '.git/config ignore=all suppresses unstaged submodule summar
git config --add submodule.subname.ignore all &&
git config --add submodule.subname.path sm &&
git status > output &&
- test_cmp expect output &&
+ test_i18ncmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index 4177a86..6e839f5 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -210,4 +210,11 @@ test_expect_success GPG 'show lack of signature with custom format' '
test_cmp expect actual
'
+test_expect_success GPG 'log.showsignature behaves like --show-signature' '
+ test_config log.showsignature true &&
+ git show initial >actual &&
+ grep "gpg: Signature made" actual &&
+ grep "gpg: Good signature" actual
+'
+
test_done
diff --git a/t/t7607-merge-overwrite.sh b/t/t7607-merge-overwrite.sh
index 758a623..9444d6a 100755
--- a/t/t7607-merge-overwrite.sh
+++ b/t/t7607-merge-overwrite.sh
@@ -115,7 +115,7 @@ cat >expect <<\EOF
error: The following untracked working tree files would be overwritten by merge:
sub
sub2
-Please move or remove them before you can merge.
+Please move or remove them before you merge.
Aborting
EOF
@@ -125,7 +125,7 @@ test_expect_success 'will not overwrite untracked file in leading path' '
cp important sub &&
cp important sub2 &&
test_must_fail git merge sub 2>out &&
- test_cmp out expect &&
+ test_i18ncmp out expect &&
test_path_is_missing .git/MERGE_HEAD &&
test_cmp important sub &&
test_cmp important sub2 &&
diff --git a/t/t7609-merge-co-error-msgs.sh b/t/t7609-merge-co-error-msgs.sh
index 6729cb3..f80bdb8 100755
--- a/t/t7609-merge-co-error-msgs.sh
+++ b/t/t7609-merge-co-error-msgs.sh
@@ -31,7 +31,7 @@ error: The following untracked working tree files would be overwritten by merge:
four
three
two
-Please move or remove them before you can merge.
+Please move or remove them before you merge.
Aborting
EOF
@@ -53,10 +53,10 @@ error: Your local changes to the following files would be overwritten by merge:
four
three
two
-Please commit your changes or stash them before you can merge.
+Please commit your changes or stash them before you merge.
error: The following untracked working tree files would be overwritten by merge:
five
-Please move or remove them before you can merge.
+Please move or remove them before you merge.
Aborting
EOF
@@ -72,7 +72,7 @@ cat >expect <<\EOF
error: Your local changes to the following files would be overwritten by checkout:
rep/one
rep/two
-Please commit your changes or stash them before you can switch branches.
+Please commit your changes or stash them before you switch branches.
Aborting
EOF
@@ -94,7 +94,7 @@ cat >expect <<\EOF
error: Your local changes to the following files would be overwritten by checkout:
rep/one
rep/two
-Please commit your changes or stash them before you can switch branches.
+Please commit your changes or stash them before you switch branches.
Aborting
EOF
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index 76306cf..7217f39 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -589,7 +589,12 @@ test_expect_success 'filenames seen by tools start with ./' '
git reset --hard master >/dev/null 2>&1
'
-test_expect_success 'temporary filenames are used with mergetool.writeToTemp' '
+test_lazy_prereq MKTEMP '
+ tempdir=$(mktemp -d -t foo.XXXXXX) &&
+ test -d "$tempdir"
+'
+
+test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '
git checkout -b test16 branch1 &&
test_config mergetool.writeToTemp true &&
test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index bd8ea11..cf3f9ec 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -177,7 +177,7 @@ do
test_expect_success "grep -c $L (no /dev/null)" '
! git grep -c test $H | grep /dev/null
- '
+ '
test_expect_success "grep --max-depth -1 $L" '
{
@@ -1377,4 +1377,62 @@ test_expect_success 'grep --color -e A --and -e B -p with context' '
test_cmp expected actual
'
+test_expect_success 'grep can find things only in the work tree' '
+ : >work-tree-only &&
+ git add work-tree-only &&
+ test_when_finished "git rm -f work-tree-only" &&
+ echo "find in work tree" >work-tree-only &&
+ git grep --quiet "find in work tree" &&
+ test_must_fail git grep --quiet --cached "find in work tree" &&
+ test_must_fail git grep --quiet "find in work tree" HEAD
+'
+
+test_expect_success 'grep can find things only in the work tree (i-t-a)' '
+ echo "intend to add this" >intend-to-add &&
+ git add -N intend-to-add &&
+ test_when_finished "git rm -f intend-to-add" &&
+ git grep --quiet "intend to add this" &&
+ test_must_fail git grep --quiet --cached "intend to add this" &&
+ test_must_fail git grep --quiet "intend to add this" HEAD
+'
+
+test_expect_success 'grep does not search work tree with assume unchanged' '
+ echo "intend to add this" >intend-to-add &&
+ git add -N intend-to-add &&
+ git update-index --assume-unchanged intend-to-add &&
+ test_when_finished "git rm -f intend-to-add" &&
+ test_must_fail git grep --quiet "intend to add this" &&
+ test_must_fail git grep --quiet --cached "intend to add this" &&
+ test_must_fail git grep --quiet "intend to add this" HEAD
+'
+
+test_expect_success 'grep can find things only in the index' '
+ echo "only in the index" >cache-this &&
+ git add cache-this &&
+ rm cache-this &&
+ test_when_finished "git rm --cached cache-this" &&
+ test_must_fail git grep --quiet "only in the index" &&
+ git grep --quiet --cached "only in the index" &&
+ test_must_fail git grep --quiet "only in the index" HEAD
+'
+
+test_expect_success 'grep does not report i-t-a with -L --cached' '
+ echo "intend to add this" >intend-to-add &&
+ git add -N intend-to-add &&
+ test_when_finished "git rm -f intend-to-add" &&
+ git ls-files | grep -v "^intend-to-add\$" >expected &&
+ git grep -L --cached "nonexistent_string" >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'grep does not report i-t-a and assume unchanged with -L' '
+ echo "intend to add this" >intend-to-add-assume-unchanged &&
+ git add -N intend-to-add-assume-unchanged &&
+ test_when_finished "git rm -f intend-to-add-assume-unchanged" &&
+ git update-index --assume-unchanged intend-to-add-assume-unchanged &&
+ git ls-files | grep -v "^intend-to-add-assume-unchanged\$" >expected &&
+ git grep -L "nonexistent_string" >actual &&
+ test_cmp expected actual
+'
+
test_done
diff --git a/t/t7812-grep-icase-non-ascii.sh b/t/t7812-grep-icase-non-ascii.sh
new file mode 100755
index 0000000..169fd8d
--- /dev/null
+++ b/t/t7812-grep-icase-non-ascii.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+test_description='grep icase on non-English locales'
+
+. ./lib-gettext.sh
+
+test_expect_success GETTEXT_LOCALE 'setup' '
+ test_write_lines "TILRAUN: Halló Heimur!" >file &&
+ git add file &&
+ LC_ALL="$is_IS_locale" &&
+ export LC_ALL
+'
+
+test_have_prereq GETTEXT_LOCALE &&
+test-regex "HALLÓ" "Halló" ICASE &&
+test_set_prereq REGEX_LOCALE
+
+test_expect_success REGEX_LOCALE 'grep literal string, no -F' '
+ git grep -i "TILRAUN: Halló Heimur!" &&
+ git grep -i "TILRAUN: HALLÓ HEIMUR!"
+'
+
+test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8 icase' '
+ git grep --perl-regexp "TILRAUN: H.lló Heimur!" &&
+ git grep --perl-regexp -i "TILRAUN: H.lló Heimur!" &&
+ git grep --perl-regexp -i "TILRAUN: H.LLÓ HEIMUR!"
+'
+
+test_expect_success GETTEXT_LOCALE,LIBPCRE 'grep pcre utf-8 string with "+"' '
+ test_write_lines "TILRAUN: Hallóó Heimur!" >file2 &&
+ git add file2 &&
+ git grep -l --perl-regexp "TILRAUN: H.lló+ Heimur!" >actual &&
+ echo file >expected &&
+ echo file2 >>expected &&
+ test_cmp expected actual
+'
+
+test_expect_success REGEX_LOCALE 'grep literal string, with -F' '
+ git grep --debug -i -F "TILRAUN: Halló Heimur!" 2>&1 >/dev/null |
+ grep fixed >debug1 &&
+ test_write_lines "fixed TILRAUN: Halló Heimur!" >expect1 &&
+ test_cmp expect1 debug1 &&
+
+ git grep --debug -i -F "TILRAUN: HALLÓ HEIMUR!" 2>&1 >/dev/null |
+ grep fixed >debug2 &&
+ test_write_lines "fixed TILRAUN: HALLÓ HEIMUR!" >expect2 &&
+ test_cmp expect2 debug2
+'
+
+test_expect_success REGEX_LOCALE 'grep string with regex, with -F' '
+ test_write_lines "^*TILR^AUN:.* \\Halló \$He[]imur!\$" >file &&
+
+ git grep --debug -i -F "^*TILR^AUN:.* \\Halló \$He[]imur!\$" 2>&1 >/dev/null |
+ grep fixed >debug1 &&
+ test_write_lines "fixed \\^*TILR^AUN:\\.\\* \\\\Halló \$He\\[]imur!\\\$" >expect1 &&
+ test_cmp expect1 debug1 &&
+
+ git grep --debug -i -F "^*TILR^AUN:.* \\HALLÓ \$HE[]IMUR!\$" 2>&1 >/dev/null |
+ grep fixed >debug2 &&
+ test_write_lines "fixed \\^*TILR^AUN:\\.\\* \\\\HALLÓ \$HE\\[]IMUR!\\\$" >expect2 &&
+ test_cmp expect2 debug2
+'
+
+test_expect_success REGEX_LOCALE 'pickaxe -i on non-ascii' '
+ git commit -m first &&
+ git log --format=%f -i -S"TILRAUN: HALLÓ HEIMUR!" >actual &&
+ echo first >expected &&
+ test_cmp expected actual
+'
+
+test_done
diff --git a/t/t7813-grep-icase-iso.sh b/t/t7813-grep-icase-iso.sh
new file mode 100755
index 0000000..efef7fb
--- /dev/null
+++ b/t/t7813-grep-icase-iso.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+test_description='grep icase on non-English locales'
+
+. ./lib-gettext.sh
+
+test_expect_success GETTEXT_ISO_LOCALE 'setup' '
+ printf "TILRAUN: Halló Heimur!" >file &&
+ git add file &&
+ LC_ALL="$is_IS_iso_locale" &&
+ export LC_ALL
+'
+
+test_expect_success GETTEXT_ISO_LOCALE,LIBPCRE 'grep pcre string' '
+ git grep --perl-regexp -i "TILRAUN: H.lló Heimur!" &&
+ git grep --perl-regexp -i "TILRAUN: H.LLÓ HEIMUR!"
+'
+
+test_done
diff --git a/t/t8008-blame-formats.sh b/t/t8008-blame-formats.sh
index 29f84a6..92c8e79 100755
--- a/t/t8008-blame-formats.sh
+++ b/t/t8008-blame-formats.sh
@@ -87,4 +87,21 @@ test_expect_success 'blame --line-porcelain output' '
test_cmp expect actual
'
+test_expect_success '--porcelain detects first non-blank line as subject' '
+ (
+ GIT_INDEX_FILE=.git/tmp-index &&
+ export GIT_INDEX_FILE &&
+ echo "This is it" >single-file &&
+ git add single-file &&
+ tree=$(git write-tree) &&
+ commit=$(printf "%s\n%s\n%s\n\n\n \noneline\n\nbody\n" \
+ "tree $tree" \
+ "author A <a@b.c> 123456789 +0000" \
+ "committer C <c@d.e> 123456789 +0000" |
+ git hash-object -w -t commit --stdin) &&
+ git blame --porcelain $commit -- single-file >output &&
+ grep "^summary oneline$" output
+ )
+'
+
test_done
diff --git a/t/t9003-help-autocorrect.sh b/t/t9003-help-autocorrect.sh
index dfe95c9..b1c7919 100755
--- a/t/t9003-help-autocorrect.sh
+++ b/t/t9003-help-autocorrect.sh
@@ -31,10 +31,10 @@ test_expect_success 'autocorrect showing candidates' '
git config help.autocorrect 0 &&
test_must_fail git lfg 2>actual &&
- sed -e "1,/^Did you mean this/d" actual | grep lgf &&
+ grep "^ lgf" actual &&
test_must_fail git distimdist 2>actual &&
- sed -e "1,/^Did you mean this/d" actual | grep distimdistim
+ grep "^ distimdistim" actual
'
test_expect_success 'autocorrect running commands' '
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 74d740d..2e0ba3e 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -7,23 +7,6 @@ test_description='test git fast-import utility'
. ./test-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
-# Print $1 bytes from stdin to stdout.
-#
-# This could be written as "head -c $1", but IRIX "head" does not
-# support the -c option.
-head_c () {
- perl -e '
- my $len = $ARGV[1];
- while ($len > 0) {
- my $s;
- my $nread = sysread(STDIN, $s, $len);
- die "cannot read: $!" unless defined($nread);
- print $s;
- $len -= $nread;
- }
- ' - "$1"
-}
-
verify_packs () {
for p in .git/objects/pack/*.pack
do
@@ -2481,7 +2464,7 @@ test_expect_success PIPE 'R: copy using cat-file' '
read blob_id type size <&3 &&
echo "$blob_id $type $size" >response &&
- head_c $size >blob <&3 &&
+ test_copy_bytes $size >blob <&3 &&
read newline <&3 &&
cat <<-EOF &&
@@ -2524,7 +2507,7 @@ test_expect_success PIPE 'R: print blob mid-commit' '
EOF
read blob_id type size <&3 &&
- head_c $size >actual <&3 &&
+ test_copy_bytes $size >actual <&3 &&
read newline <&3 &&
echo
@@ -2559,7 +2542,7 @@ test_expect_success PIPE 'R: print staged blob within commit' '
echo "cat-blob $to_get" &&
read blob_id type size <&3 &&
- head_c $size >actual <&3 &&
+ test_copy_bytes $size >actual <&3 &&
read newline <&3 &&
echo deleteall
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 48884d5..4f7eadb 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -612,7 +612,7 @@ test_must_fail () {
then
echo >&2 "test_must_fail: command succeeded: $*"
return 1
- elif test $exit_code -eq 141 && list_contains "$_test_ok" sigpipe
+ elif test_match_signal 13 $exit_code && list_contains "$_test_ok" sigpipe
then
return 0
elif test $exit_code -gt 129 && test $exit_code -le 192
@@ -961,3 +961,32 @@ test_env () {
done
)
}
+
+# Returns true if the numeric exit code in "$2" represents the expected signal
+# in "$1". Signals should be given numerically.
+test_match_signal () {
+ if test "$2" = "$((128 + $1))"
+ then
+ # POSIX
+ return 0
+ elif test "$2" = "$((256 + $1))"
+ then
+ # ksh
+ return 0
+ fi
+ return 1
+}
+
+# Read up to "$1" bytes (or to EOF) from stdin and write them to stdout.
+test_copy_bytes () {
+ perl -e '
+ my $len = $ARGV[1];
+ while ($len > 0) {
+ my $s;
+ my $nread = sysread(STDIN, $s, $len);
+ die "cannot read: $!" unless defined($nread);
+ print $s;
+ $len -= $nread;
+ }
+ ' - "$1"
+}
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0055ebb..11201e9 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1111,3 +1111,12 @@ run_with_limited_cmdline () {
}
test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'
+
+build_option () {
+ git version --build-options |
+ sed -ne "s/^$1: //p"
+}
+
+test_lazy_prereq LONG_IS_64BIT '
+ test 8 -le "$(build_option sizeof-long)"
+'