summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/README109
-rw-r--r--t/helper/test-dump-fsmonitor.c3
-rw-r--r--t/helper/test-dump-untracked-cache.c3
-rw-r--r--t/helper/test-parse-options.c5
-rw-r--r--t/helper/test-pkt-line.c3
-rw-r--r--t/helper/test-repository.c10
-rw-r--r--t/helper/test-revision-walking.c2
-rw-r--r--t/helper/test-tool.c6
-rw-r--r--t/helper/test-tool.h6
-rwxr-xr-xt/lib-gpg.sh9
-rw-r--r--t/oid-info/README19
-rw-r--r--t/oid-info/hash-info8
-rw-r--r--t/oid-info/oid29
-rwxr-xr-xt/perf/p1450-fsck.sh13
-rwxr-xr-xt/perf/p1451-fsck-skip-list.sh40
-rwxr-xr-xt/t0000-basic.sh219
-rwxr-xr-xt/t0002-gitfile.sh27
-rwxr-xr-xt/t0012-help.sh4
-rwxr-xr-xt/t0014-alias.sh40
-rwxr-xr-xt/t0021-conversion.sh4
-rwxr-xr-xt/t0040-parse-options.sh70
-rwxr-xr-xt/t0064-sha1-array.sh49
-rwxr-xr-xt/t0410-partial-clone.sh41
-rwxr-xr-xt/t1006-cat-file.sh14
-rwxr-xr-xt/t1300-config.sh9
-rwxr-xr-xt/t1303-wacky-config.sh4
-rwxr-xr-xt/t1400-update-ref.sh4
-rwxr-xr-xt/t1405-main-ref-store.sh4
-rwxr-xr-xt/t1406-submodule-ref-store.sh6
-rwxr-xr-xt/t1407-worktree-ref-store.sh4
-rwxr-xr-xt/t1500-rev-parse.sh16
-rwxr-xr-xt/t1700-split-index.sh15
-rwxr-xr-xt/t2101-update-index-reupdate.sh2
-rwxr-xr-xt/t3200-branch.sh2
-rwxr-xr-xt/t3320-notes-merge-worktrees.sh4
-rwxr-xr-xt/t3400-rebase.sh8
-rwxr-xr-xt/t3417-rebase-whitespace-fix.sh6
-rwxr-xr-xt/t3702-add-edit.sh4
-rwxr-xr-xt/t3903-stash.sh8
-rwxr-xr-xt/t3905-stash-include-untracked.sh2
-rwxr-xr-xt/t4025-hunk-header.sh2
-rwxr-xr-xt/t4117-apply-reject.sh6
-rwxr-xr-xt/t4124-apply-ws-rule.sh30
-rwxr-xr-xt/t4138-apply-ws-expansion.sh2
-rwxr-xr-xt/t5317-pack-objects-filter-objects.sh360
-rwxr-xr-xt/t5318-commit-graph.sh67
-rwxr-xr-xt/t5319-multi-pack-index.sh136
-rwxr-xr-xt/t5500-fetch-pack.sh7
-rwxr-xr-xt/t5504-fetch-receive-strict.sh72
-rwxr-xr-xt/t5551-http-fetch-smart.sh68
-rwxr-xr-xt/t5616-partial-clone.sh67
-rwxr-xr-xt/t5701-git-serve.sh50
-rwxr-xr-xt/t5702-protocol-v2.sh16
-rwxr-xr-xt/t5703-upload-pack-ref-in-want.sh14
-rwxr-xr-xt/t6023-merge-file.sh12
-rwxr-xr-xt/t6027-merge-binary.sh4
-rwxr-xr-xt/t6031-merge-filemode.sh2
-rwxr-xr-xt/t6112-rev-list-filters-objects.sh237
-rwxr-xr-xt/t6500-gc.sh27
-rwxr-xr-xt/t7063-status-untracked-cache.sh68
-rwxr-xr-xt/t7201-co.sh4
-rwxr-xr-xt/t7406-submodule-update.sh8
-rwxr-xr-xt/t7500-commit.sh23
-rwxr-xr-xt/t7501-commit.sh10
-rwxr-xr-xt/t7519-status-fsmonitor.sh25
-rwxr-xr-xt/t7800-difftool.sh2
-rwxr-xr-xt/t7810-grep.sh12
-rwxr-xr-xt/t9100-git-svn-basic.sh2
-rwxr-xr-xt/t9101-git-svn-props.sh34
-rwxr-xr-xt/t9133-git-svn-nested-git-repo.sh6
-rwxr-xr-xt/t9600-cvsimport.sh2
-rwxr-xr-xt/t9603-cvsimport-patchsets.sh4
-rwxr-xr-xt/t9604-cvsimport-timestamps.sh4
-rw-r--r--t/test-lib-functions.sh69
-rw-r--r--t/test-lib.sh35
75 files changed, 1630 insertions, 688 deletions
diff --git a/t/README b/t/README
index 3ea6c85..8847489 100644
--- a/t/README
+++ b/t/README
@@ -315,7 +315,7 @@ packs on demand. This normally only happens when the object size is
over 2GB. This variable forces the code path on any object larger than
<n> bytes.
-GIT_TEST_OE_DELTA_SIZE=<n> exercises the uncomon pack-objects code
+GIT_TEST_OE_DELTA_SIZE=<n> exercises the uncommon pack-objects code
path where deltas larger than this limit require extra memory
allocation for bookkeeping.
@@ -327,6 +327,22 @@ GIT_TEST_COMMIT_GRAPH=<boolean>, when true, forces the commit-graph to
be written after every 'git commit' command, and overrides the
'core.commitGraph' setting to true.
+GIT_TEST_FSMONITOR=$PWD/t7519/fsmonitor-all exercises the fsmonitor
+code path for utilizing a file system monitor to speed up detecting
+new or changed files.
+
+GIT_TEST_INDEX_VERSION=<n> exercises the index read/write code path
+for the index version specified. Can be set to any valid version
+(currently 2, 3, or 4).
+
+GIT_TEST_PRELOAD_INDEX=<boolean> exercises the preload-index code path
+by overriding the minimum number of cache entries required per thread.
+
+GIT_TEST_INDEX_THREADS=<n> enables exercising the multi-threaded loading
+of the index for the whole test suite by bypassing the default number of
+cache entries and thread minimums. Setting this to 1 will make the
+index loading single threaded.
+
Naming Tests
------------
@@ -401,13 +417,13 @@ This test harness library does the following things:
consistently when command line arguments --verbose (or -v),
--debug (or -d), and --immediate (or -i) is given.
-Do's, don'ts & things to keep in mind
--------------------------------------
+Do's & don'ts
+-------------
Here are a few examples of things you probably should and shouldn't do
when writing tests.
-Do:
+Here are the "do's:"
- Put all code inside test_expect_success and other assertions.
@@ -452,16 +468,21 @@ Do:
Windows, where the shell (MSYS bash) mangles absolute path names.
For details, see the commit message of 4114156ae9.
-Don't:
+ - Remember that inside the <script> part, the standard output and
+ standard error streams are discarded, and the test harness only
+ reports "ok" or "not ok" to the end user running the tests. Under
+ --verbose, they are shown to help debug the tests.
+
+And here are the "don'ts:"
- - exit() within a <script> part.
+ - Don't exit() within a <script> part.
The harness will catch this as a programming error of the test.
Use test_done instead if you need to stop the tests early (see
"Skipping tests" below).
- - use '! git cmd' when you want to make sure the git command exits
- with failure in a controlled way by calling "die()". Instead,
+ - Don't use '! git cmd' when you want to make sure the git command
+ exits with failure in a controlled way by calling "die()". Instead,
use 'test_must_fail git cmd'. This will signal a failure if git
dies in an unexpected way (e.g. segfault).
@@ -469,8 +490,35 @@ Don't:
platform commands; just use '! cmd'. We are not in the business
of verifying that the world given to us sanely works.
- - use perl without spelling it as "$PERL_PATH". This is to help our
- friends on Windows where the platform Perl often adds CR before
+ - Don't feed the output of a git command to a pipe, as in:
+
+ git -C repo ls-files |
+ xargs -n 1 basename |
+ grep foo
+
+ which will discard git's exit code and may mask a crash. In the
+ above example, all exit codes are ignored except grep's.
+
+ Instead, write the output of that command to a temporary
+ file with ">" or assign it to a variable with "x=$(git ...)" rather
+ than pipe it.
+
+ - Don't use command substitution in a way that discards git's exit
+ code. When assigning to a variable, the exit code is not discarded,
+ e.g.:
+
+ x=$(git cat-file -p $sha) &&
+ ...
+
+ is OK because a crash in "git cat-file" will cause the "&&" chain
+ to fail, but:
+
+ test "refs/heads/foo" = "$(git symbolic-ref HEAD)"
+
+ is not OK and a crash in git could go undetected.
+
+ - Don't use perl without spelling it as "$PERL_PATH". This is to help
+ our friends on Windows where the platform Perl often adds CR before
the end of line, and they bundle Git with a version of Perl that
does not do so, whose path is specified with $PERL_PATH. Note that we
provide a "perl" function which uses $PERL_PATH under the hood, so
@@ -478,17 +526,17 @@ Don't:
(but you do, for example, on a shebang line or in a sub script
created via "write_script").
- - use sh without spelling it as "$SHELL_PATH", when the script can
- be misinterpreted by broken platform shell (e.g. Solaris).
+ - Don't use sh without spelling it as "$SHELL_PATH", when the script
+ can be misinterpreted by broken platform shell (e.g. Solaris).
- - chdir around in tests. It is not sufficient to chdir to
+ - Don't chdir around in tests. It is not sufficient to chdir to
somewhere and then chdir back to the original location later in
the test, as any intermediate step can fail and abort the test,
causing the next test to start in an unexpected directory. Do so
inside a subshell if necessary.
- - save and verify the standard error of compound commands, i.e. group
- commands, subshells, and shell functions (except test helper
+ - Don't save and verify the standard error of compound commands, i.e.
+ group commands, subshells, and shell functions (except test helper
functions like 'test_must_fail') like this:
( cd dir && git cmd ) 2>error &&
@@ -503,7 +551,7 @@ Don't:
( cd dir && git cmd 2>../error ) &&
test_cmp expect error
- - Break the TAP output
+ - Don't break the TAP output
The raw output from your test may be interpreted by a TAP harness. TAP
harnesses will ignore everything they don't know about, but don't step
@@ -523,13 +571,6 @@ Don't:
but the best indication is to just run the tests with prove(1),
it'll complain if anything is amiss.
-Keep in mind:
-
- - Inside the <script> part, the standard output and standard error
- streams are discarded, and the test harness only reports "ok" or
- "not ok" to the end user running the tests. Under --verbose, they
- are shown to help debugging the tests.
-
Skipping tests
--------------
@@ -814,6 +855,28 @@ library for your script to use.
the symbolic link in the file system and a part that does; then only
the latter part need be protected by a SYMLINKS prerequisite (see below).
+ - test_oid_init
+
+ This function loads facts and useful object IDs related to the hash
+ algorithm(s) in use from the files in t/oid-info.
+
+ - test_oid_cache
+
+ This function reads per-hash algorithm information from standard
+ input (usually a heredoc) in the format described in
+ t/oid-info/README. This is useful for test-specific values, such as
+ object IDs, which must vary based on the hash algorithm.
+
+ Certain fixed values, such as hash sizes and common placeholder
+ object IDs, can be loaded with test_oid_init (described above).
+
+ - test_oid <key>
+
+ This function looks up a value for the hash algorithm in use, based
+ on the key given. The value must have been loaded using
+ test_oid_init or test_oid_cache. Providing an unknown key is an
+ error.
+
Prerequisites
-------------
diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c
index ad45270..08e3684 100644
--- a/t/helper/test-dump-fsmonitor.c
+++ b/t/helper/test-dump-fsmonitor.c
@@ -1,6 +1,7 @@
+#include "test-tool.h"
#include "cache.h"
-int cmd_main(int ac, const char **av)
+int cmd__dump_fsmonitor(int ac, const char **av)
{
struct index_state *istate = &the_index;
int i;
diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
index bd92fb3..52870eb 100644
--- a/t/helper/test-dump-untracked-cache.c
+++ b/t/helper/test-dump-untracked-cache.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
#include "cache.h"
#include "dir.h"
@@ -38,7 +39,7 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
strbuf_setlen(base, len);
}
-int cmd_main(int ac, const char **av)
+int cmd__dump_untracked_cache(int ac, const char **av)
{
struct untracked_cache *uc;
struct strbuf base = STRBUF_INIT;
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c
index 630c76d..9cb8a0e 100644
--- a/t/helper/test-parse-options.c
+++ b/t/helper/test-parse-options.c
@@ -1,3 +1,4 @@
+#include "test-tool.h"
#include "cache.h"
#include "parse-options.h"
#include "string-list.h"
@@ -94,11 +95,11 @@ static void show(struct string_list *expect, int *status, const char *fmt, ...)
strbuf_release(&buf);
}
-int cmd_main(int argc, const char **argv)
+int cmd__parse_options(int argc, const char **argv)
{
const char *prefix = "prefix/";
const char *usage[] = {
- "test-parse-options <options>",
+ "test-tool parse-options <options>",
"",
"A helper function for the parse-options API.",
NULL
diff --git a/t/helper/test-pkt-line.c b/t/helper/test-pkt-line.c
index 30775f9..282d536 100644
--- a/t/helper/test-pkt-line.c
+++ b/t/helper/test-pkt-line.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "test-tool.h"
#include "pkt-line.h"
static void pack_line(const char *line)
@@ -79,7 +80,7 @@ static void unpack_sideband(void)
}
}
-int cmd_main(int argc, const char **argv)
+int cmd__pkt_line(int argc, const char **argv)
{
if (argc < 2)
die("too few arguments");
diff --git a/t/helper/test-repository.c b/t/helper/test-repository.c
index 2762ca6..6a84a53 100644
--- a/t/helper/test-repository.c
+++ b/t/helper/test-repository.c
@@ -15,7 +15,10 @@ static void test_parse_commit_in_graph(const char *gitdir, const char *worktree,
struct commit *c;
struct commit_list *parent;
- repo_init(&r, gitdir, worktree);
+ setup_git_env(gitdir);
+
+ if (repo_init(&r, gitdir, worktree))
+ die("Couldn't init repo");
c = lookup_commit(&r, commit_oid);
@@ -38,7 +41,10 @@ static void test_get_commit_tree_in_graph(const char *gitdir,
struct commit *c;
struct tree *tree;
- repo_init(&r, gitdir, worktree);
+ setup_git_env(gitdir);
+
+ if (repo_init(&r, gitdir, worktree))
+ die("Couldn't init repo");
c = lookup_commit(&r, commit_oid);
diff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c
index 4f8bc75..625b2db 100644
--- a/t/helper/test-revision-walking.c
+++ b/t/helper/test-revision-walking.c
@@ -32,7 +32,7 @@ static int run_revision_walk(void)
int argc = ARRAY_SIZE(argv) - 1;
int got_revision = 0;
- init_revisions(&rev, NULL);
+ repo_init_revisions(the_repository, &rev, NULL);
setup_revisions(argc, argv, &rev, NULL);
if (prepare_revision_walk(&rev))
die("revision walk setup failed");
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index b87a8c1..6b5836d 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -14,7 +14,9 @@ static struct test_cmd cmds[] = {
{ "delta", cmd__delta },
{ "drop-caches", cmd__drop_caches },
{ "dump-cache-tree", cmd__dump_cache_tree },
+ { "dump-fsmonitor", cmd__dump_fsmonitor },
{ "dump-split-index", cmd__dump_split_index },
+ { "dump-untracked-cache", cmd__dump_untracked_cache },
{ "example-decorate", cmd__example_decorate },
{ "genrandom", cmd__genrandom },
{ "hashmap", cmd__hashmap },
@@ -25,7 +27,9 @@ static struct test_cmd cmds[] = {
{ "mergesort", cmd__mergesort },
{ "mktemp", cmd__mktemp },
{ "online-cpus", cmd__online_cpus },
+ { "parse-options", cmd__parse_options },
{ "path-utils", cmd__path_utils },
+ { "pkt-line", cmd__pkt_line },
{ "prio-queue", cmd__prio_queue },
{ "reach", cmd__reach },
{ "read-cache", cmd__read_cache },
@@ -36,8 +40,8 @@ static struct test_cmd cmds[] = {
{ "revision-walking", cmd__revision_walking },
{ "run-command", cmd__run_command },
{ "scrap-cache-tree", cmd__scrap_cache_tree },
- { "sha1-array", cmd__sha1_array },
{ "sha1", cmd__sha1 },
+ { "sha1-array", cmd__sha1_array },
{ "sigchain", cmd__sigchain },
{ "strcmp-offset", cmd__strcmp_offset },
{ "string-list", cmd__string_list },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index e074957..e489056 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -10,7 +10,9 @@ int cmd__date(int argc, const char **argv);
int cmd__delta(int argc, const char **argv);
int cmd__drop_caches(int argc, const char **argv);
int cmd__dump_cache_tree(int argc, const char **argv);
+int cmd__dump_fsmonitor(int argc, const char **argv);
int cmd__dump_split_index(int argc, const char **argv);
+int cmd__dump_untracked_cache(int argc, const char **argv);
int cmd__example_decorate(int argc, const char **argv);
int cmd__genrandom(int argc, const char **argv);
int cmd__hashmap(int argc, const char **argv);
@@ -21,7 +23,9 @@ int cmd__match_trees(int argc, const char **argv);
int cmd__mergesort(int argc, const char **argv);
int cmd__mktemp(int argc, const char **argv);
int cmd__online_cpus(int argc, const char **argv);
+int cmd__parse_options(int argc, const char **argv);
int cmd__path_utils(int argc, const char **argv);
+int cmd__pkt_line(int argc, const char **argv);
int cmd__prio_queue(int argc, const char **argv);
int cmd__reach(int argc, const char **argv);
int cmd__read_cache(int argc, const char **argv);
@@ -32,8 +36,8 @@ int cmd__repository(int argc, const char **argv);
int cmd__revision_walking(int argc, const char **argv);
int cmd__run_command(int argc, const char **argv);
int cmd__scrap_cache_tree(int argc, const char **argv);
-int cmd__sha1_array(int argc, const char **argv);
int cmd__sha1(int argc, const char **argv);
+int cmd__sha1_array(int argc, const char **argv);
int cmd__sigchain(int argc, const char **argv);
int cmd__strcmp_offset(int argc, const char **argv);
int cmd__string_list(int argc, const char **argv);
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index 3fe0287..f1277be 100755
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -57,9 +57,12 @@ then
echo | gpgsm --homedir "${GNUPGHOME}" 2>/dev/null \
--passphrase-fd 0 --pinentry-mode loopback \
--import "$TEST_DIRECTORY"/lib-gpg/gpgsm_cert.p12 &&
- gpgsm --homedir "${GNUPGHOME}" 2>/dev/null -K \
- | grep fingerprint: | cut -d" " -f4 | tr -d '\n' > \
- ${GNUPGHOME}/trustlist.txt &&
+
+ gpgsm --homedir "${GNUPGHOME}" 2>/dev/null -K |
+ grep fingerprint: |
+ cut -d" " -f4 |
+ tr -d '\n' >"${GNUPGHOME}/trustlist.txt" &&
+
echo " S relax" >> ${GNUPGHOME}/trustlist.txt &&
(gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) &&
echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \
diff --git a/t/oid-info/README b/t/oid-info/README
new file mode 100644
index 0000000..27f843f
--- /dev/null
+++ b/t/oid-info/README
@@ -0,0 +1,19 @@
+This directory contains various per-hash values that are used in the testsuite.
+
+Each file contains lines containing a key-value pair; blank lines and lines
+starting with `#` are ignored. The key and value are separated by whitespace
+(specifically, those whitespace in the default `$IFS`). The key consists only
+of shell identifier characters, and the value consists of a hash algorithm,
+colon, and value. The hash algorithm also consists only of shell identifier
+characters; it should match the value in sha1-file.c.
+
+For example, the following lines map the key "rawsz" to "20" if SHA-1 is in use
+and to "32" if SHA-256 is in use:
+
+----
+rawsz sha1:20
+rawsz sha256:32
+----
+
+The keys and values used here are loaded by `test_oid_init` (see the README file
+in the "t" directory) and are used by calling `test_oid`.
diff --git a/t/oid-info/hash-info b/t/oid-info/hash-info
new file mode 100644
index 0000000..ccdbfdf
--- /dev/null
+++ b/t/oid-info/hash-info
@@ -0,0 +1,8 @@
+rawsz sha1:20
+rawsz sha256:32
+
+hexsz sha1:40
+hexsz sha256:64
+
+zero sha1:0000000000000000000000000000000000000000
+zero sha256:0000000000000000000000000000000000000000000000000000000000000000
diff --git a/t/oid-info/oid b/t/oid-info/oid
new file mode 100644
index 0000000..a754970
--- /dev/null
+++ b/t/oid-info/oid
@@ -0,0 +1,29 @@
+# These are some common invalid and partial object IDs used in tests.
+001 sha1:0000000000000000000000000000000000000001
+001 sha256:0000000000000000000000000000000000000000000000000000000000000001
+002 sha1:0000000000000000000000000000000000000002
+002 sha256:0000000000000000000000000000000000000000000000000000000000000002
+003 sha1:0000000000000000000000000000000000000003
+003 sha256:0000000000000000000000000000000000000000000000000000000000000003
+004 sha1:0000000000000000000000000000000000000004
+004 sha256:0000000000000000000000000000000000000000000000000000000000000004
+005 sha1:0000000000000000000000000000000000000005
+005 sha256:0000000000000000000000000000000000000000000000000000000000000005
+006 sha1:0000000000000000000000000000000000000006
+006 sha256:0000000000000000000000000000000000000000000000000000000000000006
+007 sha1:0000000000000000000000000000000000000007
+007 sha256:0000000000000000000000000000000000000000000000000000000000000007
+# All zeros or Fs missing one or two hex segments.
+zero_1 sha1:000000000000000000000000000000000000000
+zero_1 sha256:000000000000000000000000000000000000000000000000000000000000000
+zero_2 sha1:00000000000000000000000000000000000000
+zero_2 sha256:00000000000000000000000000000000000000000000000000000000000000
+ff_1 sha1:fffffffffffffffffffffffffffffffffffffff
+ff_1 sha256:fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+ff_2 sha1:ffffffffffffffffffffffffffffffffffffff
+ff_2 sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
+# More various invalid OIDs.
+numeric sha1:0123456789012345678901234567890123456789
+numeric sha256:0123456789012345678901234567890123456789012345678901234567890123
+deadbeef sha1:deadbeefdeadbeefdeadbeefdeadbeefdeadbeef
+deadbeef sha256:deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef
diff --git a/t/perf/p1450-fsck.sh b/t/perf/p1450-fsck.sh
new file mode 100755
index 0000000..ae1b841
--- /dev/null
+++ b/t/perf/p1450-fsck.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+test_description='Test fsck performance'
+
+. ./perf-lib.sh
+
+test_perf_large_repo
+
+test_perf 'fsck' '
+ git fsck
+'
+
+test_done
diff --git a/t/perf/p1451-fsck-skip-list.sh b/t/perf/p1451-fsck-skip-list.sh
new file mode 100755
index 0000000..c2b97d2
--- /dev/null
+++ b/t/perf/p1451-fsck-skip-list.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+test_description='Test fsck skipList performance'
+
+. ./perf-lib.sh
+
+test_perf_fresh_repo
+
+n=1000000
+
+test_expect_success "setup $n bad commits" '
+ for i in $(test_seq 1 $n)
+ do
+ echo "commit refs/heads/master" &&
+ echo "committer C <c@example.com> 1234567890 +0000" &&
+ echo "data <<EOF" &&
+ echo "$i.Q." &&
+ echo "EOF"
+ done | q_to_nul | git fast-import
+'
+
+skip=0
+while test $skip -le $n
+do
+ test_expect_success "create skipList for $skip bad commits" '
+ git log --format=%H --max-count=$skip |
+ sort >skiplist
+ '
+
+ test_perf "fsck with $skip skipped bad commits" '
+ git -c fsck.skipList=skiplist fsck
+ '
+
+ case $skip in
+ 0) skip=1 ;;
+ *) skip=${skip}0 ;;
+ esac
+done
+
+test_done
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 850f651..4d23373 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -87,6 +87,10 @@ _run_sub_test_lib_test_common () {
passing metrics
'
+ # Tell the framework that we are self-testing to make sure
+ # it yields a stable result.
+ GIT_TEST_FRAMEWORK_SELFTEST=t &&
+
# Point to the t/test-lib.sh, which isn't in ../ as usual
. "\$TEST_DIRECTORY"/test-lib.sh
EOF
@@ -821,9 +825,87 @@ test_expect_success 'tests clean up even on failures' "
EOF
"
+test_expect_success 'test_oid setup' '
+ test_oid_init
+'
+
+test_expect_success 'test_oid provides sane info by default' '
+ test_oid zero >actual &&
+ grep "^00*\$" actual &&
+ rawsz="$(test_oid rawsz)" &&
+ hexsz="$(test_oid hexsz)" &&
+ test "$hexsz" -eq $(wc -c <actual) &&
+ test $(( $rawsz * 2)) -eq "$hexsz"
+'
+
+test_expect_success 'test_oid can look up data for SHA-1' '
+ test_when_finished "test_detect_hash" &&
+ test_set_hash sha1 &&
+ test_oid zero >actual &&
+ grep "^00*\$" actual &&
+ rawsz="$(test_oid rawsz)" &&
+ hexsz="$(test_oid hexsz)" &&
+ test $(wc -c <actual) -eq 40 &&
+ test "$rawsz" -eq 20 &&
+ test "$hexsz" -eq 40
+'
+
+test_expect_success 'test_oid can look up data for SHA-256' '
+ test_when_finished "test_detect_hash" &&
+ test_set_hash sha256 &&
+ test_oid zero >actual &&
+ grep "^00*\$" actual &&
+ rawsz="$(test_oid rawsz)" &&
+ hexsz="$(test_oid hexsz)" &&
+ test $(wc -c <actual) -eq 64 &&
+ test "$rawsz" -eq 32 &&
+ test "$hexsz" -eq 64
+'
+
################################################################
# Basics of the basics
+test_oid_cache <<\EOF
+path0f sha1:f87290f8eb2cbbea7857214459a0739927eab154
+path0f sha256:638106af7c38be056f3212cbd7ac65bc1bac74f420ca5a436ff006a9d025d17d
+
+path0s sha1:15a98433ae33114b085f3eb3bb03b832b3180a01
+path0s sha256:3a24cc53cf68edddac490bbf94a418a52932130541361f685df685e41dd6c363
+
+path2f sha1:3feff949ed00a62d9f7af97c15cd8a30595e7ac7
+path2f sha256:2a7f36571c6fdbaf0e3f62751a0b25a3f4c54d2d1137b3f4af9cb794bb498e5f
+
+path2s sha1:d8ce161addc5173867a3c3c730924388daedbc38
+path2s sha256:18fd611b787c2e938ddcc248fabe4d66a150f9364763e9ec133dd01d5bb7c65a
+
+path2d sha1:58a09c23e2ca152193f2786e06986b7b6712bdbe
+path2d sha256:00e4b32b96e7e3d65d79112dcbea53238a22715f896933a62b811377e2650c17
+
+path3f sha1:0aa34cae68d0878578ad119c86ca2b5ed5b28376
+path3f sha256:09f58616b951bd571b8cb9dc76d372fbb09ab99db2393f5ab3189d26c45099ad
+
+path3s sha1:8599103969b43aff7e430efea79ca4636466794f
+path3s sha256:fce1aed087c053306f3f74c32c1a838c662bbc4551a7ac2420f5d6eb061374d0
+
+path3d sha1:21ae8269cacbe57ae09138dcc3a2887f904d02b3
+path3d sha256:9b60497be959cb830bf3f0dc82bcc9ad9e925a24e480837ade46b2295e47efe1
+
+subp3f sha1:00fb5908cb97c2564a9783c0c64087333b3b464f
+subp3f sha256:a1a9e16998c988453f18313d10375ee1d0ddefe757e710dcae0d66aa1e0c58b3
+
+subp3s sha1:6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c
+subp3s sha256:81759d9f5e93c6546ecfcadb560c1ff057314b09f93fe8ec06e2d8610d34ef10
+
+subp3d sha1:3c5e5399f3a333eddecce7a9b9465b63f65f51e2
+subp3d sha256:76b4ef482d4fa1c754390344cf3851c7f883b27cf9bc999c6547928c46aeafb7
+
+root sha1:087704a96baf1c2d1c869a8b084481e121c88b5b
+root sha256:9481b52abab1b2ffeedbf9de63ce422b929f179c1b98ff7bee5f8f1bc0710751
+
+simpletree sha1:7bb943559a305bdd6bdee2cef6e5df2413c3d30a
+simpletree sha256:1710c07a6c86f9a3c7376364df04c47ee39e5a5e221fcdd84b743bc9bb7e2bc5
+EOF
+
# updating a new file without --add should fail.
test_expect_success 'git update-index without --add should fail adding' '
test_must_fail git update-index should-be-empty
@@ -839,8 +921,8 @@ test_expect_success 'writing tree out with git write-tree' '
'
# we know the shape and contents of the tree and know the object ID for it.
-test_expect_success SHA1 'validate object ID of a known tree' '
- test "$tree" = 7bb943559a305bdd6bdee2cef6e5df2413c3d30a
+test_expect_success 'validate object ID of a known tree' '
+ test "$tree" = "$(test_oid simpletree)"
'
# Removing paths.
@@ -882,16 +964,16 @@ test_expect_success 'showing stage with git ls-files --stage' '
git ls-files --stage >current
'
-test_expect_success SHA1 'validate git ls-files output for a known tree' '
- cat >expected <<-\EOF &&
- 100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0
- 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0 path0sym
- 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0 path2/file2
- 120000 d8ce161addc5173867a3c3c730924388daedbc38 0 path2/file2sym
- 100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0 path3/file3
- 120000 8599103969b43aff7e430efea79ca4636466794f 0 path3/file3sym
- 100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0 path3/subp3/file3
- 120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0 path3/subp3/file3sym
+test_expect_success 'validate git ls-files output for a known tree' '
+ cat >expected <<-EOF &&
+ 100644 $(test_oid path0f) 0 path0
+ 120000 $(test_oid path0s) 0 path0sym
+ 100644 $(test_oid path2f) 0 path2/file2
+ 120000 $(test_oid path2s) 0 path2/file2sym
+ 100644 $(test_oid path3f) 0 path3/file3
+ 120000 $(test_oid path3s) 0 path3/file3sym
+ 100644 $(test_oid subp3f) 0 path3/subp3/file3
+ 120000 $(test_oid subp3s) 0 path3/subp3/file3sym
EOF
test_cmp expected current
'
@@ -900,20 +982,20 @@ test_expect_success 'writing tree out with git write-tree' '
tree=$(git write-tree)
'
-test_expect_success SHA1 'validate object ID for a known tree' '
- test "$tree" = 087704a96baf1c2d1c869a8b084481e121c88b5b
+test_expect_success 'validate object ID for a known tree' '
+ test "$tree" = "$(test_oid root)"
'
test_expect_success 'showing tree with git ls-tree' '
git ls-tree $tree >current
'
-test_expect_success SHA1 'git ls-tree output for a known tree' '
- cat >expected <<-\EOF &&
- 100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
- 120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
- 040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
- 040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
+test_expect_success 'git ls-tree output for a known tree' '
+ cat >expected <<-EOF &&
+ 100644 blob $(test_oid path0f) path0
+ 120000 blob $(test_oid path0s) path0sym
+ 040000 tree $(test_oid path2d) path2
+ 040000 tree $(test_oid path3d) path3
EOF
test_cmp expected current
'
@@ -924,16 +1006,16 @@ test_expect_success 'showing tree with git ls-tree -r' '
git ls-tree -r $tree >current
'
-test_expect_success SHA1 'git ls-tree -r output for a known tree' '
- cat >expected <<-\EOF &&
- 100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
- 120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
- 100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
- 120000 blob d8ce161addc5173867a3c3c730924388daedbc38 path2/file2sym
- 100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376 path3/file3
- 120000 blob 8599103969b43aff7e430efea79ca4636466794f path3/file3sym
- 100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3
- 120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym
+test_expect_success 'git ls-tree -r output for a known tree' '
+ cat >expected <<-EOF &&
+ 100644 blob $(test_oid path0f) path0
+ 120000 blob $(test_oid path0s) path0sym
+ 100644 blob $(test_oid path2f) path2/file2
+ 120000 blob $(test_oid path2s) path2/file2sym
+ 100644 blob $(test_oid path3f) path3/file3
+ 120000 blob $(test_oid path3s) path3/file3sym
+ 100644 blob $(test_oid subp3f) path3/subp3/file3
+ 120000 blob $(test_oid subp3s) path3/subp3/file3sym
EOF
test_cmp expected current
'
@@ -943,19 +1025,19 @@ test_expect_success 'showing tree with git ls-tree -r -t' '
git ls-tree -r -t $tree >current
'
-test_expect_success SHA1 'git ls-tree -r output for a known tree' '
- cat >expected <<-\EOF &&
- 100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0
- 120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym
- 040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe path2
- 100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 path2/file2
- 120000 blob d8ce161addc5173867a3c3c730924388daedbc38 path2/file2sym
- 040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3
- 100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376 path3/file3
- 120000 blob 8599103969b43aff7e430efea79ca4636466794f path3/file3sym
- 040000 tree 3c5e5399f3a333eddecce7a9b9465b63f65f51e2 path3/subp3
- 100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f path3/subp3/file3
- 120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym
+test_expect_success 'git ls-tree -r output for a known tree' '
+ cat >expected <<-EOF &&
+ 100644 blob $(test_oid path0f) path0
+ 120000 blob $(test_oid path0s) path0sym
+ 040000 tree $(test_oid path2d) path2
+ 100644 blob $(test_oid path2f) path2/file2
+ 120000 blob $(test_oid path2s) path2/file2sym
+ 040000 tree $(test_oid path3d) path3
+ 100644 blob $(test_oid path3f) path3/file3
+ 120000 blob $(test_oid path3s) path3/file3sym
+ 040000 tree $(test_oid subp3d) path3/subp3
+ 100644 blob $(test_oid subp3f) path3/subp3/file3
+ 120000 blob $(test_oid subp3s) path3/subp3/file3sym
EOF
test_cmp expected current
'
@@ -964,26 +1046,27 @@ test_expect_success 'writing partial tree out with git write-tree --prefix' '
ptree=$(git write-tree --prefix=path3)
'
-test_expect_success SHA1 'validate object ID for a known tree' '
- test "$ptree" = 21ae8269cacbe57ae09138dcc3a2887f904d02b3
+test_expect_success 'validate object ID for a known tree' '
+ test "$ptree" = $(test_oid path3d)
'
test_expect_success 'writing partial tree out with git write-tree --prefix' '
ptree=$(git write-tree --prefix=path3/subp3)
'
-test_expect_success SHA1 'validate object ID for a known tree' '
- test "$ptree" = 3c5e5399f3a333eddecce7a9b9465b63f65f51e2
+test_expect_success 'validate object ID for a known tree' '
+ test "$ptree" = $(test_oid subp3d)
'
test_expect_success 'put invalid objects into the index' '
rm -f .git/index &&
- cat >badobjects <<-\EOF &&
- 100644 blob 1000000000000000000000000000000000000000 dir/file1
- 100644 blob 2000000000000000000000000000000000000000 dir/file2
- 100644 blob 3000000000000000000000000000000000000000 dir/file3
- 100644 blob 4000000000000000000000000000000000000000 dir/file4
- 100644 blob 5000000000000000000000000000000000000000 dir/file5
+ suffix=$(echo $ZERO_OID | sed -e "s/^.//") &&
+ cat >badobjects <<-EOF &&
+ 100644 blob $(test_oid 001) dir/file1
+ 100644 blob $(test_oid 002) dir/file2
+ 100644 blob $(test_oid 003) dir/file3
+ 100644 blob $(test_oid 004) dir/file4
+ 100644 blob $(test_oid 005) dir/file5
EOF
git update-index --index-info <badobjects
'
@@ -1006,19 +1089,19 @@ test_expect_success 'git read-tree followed by write-tree should be idempotent'
test "$newtree" = "$tree"
'
-test_expect_success SHA1 'validate git diff-files output for a know cache/work tree state' '
- cat >expected <<\EOF &&
-:100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M path0
-:120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M path0sym
-:100644 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0000000000000000000000000000000000000000 M path2/file2
-:120000 120000 d8ce161addc5173867a3c3c730924388daedbc38 0000000000000000000000000000000000000000 M path2/file2sym
-:100644 100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0000000000000000000000000000000000000000 M path3/file3
-:120000 120000 8599103969b43aff7e430efea79ca4636466794f 0000000000000000000000000000000000000000 M path3/file3sym
-:100644 100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0000000000000000000000000000000000000000 M path3/subp3/file3
-:120000 120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0000000000000000000000000000000000000000 M path3/subp3/file3sym
+test_expect_success 'validate git diff-files output for a know cache/work tree state' '
+ cat >expected <<EOF &&
+:100644 100644 $(test_oid path0f) $ZERO_OID M path0
+:120000 120000 $(test_oid path0s) $ZERO_OID M path0sym
+:100644 100644 $(test_oid path2f) $ZERO_OID M path2/file2
+:120000 120000 $(test_oid path2s) $ZERO_OID M path2/file2sym
+:100644 100644 $(test_oid path3f) $ZERO_OID M path3/file3
+:120000 120000 $(test_oid path3s) $ZERO_OID M path3/file3sym
+:100644 100644 $(test_oid subp3f) $ZERO_OID M path3/subp3/file3
+:120000 120000 $(test_oid subp3s) $ZERO_OID M path3/subp3/file3sym
EOF
git diff-files >current &&
- test_cmp current expected
+ test_cmp expected current
'
test_expect_success 'git update-index --refresh should succeed' '
@@ -1031,23 +1114,23 @@ test_expect_success 'no diff after checkout and git update-index --refresh' '
'
################################################################
-P=087704a96baf1c2d1c869a8b084481e121c88b5b
+P=$(test_oid root)
-test_expect_success SHA1 'git commit-tree records the correct tree in a commit' '
+test_expect_success 'git commit-tree records the correct tree in a commit' '
commit0=$(echo NO | git commit-tree $P) &&
tree=$(git show --pretty=raw $commit0 |
sed -n -e "s/^tree //p" -e "/^author /q") &&
test "z$tree" = "z$P"
'
-test_expect_success SHA1 'git commit-tree records the correct parent in a commit' '
+test_expect_success 'git commit-tree records the correct parent in a commit' '
commit1=$(echo NO | git commit-tree $P -p $commit0) &&
parent=$(git show --pretty=raw $commit1 |
sed -n -e "s/^parent //p" -e "/^author /q") &&
test "z$commit0" = "z$parent"
'
-test_expect_success SHA1 'git commit-tree omits duplicated parent in a commit' '
+test_expect_success 'git commit-tree omits duplicated parent in a commit' '
commit2=$(echo NO | git commit-tree $P -p $commit0 -p $commit0) &&
parent=$(git show --pretty=raw $commit2 |
sed -n -e "s/^parent //p" -e "/^author /q" |
diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh
index 3691023..0aa9908 100755
--- a/t/t0002-gitfile.sh
+++ b/t/t0002-gitfile.sh
@@ -92,11 +92,12 @@ test_expect_success 'enter_repo non-strict mode' '
mv .git .realgit &&
echo "gitdir: .realgit" >.git
) &&
+ head=$(git -C enter_repo rev-parse HEAD) &&
git ls-remote enter_repo >actual &&
- cat >expected <<-\EOF &&
- 946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD
- 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master
- 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo
+ cat >expected <<-EOF &&
+ $head HEAD
+ $head refs/heads/master
+ $head refs/tags/foo
EOF
test_cmp expected actual
'
@@ -106,21 +107,23 @@ test_expect_success 'enter_repo linked checkout' '
cd enter_repo &&
git worktree add ../foo refs/tags/foo
) &&
+ head=$(git -C enter_repo rev-parse HEAD) &&
git ls-remote foo >actual &&
- cat >expected <<-\EOF &&
- 946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD
- 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master
- 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo
+ cat >expected <<-EOF &&
+ $head HEAD
+ $head refs/heads/master
+ $head refs/tags/foo
EOF
test_cmp expected actual
'
test_expect_success 'enter_repo strict mode' '
+ head=$(git -C enter_repo rev-parse HEAD) &&
git ls-remote --upload-pack="git upload-pack --strict" foo/.git >actual &&
- cat >expected <<-\EOF &&
- 946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD
- 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master
- 946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo
+ cat >expected <<-EOF &&
+ $head HEAD
+ $head refs/heads/master
+ $head refs/tags/foo
EOF
test_cmp expected actual
'
diff --git a/t/t0012-help.sh b/t/t0012-help.sh
index bc27df7..e8ef730 100755
--- a/t/t0012-help.sh
+++ b/t/t0012-help.sh
@@ -29,9 +29,9 @@ test_expect_success "setup" '
# to verify
test_expect_success 'basic help commands' '
git help >/dev/null &&
- git help -a >/dev/null &&
+ git help -a --no-verbose >/dev/null &&
git help -g >/dev/null &&
- git help -av >/dev/null
+ git help -a >/dev/null
'
test_expect_success "works for commands and guides by default" '
diff --git a/t/t0014-alias.sh b/t/t0014-alias.sh
new file mode 100755
index 0000000..a070e64
--- /dev/null
+++ b/t/t0014-alias.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+test_description='git command aliasing'
+
+. ./test-lib.sh
+
+test_expect_success 'nested aliases - internal execution' '
+ git config alias.nested-internal-1 nested-internal-2 &&
+ git config alias.nested-internal-2 status &&
+ git nested-internal-1 >output &&
+ test_i18ngrep "^On branch " output
+'
+
+test_expect_success 'nested aliases - mixed execution' '
+ git config alias.nested-external-1 nested-external-2 &&
+ git config alias.nested-external-2 "!git nested-external-3" &&
+ git config alias.nested-external-3 status &&
+ git nested-external-1 >output &&
+ test_i18ngrep "^On branch " output
+'
+
+test_expect_success 'looping aliases - internal execution' '
+ git config alias.loop-internal-1 loop-internal-2 &&
+ git config alias.loop-internal-2 loop-internal-3 &&
+ git config alias.loop-internal-3 loop-internal-2 &&
+ test_must_fail git loop-internal-1 2>output &&
+ test_i18ngrep "^fatal: alias loop detected: expansion of" output
+'
+
+# This test is disabled until external loops are fixed, because would block
+# the test suite for a full minute.
+#
+#test_expect_failure 'looping aliases - mixed execution' '
+# git config alias.loop-mixed-1 loop-mixed-2 &&
+# git config alias.loop-mixed-2 "!git loop-mixed-1" &&
+# test_must_fail git loop-mixed-1 2>output &&
+# test_i18ngrep "^fatal: alias loop detected: expansion of" output
+#'
+
+test_done
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 308cd28..fd5f1ac 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -166,10 +166,10 @@ test_expect_success expanded_in_repo '
rm -f expanded-keywords expanded-keywords-crlf &&
git checkout -- expanded-keywords &&
- test_cmp expanded-keywords expected-output &&
+ test_cmp expected-output expanded-keywords &&
git checkout -- expanded-keywords-crlf &&
- test_cmp expanded-keywords-crlf expected-output-crlf
+ test_cmp expected-output-crlf expanded-keywords-crlf
'
# The use of %f in a filter definition is expanded to the path to
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 5b0560f..17d0c18 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -8,7 +8,7 @@ test_description='our own option parser'
. ./test-lib.sh
cat >expect <<\EOF
-usage: test-parse-options <options>
+usage: test-tool parse-options <options>
A helper function for the parse-options API.
@@ -52,7 +52,7 @@ Standard options
EOF
test_expect_success 'test help' '
- test_must_fail test-parse-options -h >output 2>output.err &&
+ test_must_fail test-tool parse-options -h >output 2>output.err &&
test_must_be_empty output.err &&
test_i18ncmp expect output
'
@@ -64,7 +64,7 @@ check () {
shift &&
expect="$1" &&
shift &&
- test-parse-options --expect="$what $expect" "$@"
+ test-tool parse-options --expect="$what $expect" "$@"
}
check_unknown_i18n() {
@@ -75,7 +75,7 @@ check_unknown_i18n() {
echo error: unknown switch \`${1#-}\' >expect ;;
esac &&
cat expect.err >>expect &&
- test_must_fail test-parse-options $* >output 2>output.err &&
+ test_must_fail test-tool parse-options $* >output 2>output.err &&
test_must_be_empty output &&
test_i18ncmp expect output.err
}
@@ -133,7 +133,7 @@ file: prefix/my.file
EOF
test_expect_success 'short options' '
- test-parse-options -s123 -b -i 1729 -m 16k -b -vv -n -F my.file \
+ test-tool parse-options -s123 -b -i 1729 -m 16k -b -vv -n -F my.file \
>output 2>output.err &&
test_cmp expect output &&
test_must_be_empty output.err
@@ -153,7 +153,7 @@ file: prefix/fi.le
EOF
test_expect_success 'long options' '
- test-parse-options --boolean --integer 1729 --magnitude 16k \
+ test-tool parse-options --boolean --integer 1729 --magnitude 16k \
--boolean --string2=321 --verbose --verbose --no-dry-run \
--abbrev=10 --file fi.le --obsolete \
>output 2>output.err &&
@@ -162,9 +162,9 @@ test_expect_success 'long options' '
'
test_expect_success 'missing required value' '
- test_expect_code 129 test-parse-options -s &&
- test_expect_code 129 test-parse-options --string &&
- test_expect_code 129 test-parse-options --file
+ test_expect_code 129 test-tool parse-options -s &&
+ test_expect_code 129 test-tool parse-options --string &&
+ test_expect_code 129 test-tool parse-options --file
'
cat >expect <<\EOF
@@ -184,7 +184,7 @@ arg 02: --boolean
EOF
test_expect_success 'intermingled arguments' '
- test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
+ test-tool parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \
>output 2>output.err &&
test_must_be_empty output.err &&
test_cmp expect output
@@ -204,21 +204,21 @@ file: (not set)
EOF
test_expect_success 'unambiguously abbreviated option' '
- test-parse-options --int 2 --boolean --no-bo >output 2>output.err &&
+ test-tool parse-options --int 2 --boolean --no-bo >output 2>output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'
test_expect_success 'unambiguously abbreviated option with "="' '
- test-parse-options --expect="integer: 2" --int=2
+ test-tool parse-options --expect="integer: 2" --int=2
'
test_expect_success 'ambiguously abbreviated option' '
- test_expect_code 129 test-parse-options --strin 123
+ test_expect_code 129 test-tool parse-options --strin 123
'
test_expect_success 'non ambiguous option (after two options it abbreviates)' '
- test-parse-options --expect="string: 123" --st 123
+ test-tool parse-options --expect="string: 123" --st 123
'
cat >typo.err <<\EOF
@@ -226,7 +226,7 @@ error: did you mean `--boolean` (with two dashes ?)
EOF
test_expect_success 'detect possible typos' '
- test_must_fail test-parse-options -boolean >output 2>output.err &&
+ test_must_fail test-tool parse-options -boolean >output 2>output.err &&
test_must_be_empty output &&
test_cmp typo.err output.err
'
@@ -236,13 +236,13 @@ error: did you mean `--ambiguous` (with two dashes ?)
EOF
test_expect_success 'detect possible typos' '
- test_must_fail test-parse-options -ambiguous >output 2>output.err &&
+ test_must_fail test-tool parse-options -ambiguous >output 2>output.err &&
test_must_be_empty output &&
test_cmp typo.err output.err
'
test_expect_success 'keep some options as arguments' '
- test-parse-options --expect="arg 00: --quux" --quux
+ test-tool parse-options --expect="arg 00: --quux" --quux
'
cat >expect <<\EOF
@@ -260,7 +260,7 @@ arg 00: foo
EOF
test_expect_success 'OPT_DATE() works' '
- test-parse-options -t "1970-01-01 00:00:01 +0000" \
+ test-tool parse-options -t "1970-01-01 00:00:01 +0000" \
foo -q >output 2>output.err &&
test_must_be_empty output.err &&
test_cmp expect output
@@ -281,13 +281,13 @@ file: (not set)
EOF
test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' '
- test-parse-options --length=four -b -4 >output 2>output.err &&
+ test-tool parse-options --length=four -b -4 >output 2>output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'
test_expect_success 'OPT_CALLBACK() and callback errors work' '
- test_must_fail test-parse-options --no-length >output 2>output.err &&
+ test_must_fail test-tool parse-options --no-length >output 2>output.err &&
test_must_be_empty output &&
test_must_be_empty output.err
'
@@ -306,31 +306,31 @@ file: (not set)
EOF
test_expect_success 'OPT_BIT() and OPT_SET_INT() work' '
- test-parse-options --set23 -bbbbb --no-or4 >output 2>output.err &&
+ test-tool parse-options --set23 -bbbbb --no-or4 >output 2>output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'
test_expect_success 'OPT_NEGBIT() and OPT_SET_INT() work' '
- test-parse-options --set23 -bbbbb --neg-or4 >output 2>output.err &&
+ test-tool parse-options --set23 -bbbbb --neg-or4 >output 2>output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'
test_expect_success 'OPT_BIT() works' '
- test-parse-options --expect="boolean: 6" -bb --or4
+ test-tool parse-options --expect="boolean: 6" -bb --or4
'
test_expect_success 'OPT_NEGBIT() works' '
- test-parse-options --expect="boolean: 6" -bb --no-neg-or4
+ test-tool parse-options --expect="boolean: 6" -bb --no-neg-or4
'
test_expect_success 'OPT_COUNTUP() with PARSE_OPT_NODASH works' '
- test-parse-options --expect="boolean: 6" + + + + + +
+ test-tool parse-options --expect="boolean: 6" + + + + + +
'
test_expect_success 'OPT_NUMBER_CALLBACK() works' '
- test-parse-options --expect="integer: 12345" -12345
+ test-tool parse-options --expect="integer: 12345" -12345
'
cat >expect <<\EOF
@@ -347,7 +347,7 @@ file: (not set)
EOF
test_expect_success 'negation of OPT_NONEG flags is not ambiguous' '
- test-parse-options --no-ambig >output 2>output.err &&
+ test-tool parse-options --no-ambig >output 2>output.err &&
test_must_be_empty output.err &&
test_cmp expect output
'
@@ -358,38 +358,38 @@ list: bar
list: baz
EOF
test_expect_success '--list keeps list of strings' '
- test-parse-options --list foo --list=bar --list=baz >output &&
+ test-tool parse-options --list foo --list=bar --list=baz >output &&
test_cmp expect output
'
test_expect_success '--no-list resets list' '
- test-parse-options --list=other --list=irrelevant --list=options \
+ test-tool parse-options --list=other --list=irrelevant --list=options \
--no-list --list=foo --list=bar --list=baz >output &&
test_cmp expect output
'
test_expect_success 'multiple quiet levels' '
- test-parse-options --expect="quiet: 3" -q -q -q
+ test-tool parse-options --expect="quiet: 3" -q -q -q
'
test_expect_success 'multiple verbose levels' '
- test-parse-options --expect="verbose: 3" -v -v -v
+ test-tool parse-options --expect="verbose: 3" -v -v -v
'
test_expect_success '--no-quiet sets --quiet to 0' '
- test-parse-options --expect="quiet: 0" --no-quiet
+ test-tool parse-options --expect="quiet: 0" --no-quiet
'
test_expect_success '--no-quiet resets multiple -q to 0' '
- test-parse-options --expect="quiet: 0" -q -q -q --no-quiet
+ test-tool parse-options --expect="quiet: 0" -q -q -q --no-quiet
'
test_expect_success '--no-verbose sets verbose to 0' '
- test-parse-options --expect="verbose: 0" --no-verbose
+ test-tool parse-options --expect="verbose: 0" --no-verbose
'
test_expect_success '--no-verbose resets multiple verbose to 0' '
- test-parse-options --expect="verbose: 0" -v -v -v --no-verbose
+ test-tool parse-options --expect="verbose: 0" -v -v -v --no-verbose
'
test_done
diff --git a/t/t0064-sha1-array.sh b/t/t0064-sha1-array.sh
index 6748450..5dda570 100755
--- a/t/t0064-sha1-array.sh
+++ b/t/t0064-sha1-array.sh
@@ -3,30 +3,30 @@
test_description='basic tests for the SHA1 array implementation'
. ./test-lib.sh
-echo20 () {
+echoid () {
prefix="${1:+$1 }"
shift
while test $# -gt 0
do
- echo "$prefix$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1"
+ echo "$prefix$ZERO_OID" | sed -e "s/00/$1/g"
shift
done
}
test_expect_success 'ordered enumeration' '
- echo20 "" 44 55 88 aa >expect &&
+ echoid "" 44 55 88 aa >expect &&
{
- echo20 append 88 44 aa 55 &&
+ echoid append 88 44 aa 55 &&
echo for_each_unique
} | test-tool sha1-array >actual &&
test_cmp expect actual
'
test_expect_success 'ordered enumeration with duplicate suppression' '
- echo20 "" 44 55 88 aa >expect &&
+ echoid "" 44 55 88 aa >expect &&
{
- echo20 append 88 44 aa 55 &&
- echo20 append 88 44 aa 55 &&
+ echoid append 88 44 aa 55 &&
+ echoid append 88 44 aa 55 &&
echo for_each_unique
} | test-tool sha1-array >actual &&
test_cmp expect actual
@@ -34,8 +34,8 @@ test_expect_success 'ordered enumeration with duplicate suppression' '
test_expect_success 'lookup' '
{
- echo20 append 88 44 aa 55 &&
- echo20 lookup 55
+ echoid append 88 44 aa 55 &&
+ echoid lookup 55
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -eq 1
@@ -43,8 +43,8 @@ test_expect_success 'lookup' '
test_expect_success 'lookup non-existing entry' '
{
- echo20 append 88 44 aa 55 &&
- echo20 lookup 33
+ echoid append 88 44 aa 55 &&
+ echoid lookup 33
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -lt 0
@@ -52,9 +52,9 @@ test_expect_success 'lookup non-existing entry' '
test_expect_success 'lookup with duplicates' '
{
- echo20 append 88 44 aa 55 &&
- echo20 append 88 44 aa 55 &&
- echo20 lookup 55
+ echoid append 88 44 aa 55 &&
+ echoid append 88 44 aa 55 &&
+ echoid lookup 55
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -ge 2 &&
@@ -63,19 +63,24 @@ test_expect_success 'lookup with duplicates' '
test_expect_success 'lookup non-existing entry with duplicates' '
{
- echo20 append 88 44 aa 55 &&
- echo20 append 88 44 aa 55 &&
- echo20 lookup 66
+ echoid append 88 44 aa 55 &&
+ echoid append 88 44 aa 55 &&
+ echoid lookup 66
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -lt 0
'
test_expect_success 'lookup with almost duplicate values' '
+ # n-1 5s
+ root=$(echoid "" 55) &&
+ root=${root%5} &&
{
- echo "append 5555555555555555555555555555555555555555" &&
- echo "append 555555555555555555555555555555555555555f" &&
- echo20 lookup 55
+ id1="${root}5" &&
+ id2="${root}f" &&
+ echo "append $id1" &&
+ echo "append $id2" &&
+ echoid lookup 55
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -eq 0
@@ -83,8 +88,8 @@ test_expect_success 'lookup with almost duplicate values' '
test_expect_success 'lookup with single duplicate value' '
{
- echo20 append 55 55 &&
- echo20 lookup 55
+ echoid append 55 55 &&
+ echoid lookup 55
} | test-tool sha1-array >actual &&
n=$(cat actual) &&
test "$n" -ge 0 &&
diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index cfd0655..c521d7d 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -182,6 +182,47 @@ test_expect_success 'fetching of missing objects works with ref-in-want enabled'
grep "git< fetch=.*ref-in-want" trace
'
+test_expect_success 'fetching of missing blobs works' '
+ rm -rf server repo &&
+ test_create_repo server &&
+ test_commit -C server foo &&
+ git -C server repack -a -d --write-bitmap-index &&
+
+ git clone "file://$(pwd)/server" repo &&
+ git hash-object repo/foo.t >blobhash &&
+ rm -rf repo/.git/objects/* &&
+
+ git -C server config uploadpack.allowanysha1inwant 1 &&
+ git -C server config uploadpack.allowfilter 1 &&
+ git -C repo config core.repositoryformatversion 1 &&
+ git -C repo config extensions.partialclone "origin" &&
+
+ git -C repo cat-file -p $(cat blobhash)
+'
+
+test_expect_success 'fetching of missing trees does not fetch blobs' '
+ rm -rf server repo &&
+ test_create_repo server &&
+ test_commit -C server foo &&
+ git -C server repack -a -d --write-bitmap-index &&
+
+ git clone "file://$(pwd)/server" repo &&
+ git -C repo rev-parse foo^{tree} >treehash &&
+ git hash-object repo/foo.t >blobhash &&
+ rm -rf repo/.git/objects/* &&
+
+ git -C server config uploadpack.allowanysha1inwant 1 &&
+ git -C server config uploadpack.allowfilter 1 &&
+ git -C repo config core.repositoryformatversion 1 &&
+ git -C repo config extensions.partialclone "origin" &&
+ git -C repo cat-file -p $(cat treehash) &&
+
+ # Ensure that the tree, but not the blob, is fetched
+ git -C repo rev-list --objects --missing=print $(cat treehash) >objects &&
+ grep "^$(cat treehash)" objects &&
+ grep "^[?]$(cat blobhash)" objects
+'
+
test_expect_success 'rev-list stops traversal at missing and promised commit' '
rm -rf repo &&
test_create_repo repo &&
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index 7f19d59..43c4be1 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -140,15 +140,17 @@ test_expect_success '--batch-check without %(rest) considers whole line' '
test_cmp expect actual
'
+test_oid_init
+
tree_sha1=$(git write-tree)
-tree_size=33
+tree_size=$(($(test_oid rawsz) + 13))
tree_pretty_content="100644 blob $hello_sha1 hello"
run_tests 'tree' $tree_sha1 $tree_size "" "$tree_pretty_content"
commit_message="Initial commit"
commit_sha1=$(echo_without_newline "$commit_message" | git commit-tree $tree_sha1)
-commit_size=177
+commit_size=$(($(test_oid hexsz) + 137))
commit_content="tree $tree_sha1
author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 0000000000 +0000
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 0000000000 +0000
@@ -218,8 +220,8 @@ test_expect_success "--batch-check for a non-existent hash" '
test "0000000000000000000000000000000000000042 missing
0000000000000000000000000000000000000084 missing" = \
"$( ( echo 0000000000000000000000000000000000000042;
- echo_without_newline 0000000000000000000000000000000000000084; ) \
- | git cat-file --batch-check)"
+ echo_without_newline 0000000000000000000000000000000000000084; ) |
+ git cat-file --batch-check)"
'
test_expect_success "--batch for an existent and a non-existent hash" '
@@ -227,8 +229,8 @@ test_expect_success "--batch for an existent and a non-existent hash" '
$tag_content
0000000000000000000000000000000000000000 missing" = \
"$( ( echo $tag_sha1;
- echo_without_newline 0000000000000000000000000000000000000000; ) \
- | git cat-file --batch)"
+ echo_without_newline 0000000000000000000000000000000000000000; ) |
+ git cat-file --batch)"
'
test_expect_success "--batch-check for an empty line" '
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index cdf1fed..e2cd50e 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -1001,7 +1001,7 @@ EOF
test_expect_success 'value continued on next line' '
git config --list > result &&
- test_cmp result expect
+ test_cmp expect result
'
cat > .git/config <<\EOF
@@ -1770,8 +1770,9 @@ test_expect_success '--show-origin stdin with file include' '
cat >expect <<-EOF &&
file:$INCLUDE_DIR/stdin.include include
EOF
- echo "[include]path=\"$INCLUDE_DIR\"/stdin.include" \
- | git config --show-origin --includes --file - user.stdin >output &&
+ echo "[include]path=\"$INCLUDE_DIR\"/stdin.include" |
+ git config --show-origin --includes --file - user.stdin >output &&
+
test_cmp expect output
'
@@ -1881,7 +1882,7 @@ test_expect_success '--replace-all does not invent newlines' '
Qkey = b
EOF
git config --replace-all abc.key b &&
- test_cmp .git/config expect
+ test_cmp expect .git/config
'
test_done
diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh
index 3b92083..0000e66 100755
--- a/t/t1303-wacky-config.sh
+++ b/t/t1303-wacky-config.sh
@@ -14,7 +14,7 @@ setup() {
check() {
echo "$2" >expected
git config --get "$1" >actual 2>&1
- test_cmp actual expected
+ test_cmp expected actual
}
# 'check section.key regex value' verifies that the entry for
@@ -22,7 +22,7 @@ check() {
check_regex() {
echo "$3" >expected
git config --get "$1" "$2" >actual 2>&1
- test_cmp actual expected
+ test_cmp expected actual
}
test_expect_success 'modify same key' '
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 02493f1..1fbd940 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -346,7 +346,7 @@ test_expect_success "verifying $m's log (logged by config)" '
git update-ref $m $D
cat >.git/logs/$m <<EOF
-0000000000000000000000000000000000000000 $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
+$Z $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
$C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500
$A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500
$F $Z $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
@@ -366,7 +366,7 @@ test_expect_success 'Query master@{2005-05-25} (before history)' '
test_when_finished "rm -f o e" &&
git rev-parse --verify master@{2005-05-25} >o 2>e &&
test $C = $(cat o) &&
- echo test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"
+ test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"
'
test_expect_success 'Query "master@{May 26 2005 23:31:59}" (1 second before history)' '
test_when_finished "rm -f o e" &&
diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh
index a74c38b..331899d 100755
--- a/t/t1405-main-ref-store.sh
+++ b/t/t1405-main-ref-store.sh
@@ -54,7 +54,7 @@ test_expect_success 'for_each_ref(refs/heads/)' '
'
test_expect_success 'for_each_ref() is sorted' '
- $RUN for-each-ref refs/heads/ | cut -c 42- >actual &&
+ $RUN for-each-ref refs/heads/ | cut -d" " -f 2- >actual &&
sort actual > expected &&
test_cmp expected actual
'
@@ -71,7 +71,7 @@ test_expect_success 'verify_ref(new-master)' '
'
test_expect_success 'for_each_reflog()' '
- $RUN for-each-reflog | sort -k2 | cut -c 42- >actual &&
+ $RUN for-each-reflog | sort -k2 | cut -d" " -f 2- >actual &&
cat >expected <<-\EOF &&
HEAD 0x1
refs/heads/master 0x0
diff --git a/t/t1406-submodule-ref-store.sh b/t/t1406-submodule-ref-store.sh
index e093782..d199d87 100755
--- a/t/t1406-submodule-ref-store.sh
+++ b/t/t1406-submodule-ref-store.sh
@@ -39,7 +39,7 @@ test_expect_success 'rename_refs() not allowed' '
'
test_expect_success 'for_each_ref(refs/heads/)' '
- $RUN for-each-ref refs/heads/ | cut -c 42- >actual &&
+ $RUN for-each-ref refs/heads/ | cut -d" " -f 2- >actual &&
cat >expected <<-\EOF &&
master 0x0
new-master 0x0
@@ -48,7 +48,7 @@ test_expect_success 'for_each_ref(refs/heads/)' '
'
test_expect_success 'for_each_ref() is sorted' '
- $RUN for-each-ref refs/heads/ | cut -c 42- >actual &&
+ $RUN for-each-ref refs/heads/ | cut -d" " -f 2- >actual &&
sort actual > expected &&
test_cmp expected actual
'
@@ -65,7 +65,7 @@ test_expect_success 'verify_ref(new-master)' '
'
test_expect_success 'for_each_reflog()' '
- $RUN for-each-reflog | sort | cut -c 42- >actual &&
+ $RUN for-each-reflog | sort | cut -d" " -f 2- >actual &&
cat >expected <<-\EOF &&
HEAD 0x1
refs/heads/master 0x0
diff --git a/t/t1407-worktree-ref-store.sh b/t/t1407-worktree-ref-store.sh
index 4623ae1..9a84858 100755
--- a/t/t1407-worktree-ref-store.sh
+++ b/t/t1407-worktree-ref-store.sh
@@ -58,7 +58,7 @@ test_expect_success 'for_each_reflog()' '
mkdir -p .git/worktrees/wt/logs/refs/bisect &&
echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&
- $RWT for-each-reflog | cut -c 42- | sort >actual &&
+ $RWT for-each-reflog | cut -d" " -f 2- | sort >actual &&
cat >expected <<-\EOF &&
HEAD 0x1
PSEUDO-WT 0x0
@@ -68,7 +68,7 @@ test_expect_success 'for_each_reflog()' '
EOF
test_cmp expected actual &&
- $RMAIN for-each-reflog | cut -c 42- | sort >actual &&
+ $RMAIN for-each-reflog | cut -d" " -f 2- | sort >actual &&
cat >expected <<-\EOF &&
HEAD 0x1
PSEUDO-MAIN 0x0
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 5c715fe..01abee5 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -142,6 +142,22 @@ test_expect_success 'showing the superproject correctly' '
git -C super submodule add ../sub dir/sub &&
echo $(pwd)/super >expect &&
git -C super/dir/sub rev-parse --show-superproject-working-tree >out &&
+ test_cmp expect out &&
+
+ test_commit -C super submodule_add &&
+ git -C super checkout -b branch1 &&
+ git -C super/dir/sub checkout -b branch1 &&
+ test_commit -C super/dir/sub branch1_commit &&
+ git -C super add dir/sub &&
+ test_commit -C super branch1_commit &&
+ git -C super checkout -b branch2 master &&
+ git -C super/dir/sub checkout -b branch2 master &&
+ test_commit -C super/dir/sub branch2_commit &&
+ git -C super add dir/sub &&
+ test_commit -C super branch2_commit &&
+ test_must_fail git -C super merge branch1 &&
+
+ git -C super/dir/sub rev-parse --show-superproject-working-tree >out &&
test_cmp expect out
'
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index be22398..3e618ca 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -6,7 +6,12 @@ test_description='split index mode tests'
# We need total control of index splitting here
sane_unset GIT_TEST_SPLIT_INDEX
-sane_unset GIT_FSMONITOR_TEST
+
+# Testing a hard coded SHA against an index with an extension
+# that can vary from run to run is problematic so we disable
+# those extensions.
+sane_unset GIT_TEST_FSMONITOR
+sane_unset GIT_TEST_INDEX_THREADS
test_expect_success 'enable split index' '
git config splitIndex.maxPercentChange 100 &&
@@ -15,11 +20,11 @@ test_expect_success 'enable split index' '
indexversion=$(test-tool index-version <.git/index) &&
if test "$indexversion" = "4"
then
- own=432ef4b63f32193984f339431fd50ca796493569
- base=508851a7f0dfa8691e9f69c7f055865389012491
+ own=3527df833c6c100d3d1d921a9a782d62a8be4b58
+ base=746f7ab2ed44fb839efdfbffcf399d0b113fb4cb
else
- own=8299b0bcd1ac364e5f1d7768efb62fa2da79a339
- base=39d890139ee5356c7ef572216cebcd27aa41f9df
+ own=5e9b60117ece18da410ddecc8b8d43766a0e4204
+ base=4370042739b31cd17a5c5cd6043a77c9a00df113
fi &&
cat >expect <<-EOF &&
own $own
diff --git a/t/t2101-update-index-reupdate.sh b/t/t2101-update-index-reupdate.sh
index 685ec45..6c32d42 100755
--- a/t/t2101-update-index-reupdate.sh
+++ b/t/t2101-update-index-reupdate.sh
@@ -73,7 +73,7 @@ test_expect_success 'update-index --update from subdir' '
100644 $(git hash-object dir1/file3) 0 dir1/file3
100644 $file2 0 file2
EOF
- test_cmp current expected
+ test_cmp expected current
'
test_expect_success 'update-index --update with pathspec' '
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 93f21ab..478b82c 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -1221,7 +1221,7 @@ test_expect_success 'use --edit-description' '
EOF
EDITOR=./editor git branch --edit-description &&
echo "New contents" >expect &&
- test_cmp EDITOR_OUTPUT expect
+ test_cmp expect EDITOR_OUTPUT
'
test_expect_success 'detect typo in branch name when using --edit-description' '
diff --git a/t/t3320-notes-merge-worktrees.sh b/t/t3320-notes-merge-worktrees.sh
index 10bfc8b..823fdbd 100755
--- a/t/t3320-notes-merge-worktrees.sh
+++ b/t/t3320-notes-merge-worktrees.sh
@@ -44,7 +44,7 @@ test_expect_success 'merge z into y fails and sets NOTES_MERGE_REF' '
git config core.notesRef refs/notes/y &&
test_must_fail git notes merge z &&
echo "ref: refs/notes/y" >expect &&
- test_cmp .git/NOTES_MERGE_REF expect
+ test_cmp expect .git/NOTES_MERGE_REF
'
test_expect_success 'merge z into y while mid-merge in another workdir fails' '
@@ -66,7 +66,7 @@ test_expect_success 'merge z into x while mid-merge on y succeeds' '
grep -v "A notes merge into refs/notes/x is already in-progress in" out
) &&
echo "ref: refs/notes/x" >expect &&
- test_cmp .git/worktrees/worktree2/NOTES_MERGE_REF expect
+ test_cmp expect .git/worktrees/worktree2/NOTES_MERGE_REF
'
test_done
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 3996ee0..3e73f75 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -183,13 +183,13 @@ test_expect_success 'cherry-picked commits and fork-point work together' '
test_commit final_B B "Final B" &&
git rebase &&
echo Amended >expect &&
- test_cmp A expect &&
+ test_cmp expect A &&
echo "Final B" >expect &&
- test_cmp B expect &&
+ test_cmp expect B &&
echo C >expect &&
- test_cmp C expect &&
+ test_cmp expect C &&
echo D >expect &&
- test_cmp D expect
+ test_cmp expect D
'
test_expect_success 'rebase -q is quiet' '
diff --git a/t/t3417-rebase-whitespace-fix.sh b/t/t3417-rebase-whitespace-fix.sh
index 1fb3e49..e85cdc7 100755
--- a/t/t3417-rebase-whitespace-fix.sh
+++ b/t/t3417-rebase-whitespace-fix.sh
@@ -55,7 +55,7 @@ test_expect_success 'blank line at end of file; extend at end of file' '
git add file && git commit -m second &&
git rebase --whitespace=fix HEAD^^ &&
git diff --exit-code HEAD^:file expect-first &&
- test_cmp file expect-second
+ test_cmp expect-second file
'
# prepare third revision of "file"
@@ -82,7 +82,7 @@ test_expect_success 'two blanks line at end of file; extend at end of file' '
cp third file && git add file && git commit -m third &&
git rebase --whitespace=fix HEAD^^ &&
git diff --exit-code HEAD^:file expect-second &&
- test_cmp file expect-third
+ test_cmp expect-third file
'
test_expect_success 'same, but do not remove trailing spaces' '
@@ -120,7 +120,7 @@ test_expect_success 'at beginning of file' '
done >> file &&
git commit -m more file &&
git rebase --whitespace=fix HEAD^^ &&
- test_cmp file expect-beginning
+ test_cmp expect-beginning file
'
test_done
diff --git a/t/t3702-add-edit.sh b/t/t3702-add-edit.sh
index c6af7f8..6c67664 100755
--- a/t/t3702-add-edit.sh
+++ b/t/t3702-add-edit.sh
@@ -110,10 +110,10 @@ test_expect_success 'add -e' '
cp second-part file &&
git add -e &&
test_cmp second-part file &&
- test_cmp orig-patch expected-patch &&
+ test_cmp expected-patch orig-patch &&
git diff --cached >actual &&
grep -v index actual >out &&
- test_cmp out expected
+ test_cmp expected out
'
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 6450bc6..cd21665 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -36,7 +36,7 @@ EOF
test_expect_success 'parents of stash' '
test $(git rev-parse stash^) = $(git rev-parse HEAD) &&
git diff stash^2..stash > output &&
- test_cmp output expect
+ test_cmp expect output
'
test_expect_success 'applying bogus stash does nothing' '
@@ -210,9 +210,9 @@ test_expect_success 'stash branch' '
test refs/heads/stashbranch = $(git symbolic-ref HEAD) &&
test $(git rev-parse HEAD) = $(git rev-parse master^) &&
git diff --cached > output &&
- test_cmp output expect &&
+ test_cmp expect output &&
git diff > output &&
- test_cmp output expect1 &&
+ test_cmp expect1 output &&
git add file &&
git commit -m alternate\ second &&
git diff master..stashbranch > output &&
@@ -710,7 +710,7 @@ test_expect_success 'stash where working directory contains "HEAD" file' '
git diff-index --cached --quiet HEAD &&
test "$(git rev-parse stash^)" = "$(git rev-parse HEAD)" &&
git diff stash^..stash > output &&
- test_cmp output expect
+ test_cmp expect output
'
test_expect_success 'store called with invalid commit' '
diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh
index 597b063..cc1c8a7 100755
--- a/t/t3905-stash-include-untracked.sh
+++ b/t/t3905-stash-include-untracked.sh
@@ -142,7 +142,7 @@ test_expect_success 'stash save --include-untracked removed files' '
rm -f file &&
git stash save --include-untracked &&
echo 1 > expect &&
- test_cmp file expect
+ test_cmp expect file
'
rm -f expect
diff --git a/t/t4025-hunk-header.sh b/t/t4025-hunk-header.sh
index fa44e78..35578f2 100755
--- a/t/t4025-hunk-header.sh
+++ b/t/t4025-hunk-header.sh
@@ -37,7 +37,7 @@ test_expect_success 'hunk header truncation with an overly long line' '
echo " A $N$N$N$N$N$N$N$N$N2" &&
echo " L $N$N$N$N$N$N$N$N$N1"
) >expected &&
- test_cmp actual expected
+ test_cmp expected actual
'
diff --git a/t/t4117-apply-reject.sh b/t/t4117-apply-reject.sh
index d80187d..f7de6f0 100755
--- a/t/t4117-apply-reject.sh
+++ b/t/t4117-apply-reject.sh
@@ -72,7 +72,7 @@ test_expect_success 'apply with --reject should fail but update the file' '
rm -f file1.rej file2.rej &&
test_must_fail git apply --reject patch.1 &&
- test_cmp file1 expected &&
+ test_cmp expected file1 &&
cat file1.rej &&
test_path_is_missing file2.rej
@@ -85,7 +85,7 @@ test_expect_success 'apply with --reject should fail but update the file' '
test_must_fail git apply --reject patch.2 >rejects &&
test_path_is_missing file1 &&
- test_cmp file2 expected &&
+ test_cmp expected file2 &&
cat file2.rej &&
test_path_is_missing file1.rej
@@ -99,7 +99,7 @@ test_expect_success 'the same test with --verbose' '
test_must_fail git apply --reject --verbose patch.2 >rejects &&
test_path_is_missing file1 &&
- test_cmp file2 expected &&
+ test_cmp expected file2 &&
cat file2.rej &&
test_path_is_missing file1.rej
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index 7e32237..ff51e9e 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -313,9 +313,9 @@ test_expect_success 'applying beyond EOF requires one non-blank context line' '
{ echo a; echo; } >one &&
cp one expect &&
test_must_fail git apply --whitespace=fix patch &&
- test_cmp one expect &&
+ test_cmp expect one &&
test_must_fail git apply --ignore-space-change --whitespace=fix patch &&
- test_cmp one expect
+ test_cmp expect one
'
test_expect_success 'tons of blanks at EOF should not apply' '
@@ -342,10 +342,10 @@ test_expect_success 'missing blank line at end with --whitespace=fix' '
cp one saved-one &&
test_must_fail git apply patch &&
git apply --whitespace=fix patch &&
- test_cmp one expect &&
+ test_cmp expect one &&
mv saved-one one &&
git apply --ignore-space-change --whitespace=fix patch &&
- test_cmp one expect
+ test_cmp expect one
'
test_expect_success 'two missing blank lines at end with --whitespace=fix' '
@@ -360,11 +360,11 @@ test_expect_success 'two missing blank lines at end with --whitespace=fix' '
cp no-blank-lines one &&
test_must_fail git apply patch &&
git apply --whitespace=fix patch &&
- test_cmp one expect &&
+ test_cmp expect one &&
mv no-blank-lines one &&
test_must_fail git apply patch &&
git apply --ignore-space-change --whitespace=fix patch &&
- test_cmp one expect
+ test_cmp expect one
'
test_expect_success 'missing blank line at end, insert before end, --whitespace=fix' '
@@ -376,7 +376,7 @@ test_expect_success 'missing blank line at end, insert before end, --whitespace=
echo a >one &&
test_must_fail git apply patch &&
git apply --whitespace=fix patch &&
- test_cmp one expect
+ test_cmp expect one
'
test_expect_success 'shrink file with tons of missing blanks at end of file' '
@@ -392,10 +392,10 @@ test_expect_success 'shrink file with tons of missing blanks at end of file' '
cp no-blank-lines one &&
test_must_fail git apply patch &&
git apply --whitespace=fix patch &&
- test_cmp one expect &&
+ test_cmp expect one &&
mv no-blank-lines one &&
git apply --ignore-space-change --whitespace=fix patch &&
- test_cmp one expect
+ test_cmp expect one
'
test_expect_success 'missing blanks at EOF must only match blank lines' '
@@ -427,7 +427,7 @@ test_expect_success 'missing blank line should match context line with spaces' '
git add one &&
git apply --whitespace=fix patch &&
- test_cmp one expect
+ test_cmp expect one
'
sed -e's/Z//' >one <<EOF
@@ -447,7 +447,7 @@ test_expect_success 'same, but with the --ignore-space-option' '
git checkout-index -f one &&
git apply --ignore-space-change --whitespace=fix patch &&
- test_cmp one expect
+ test_cmp expect one
'
test_expect_success 'same, but with CR-LF line endings && cr-at-eol set' '
@@ -464,7 +464,7 @@ test_expect_success 'same, but with CR-LF line endings && cr-at-eol set' '
mv save-one one &&
git apply --ignore-space-change --whitespace=fix patch &&
- test_cmp one expect
+ test_cmp expect one
'
test_expect_success 'CR-LF line endings && add line && text=auto' '
@@ -478,7 +478,7 @@ test_expect_success 'CR-LF line endings && add line && text=auto' '
mv save-one one &&
echo "one text=auto" >.gitattributes &&
git apply patch &&
- test_cmp one expect
+ test_cmp expect one
'
test_expect_success 'CR-LF line endings && change line && text=auto' '
@@ -491,7 +491,7 @@ test_expect_success 'CR-LF line endings && change line && text=auto' '
mv save-one one &&
echo "one text=auto" >.gitattributes &&
git apply patch &&
- test_cmp one expect
+ test_cmp expect one
'
test_expect_success 'LF in repo, CRLF in worktree && change line && text=auto' '
@@ -503,7 +503,7 @@ test_expect_success 'LF in repo, CRLF in worktree && change line && text=auto' '
echo "one text=auto" >.gitattributes &&
git -c core.eol=CRLF apply patch &&
printf "b\r\n" >expect &&
- test_cmp one expect
+ test_cmp expect one
'
test_expect_success 'whitespace=fix to expand' '
diff --git a/t/t4138-apply-ws-expansion.sh b/t/t4138-apply-ws-expansion.sh
index 0ffe33f..3b636a6 100755
--- a/t/t4138-apply-ws-expansion.sh
+++ b/t/t4138-apply-ws-expansion.sh
@@ -114,7 +114,7 @@ for t in 1 2 3 4
do
test_expect_success 'apply with ws expansion (t=$t)' '
git apply patch$t.patch &&
- test_cmp test-$t expect-$t
+ test_cmp expect-$t test-$t
'
done
diff --git a/t/t5317-pack-objects-filter-objects.sh b/t/t5317-pack-objects-filter-objects.sh
index 6710c8b..2e718f0 100755
--- a/t/t5317-pack-objects-filter-objects.sh
+++ b/t/t5317-pack-objects-filter-objects.sh
@@ -21,17 +21,21 @@ test_expect_success 'setup r1' '
test_expect_success 'verify blob count in normal packfile' '
git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \
- | awk -f print_2.awk \
- | sort >expected &&
+ >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r1 pack-objects --rev --stdout >all.pack <<-EOF &&
HEAD
EOF
git -C r1 index-pack ../all.pack &&
- git -C r1 verify-pack -v ../all.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r1 verify-pack -v ../all.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify blob:none packfile has no blobs' '
@@ -39,24 +43,28 @@ test_expect_success 'verify blob:none packfile has no blobs' '
HEAD
EOF
git -C r1 index-pack ../filter.pack &&
- git -C r1 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
+
+ git -C r1 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
nr=$(wc -l <observed) &&
test 0 -eq $nr
'
test_expect_success 'verify normal and blob:none packfiles have same commits/trees' '
- git -C r1 verify-pack -v ../all.pack \
- | grep -E "commit|tree" \
- | awk -f print_1.awk \
- | sort >expected &&
- git -C r1 verify-pack -v ../filter.pack \
- | grep -E "commit|tree" \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+ git -C r1 verify-pack -v ../all.pack >verify_result &&
+ grep -E "commit|tree" verify_result |
+ awk -f print_1.awk |
+ sort >expected &&
+
+ git -C r1 verify-pack -v ../filter.pack >verify_result &&
+ grep -E "commit|tree" verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
# Test blob:limit=<n>[kmg] filter.
@@ -75,18 +83,21 @@ test_expect_success 'setup r2' '
'
test_expect_success 'verify blob count in normal packfile' '
- git -C r2 ls-files -s large.1000 large.10000 \
- | awk -f print_2.awk \
- | sort >expected &&
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r2 pack-objects --rev --stdout >all.pack <<-EOF &&
HEAD
EOF
git -C r2 index-pack ../all.pack &&
- git -C r2 verify-pack -v ../all.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r2 verify-pack -v ../all.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify blob:limit=500 omits all blobs' '
@@ -94,10 +105,12 @@ test_expect_success 'verify blob:limit=500 omits all blobs' '
HEAD
EOF
git -C r2 index-pack ../filter.pack &&
- git -C r2 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
+
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
nr=$(wc -l <observed) &&
test 0 -eq $nr
'
@@ -107,100 +120,119 @@ test_expect_success 'verify blob:limit=1000' '
HEAD
EOF
git -C r2 index-pack ../filter.pack &&
- git -C r2 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
+
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
nr=$(wc -l <observed) &&
test 0 -eq $nr
'
test_expect_success 'verify blob:limit=1001' '
- git -C r2 ls-files -s large.1000 \
- | awk -f print_2.awk \
- | sort >expected &&
+ git -C r2 ls-files -s large.1000 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r2 pack-objects --rev --stdout --filter=blob:limit=1001 >filter.pack <<-EOF &&
HEAD
EOF
git -C r2 index-pack ../filter.pack &&
- git -C r2 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify blob:limit=10001' '
- git -C r2 ls-files -s large.1000 large.10000 \
- | awk -f print_2.awk \
- | sort >expected &&
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r2 pack-objects --rev --stdout --filter=blob:limit=10001 >filter.pack <<-EOF &&
HEAD
EOF
git -C r2 index-pack ../filter.pack &&
- git -C r2 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify blob:limit=1k' '
- git -C r2 ls-files -s large.1000 \
- | awk -f print_2.awk \
- | sort >expected &&
+ git -C r2 ls-files -s large.1000 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r2 pack-objects --rev --stdout --filter=blob:limit=1k >filter.pack <<-EOF &&
HEAD
EOF
git -C r2 index-pack ../filter.pack &&
- git -C r2 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify explicitly specifying oversized blob in input' '
- git -C r2 ls-files -s large.1000 large.10000 \
- | awk -f print_2.awk \
- | sort >expected &&
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r2 pack-objects --rev --stdout --filter=blob:limit=1k >filter.pack <<-EOF &&
HEAD
$(git -C r2 rev-parse HEAD:large.10000)
EOF
git -C r2 index-pack ../filter.pack &&
- git -C r2 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify blob:limit=1m' '
- git -C r2 ls-files -s large.1000 large.10000 \
- | awk -f print_2.awk \
- | sort >expected &&
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r2 pack-objects --rev --stdout --filter=blob:limit=1m >filter.pack <<-EOF &&
HEAD
EOF
git -C r2 index-pack ../filter.pack &&
- git -C r2 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify normal and blob:limit packfiles have same commits/trees' '
- git -C r2 verify-pack -v ../all.pack \
- | grep -E "commit|tree" \
- | awk -f print_1.awk \
- | sort >expected &&
- git -C r2 verify-pack -v ../filter.pack \
- | grep -E "commit|tree" \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+ git -C r2 verify-pack -v ../all.pack >verify_result &&
+ grep -E "commit|tree" verify_result |
+ awk -f print_1.awk |
+ sort >expected &&
+
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
+ grep -E "commit|tree" verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
# Test sparse:path=<path> filter.
@@ -225,71 +257,85 @@ test_expect_success 'setup r3' '
test_expect_success 'verify blob count in normal packfile' '
git -C r3 ls-files -s sparse1 sparse2 dir1/sparse1 dir1/sparse2 \
- | awk -f print_2.awk \
- | sort >expected &&
+ >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r3 pack-objects --rev --stdout >all.pack <<-EOF &&
HEAD
EOF
git -C r3 index-pack ../all.pack &&
- git -C r3 verify-pack -v ../all.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r3 verify-pack -v ../all.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify sparse:path=pattern1' '
- git -C r3 ls-files -s dir1/sparse1 dir1/sparse2 \
- | awk -f print_2.awk \
- | sort >expected &&
+ git -C r3 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r3 pack-objects --rev --stdout --filter=sparse:path=../pattern1 >filter.pack <<-EOF &&
HEAD
EOF
git -C r3 index-pack ../filter.pack &&
- git -C r3 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r3 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify normal and sparse:path=pattern1 packfiles have same commits/trees' '
- git -C r3 verify-pack -v ../all.pack \
- | grep -E "commit|tree" \
- | awk -f print_1.awk \
- | sort >expected &&
- git -C r3 verify-pack -v ../filter.pack \
- | grep -E "commit|tree" \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+ git -C r3 verify-pack -v ../all.pack >verify_result &&
+ grep -E "commit|tree" verify_result |
+ awk -f print_1.awk |
+ sort >expected &&
+
+ git -C r3 verify-pack -v ../filter.pack >verify_result &&
+ grep -E "commit|tree" verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify sparse:path=pattern2' '
- git -C r3 ls-files -s sparse1 dir1/sparse1 \
- | awk -f print_2.awk \
- | sort >expected &&
+ git -C r3 ls-files -s sparse1 dir1/sparse1 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r3 pack-objects --rev --stdout --filter=sparse:path=../pattern2 >filter.pack <<-EOF &&
HEAD
EOF
git -C r3 index-pack ../filter.pack &&
- git -C r3 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r3 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify normal and sparse:path=pattern2 packfiles have same commits/trees' '
- git -C r3 verify-pack -v ../all.pack \
- | grep -E "commit|tree" \
- | awk -f print_1.awk \
- | sort >expected &&
- git -C r3 verify-pack -v ../filter.pack \
- | grep -E "commit|tree" \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+ git -C r3 verify-pack -v ../all.pack >verify_result &&
+ grep -E "commit|tree" verify_result |
+ awk -f print_1.awk |
+ sort >expected &&
+
+ git -C r3 verify-pack -v ../filter.pack >verify_result &&
+ grep -E "commit|tree" verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
# Test sparse:oid=<oid-ish> filter.
@@ -313,48 +359,58 @@ test_expect_success 'setup r4' '
test_expect_success 'verify blob count in normal packfile' '
git -C r4 ls-files -s pattern sparse1 sparse2 dir1/sparse1 dir1/sparse2 \
- | awk -f print_2.awk \
- | sort >expected &&
+ >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r4 pack-objects --rev --stdout >all.pack <<-EOF &&
HEAD
EOF
git -C r4 index-pack ../all.pack &&
- git -C r4 verify-pack -v ../all.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r4 verify-pack -v ../all.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify sparse:oid=OID' '
- git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 \
- | awk -f print_2.awk \
- | sort >expected &&
+ git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
oid=$(git -C r4 ls-files -s pattern | awk -f print_2.awk) &&
git -C r4 pack-objects --rev --stdout --filter=sparse:oid=$oid >filter.pack <<-EOF &&
HEAD
EOF
git -C r4 index-pack ../filter.pack &&
- git -C r4 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r4 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify sparse:oid=oid-ish' '
- git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 \
- | awk -f print_2.awk \
- | sort >expected &&
+ git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
git -C r4 pack-objects --rev --stdout --filter=sparse:oid=master:pattern >filter.pack <<-EOF &&
HEAD
EOF
git -C r4 index-pack ../filter.pack &&
- git -C r4 verify-pack -v ../filter.pack \
- | grep blob \
- | awk -f print_1.awk \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r4 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ awk -f print_1.awk |
+ sort >observed &&
+
+ test_cmp expected observed
'
# Delete some loose objects and use pack-objects, but WITHOUT any filtering.
@@ -362,8 +418,10 @@ test_expect_success 'verify sparse:oid=oid-ish' '
test_expect_success 'setup r1 - delete loose blobs' '
git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \
- | awk -f print_2.awk \
- | sort >expected &&
+ >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
for id in `cat expected | sed "s|..|&/|"`
do
rm r1/.git/objects/$id
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 0c500f7..5fe21db 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -8,7 +8,8 @@ test_expect_success 'setup full repo' '
cd "$TRASH_DIRECTORY/full" &&
git init &&
git config core.commitGraph true &&
- objdir=".git/objects"
+ objdir=".git/objects" &&
+ test_oid_init
'
test_expect_success 'verify graph with no graph file' '
@@ -35,7 +36,7 @@ test_expect_success 'create commits and repack' '
graph_git_two_modes() {
git -c core.commitGraph=true $1 >output
git -c core.commitGraph=false $1 >expect
- test_cmp output expect
+ test_cmp expect output
}
graph_git_behavior() {
@@ -259,6 +260,66 @@ test_expect_success 'check that gc computes commit-graph' '
test_cmp_bin commit-graph-after-gc $objdir/info/commit-graph
'
+test_expect_success 'replace-objects invalidates commit-graph' '
+ cd "$TRASH_DIRECTORY" &&
+ test_when_finished rm -rf replace &&
+ git clone full replace &&
+ (
+ cd replace &&
+ git commit-graph write --reachable &&
+ test_path_is_file .git/objects/info/commit-graph &&
+ git replace HEAD~1 HEAD~2 &&
+ git -c core.commitGraph=false log >expect &&
+ git -c core.commitGraph=true log >actual &&
+ test_cmp expect actual &&
+ git commit-graph write --reachable &&
+ git -c core.commitGraph=false --no-replace-objects log >expect &&
+ git -c core.commitGraph=true --no-replace-objects log >actual &&
+ test_cmp expect actual &&
+ rm -rf .git/objects/info/commit-graph &&
+ git commit-graph write --reachable &&
+ test_path_is_file .git/objects/info/commit-graph
+ )
+'
+
+test_expect_success 'commit grafts invalidate commit-graph' '
+ cd "$TRASH_DIRECTORY" &&
+ test_when_finished rm -rf graft &&
+ git clone full graft &&
+ (
+ cd graft &&
+ git commit-graph write --reachable &&
+ test_path_is_file .git/objects/info/commit-graph &&
+ H1=$(git rev-parse --verify HEAD~1) &&
+ H3=$(git rev-parse --verify HEAD~3) &&
+ echo "$H1 $H3" >.git/info/grafts &&
+ git -c core.commitGraph=false log >expect &&
+ git -c core.commitGraph=true log >actual &&
+ test_cmp expect actual &&
+ git commit-graph write --reachable &&
+ git -c core.commitGraph=false --no-replace-objects log >expect &&
+ git -c core.commitGraph=true --no-replace-objects log >actual &&
+ test_cmp expect actual &&
+ rm -rf .git/objects/info/commit-graph &&
+ git commit-graph write --reachable &&
+ test_path_is_missing .git/objects/info/commit-graph
+ )
+'
+
+test_expect_success 'replace-objects invalidates commit-graph' '
+ cd "$TRASH_DIRECTORY" &&
+ test_when_finished rm -rf shallow &&
+ git clone --depth 2 "file://$TRASH_DIRECTORY/full" shallow &&
+ (
+ cd shallow &&
+ git commit-graph write --reachable &&
+ test_path_is_missing .git/objects/info/commit-graph &&
+ git fetch origin --unshallow &&
+ git commit-graph write --reachable &&
+ test_path_is_file .git/objects/info/commit-graph
+ )
+'
+
# the verify tests below expect the commit-graph to contain
# exactly the commits reachable from the commits/8 branch.
# If the file changes the set of commits in the list, then the
@@ -273,7 +334,7 @@ test_expect_success 'git commit-graph verify' '
NUM_COMMITS=9
NUM_OCTOPUS_EDGES=2
-HASH_LEN=20
+HASH_LEN="$(test_oid rawsz)"
GRAPH_BYTE_VERSION=4
GRAPH_BYTE_HASH=5
GRAPH_BYTE_CHUNK_COUNT=6
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index 6f56b38..bd8e841 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -150,6 +150,125 @@ test_expect_success 'write midx with twelve packs' '
compare_results_with_midx "twelve packs"
+test_expect_success 'verify multi-pack-index success' '
+ git multi-pack-index verify --object-dir=$objdir
+'
+
+# usage: corrupt_midx_and_verify <pos> <data> <objdir> <string>
+corrupt_midx_and_verify() {
+ POS=$1 &&
+ DATA="${2:-\0}" &&
+ OBJDIR=$3 &&
+ GREPSTR="$4" &&
+ COMMAND="$5" &&
+ if test -z "$COMMAND"
+ then
+ COMMAND="git multi-pack-index verify --object-dir=$OBJDIR"
+ fi &&
+ FILE=$OBJDIR/pack/multi-pack-index &&
+ chmod a+w $FILE &&
+ test_when_finished mv midx-backup $FILE &&
+ cp $FILE midx-backup &&
+ printf "$DATA" | dd of="$FILE" bs=1 seek="$POS" conv=notrunc &&
+ test_must_fail $COMMAND 2>test_err &&
+ grep -v "^+" test_err >err &&
+ test_i18ngrep "$GREPSTR" err
+}
+
+test_expect_success 'verify bad signature' '
+ corrupt_midx_and_verify 0 "\00" $objdir \
+ "multi-pack-index signature"
+'
+
+HASH_LEN=20
+NUM_OBJECTS=74
+MIDX_BYTE_VERSION=4
+MIDX_BYTE_OID_VERSION=5
+MIDX_BYTE_CHUNK_COUNT=6
+MIDX_HEADER_SIZE=12
+MIDX_BYTE_CHUNK_ID=$MIDX_HEADER_SIZE
+MIDX_BYTE_CHUNK_OFFSET=$(($MIDX_HEADER_SIZE + 4))
+MIDX_NUM_CHUNKS=5
+MIDX_CHUNK_LOOKUP_WIDTH=12
+MIDX_OFFSET_PACKNAMES=$(($MIDX_HEADER_SIZE + \
+ $MIDX_NUM_CHUNKS * $MIDX_CHUNK_LOOKUP_WIDTH))
+MIDX_BYTE_PACKNAME_ORDER=$(($MIDX_OFFSET_PACKNAMES + 2))
+MIDX_OFFSET_OID_FANOUT=$(($MIDX_OFFSET_PACKNAMES + 652))
+MIDX_OID_FANOUT_WIDTH=4
+MIDX_BYTE_OID_FANOUT_ORDER=$((MIDX_OFFSET_OID_FANOUT + 250 * $MIDX_OID_FANOUT_WIDTH + 1))
+MIDX_OFFSET_OID_LOOKUP=$(($MIDX_OFFSET_OID_FANOUT + 256 * $MIDX_OID_FANOUT_WIDTH))
+MIDX_BYTE_OID_LOOKUP=$(($MIDX_OFFSET_OID_LOOKUP + 16 * $HASH_LEN))
+MIDX_OFFSET_OBJECT_OFFSETS=$(($MIDX_OFFSET_OID_LOOKUP + $NUM_OBJECTS * $HASH_LEN))
+MIDX_OFFSET_WIDTH=8
+MIDX_BYTE_PACK_INT_ID=$(($MIDX_OFFSET_OBJECT_OFFSETS + 16 * $MIDX_OFFSET_WIDTH + 2))
+MIDX_BYTE_OFFSET=$(($MIDX_OFFSET_OBJECT_OFFSETS + 16 * $MIDX_OFFSET_WIDTH + 6))
+
+test_expect_success 'verify bad version' '
+ corrupt_midx_and_verify $MIDX_BYTE_VERSION "\00" $objdir \
+ "multi-pack-index version"
+'
+
+test_expect_success 'verify bad OID version' '
+ corrupt_midx_and_verify $MIDX_BYTE_OID_VERSION "\02" $objdir \
+ "hash version"
+'
+
+test_expect_success 'verify truncated chunk count' '
+ corrupt_midx_and_verify $MIDX_BYTE_CHUNK_COUNT "\01" $objdir \
+ "missing required"
+'
+
+test_expect_success 'verify extended chunk count' '
+ corrupt_midx_and_verify $MIDX_BYTE_CHUNK_COUNT "\07" $objdir \
+ "terminating multi-pack-index chunk id appears earlier than expected"
+'
+
+test_expect_success 'verify missing required chunk' '
+ corrupt_midx_and_verify $MIDX_BYTE_CHUNK_ID "\01" $objdir \
+ "missing required"
+'
+
+test_expect_success 'verify invalid chunk offset' '
+ corrupt_midx_and_verify $MIDX_BYTE_CHUNK_OFFSET "\01" $objdir \
+ "invalid chunk offset (too large)"
+'
+
+test_expect_success 'verify packnames out of order' '
+ corrupt_midx_and_verify $MIDX_BYTE_PACKNAME_ORDER "z" $objdir \
+ "pack names out of order"
+'
+
+test_expect_success 'verify packnames out of order' '
+ corrupt_midx_and_verify $MIDX_BYTE_PACKNAME_ORDER "a" $objdir \
+ "failed to load pack"
+'
+
+test_expect_success 'verify oid fanout out of order' '
+ corrupt_midx_and_verify $MIDX_BYTE_OID_FANOUT_ORDER "\01" $objdir \
+ "oid fanout out of order"
+'
+
+test_expect_success 'verify oid lookup out of order' '
+ corrupt_midx_and_verify $MIDX_BYTE_OID_LOOKUP "\00" $objdir \
+ "oid lookup out of order"
+'
+
+test_expect_success 'verify incorrect pack-int-id' '
+ corrupt_midx_and_verify $MIDX_BYTE_PACK_INT_ID "\07" $objdir \
+ "bad pack-int-id"
+'
+
+test_expect_success 'verify incorrect offset' '
+ corrupt_midx_and_verify $MIDX_BYTE_OFFSET "\07" $objdir \
+ "incorrect object offset"
+'
+
+test_expect_success 'git-fsck incorrect offset' '
+ corrupt_midx_and_verify $MIDX_BYTE_OFFSET "\07" $objdir \
+ "incorrect object offset" \
+ "git -c core.multipackindex=true fsck"
+'
+
test_expect_success 'repack removes multi-pack-index' '
test_path_is_file $objdir/pack/multi-pack-index &&
git repack -adf &&
@@ -187,7 +306,6 @@ test_expect_success 'multi-pack-index in an alternate' '
compare_results_with_midx "with alternate (remote midx)"
-
# usage: corrupt_data <file> <pos> [<data>]
corrupt_data () {
file=$1
@@ -214,4 +332,20 @@ test_expect_success 'force some 64-bit offsets with pack-objects' '
midx_read_expect 1 63 5 objects64 " large-offsets"
'
+test_expect_success 'verify multi-pack-index with 64-bit offsets' '
+ git multi-pack-index verify --object-dir=objects64
+'
+
+NUM_OBJECTS=63
+MIDX_OFFSET_OID_FANOUT=$((MIDX_OFFSET_PACKNAMES + 54))
+MIDX_OFFSET_OID_LOOKUP=$((MIDX_OFFSET_OID_FANOUT + 256 * $MIDX_OID_FANOUT_WIDTH))
+MIDX_OFFSET_OBJECT_OFFSETS=$(($MIDX_OFFSET_OID_LOOKUP + $NUM_OBJECTS * $HASH_LEN))
+MIDX_OFFSET_LARGE_OFFSETS=$(($MIDX_OFFSET_OBJECT_OFFSETS + $NUM_OBJECTS * $MIDX_OFFSET_WIDTH))
+MIDX_BYTE_LARGE_OFFSET=$(($MIDX_OFFSET_LARGE_OFFSETS + 3))
+
+test_expect_success 'verify incorrect 64-bit offset' '
+ corrupt_midx_and_verify $MIDX_BYTE_LARGE_OFFSET "\07" objects64 \
+ "incorrect object offset"
+'
+
test_done
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 1b5a4a6..086f2c4 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -50,8 +50,11 @@ pull_to_client () {
case "$heads" in *B*)
git update-ref refs/heads/B "$BTIP";;
esac &&
- git symbolic-ref HEAD refs/heads/$(echo $heads \
- | sed -e "s/^\(.\).*$/\1/") &&
+
+ git symbolic-ref HEAD refs/heads/$(
+ echo $heads |
+ sed -e "s/^\(.\).*$/\1/"
+ ) &&
git fsck --full &&
diff --git a/t/t5504-fetch-receive-strict.sh b/t/t5504-fetch-receive-strict.sh
index 62f3569..7bc7068 100755
--- a/t/t5504-fetch-receive-strict.sh
+++ b/t/t5504-fetch-receive-strict.sh
@@ -133,6 +133,34 @@ committer Bugs Bunny <bugs@bun.ni> 1234567890 +0000
This commit object intentionally broken
EOF
+test_expect_success 'setup bogus commit' '
+ commit="$(git hash-object -t commit -w --stdin <bogus-commit)"
+'
+
+test_expect_success 'fsck with no skipList input' '
+ test_must_fail git fsck 2>err &&
+ test_i18ngrep "missingEmail" err
+'
+
+test_expect_success 'setup sorted and unsorted skipLists' '
+ cat >SKIP.unsorted <<-EOF &&
+ 0000000000000000000000000000000000000004
+ 0000000000000000000000000000000000000002
+ $commit
+ 0000000000000000000000000000000000000001
+ 0000000000000000000000000000000000000003
+ EOF
+ sort SKIP.unsorted >SKIP.sorted
+'
+
+test_expect_success 'fsck with sorted skipList' '
+ git -c fsck.skipList=SKIP.sorted fsck
+'
+
+test_expect_success 'fsck with unsorted skipList' '
+ git -c fsck.skipList=SKIP.unsorted fsck
+'
+
test_expect_success 'fsck with invalid or bogus skipList input' '
git -c fsck.skipList=/dev/null -c fsck.missingEmail=ignore fsck &&
test_must_fail git -c fsck.skipList=does-not-exist -c fsck.missingEmail=ignore fsck 2>err &&
@@ -141,8 +169,47 @@ test_expect_success 'fsck with invalid or bogus skipList input' '
test_i18ngrep "Invalid SHA-1: \[core\]" err
'
+test_expect_success 'fsck with other accepted skipList input (comments & empty lines)' '
+ cat >SKIP.with-comment <<-EOF &&
+ # Some bad commit
+ 0000000000000000000000000000000000000001
+ EOF
+ test_must_fail git -c fsck.skipList=SKIP.with-comment fsck 2>err-with-comment &&
+ test_i18ngrep "missingEmail" err-with-comment &&
+ cat >SKIP.with-empty-line <<-EOF &&
+ 0000000000000000000000000000000000000001
+
+ 0000000000000000000000000000000000000002
+ EOF
+ test_must_fail git -c fsck.skipList=SKIP.with-empty-line fsck 2>err-with-empty-line &&
+ test_i18ngrep "missingEmail" err-with-empty-line
+'
+
+test_expect_success 'fsck no garbage output from comments & empty lines errors' '
+ test_line_count = 1 err-with-comment &&
+ test_line_count = 1 err-with-empty-line
+'
+
+test_expect_success 'fsck with invalid abbreviated skipList input' '
+ echo $commit | test_copy_bytes 20 >SKIP.abbreviated &&
+ test_must_fail git -c fsck.skipList=SKIP.abbreviated fsck 2>err-abbreviated &&
+ test_i18ngrep "^fatal: Invalid SHA-1: " err-abbreviated
+'
+
+test_expect_success 'fsck with exhaustive accepted skipList input (various types of comments etc.)' '
+ >SKIP.exhaustive &&
+ echo "# A commented line" >>SKIP.exhaustive &&
+ echo "" >>SKIP.exhaustive &&
+ echo " " >>SKIP.exhaustive &&
+ echo " # Comment after whitespace" >>SKIP.exhaustive &&
+ echo "$commit # Our bad commit (with leading whitespace and trailing comment)" >>SKIP.exhaustive &&
+ echo "# Some bad commit (leading whitespace)" >>SKIP.exhaustive &&
+ echo " 0000000000000000000000000000000000000001" >>SKIP.exhaustive &&
+ git -c fsck.skipList=SKIP.exhaustive fsck 2>err &&
+ test_must_be_empty err
+'
+
test_expect_success 'push with receive.fsck.skipList' '
- commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
git push . $commit:refs/heads/bogus &&
rm -rf dst &&
git init dst &&
@@ -169,7 +236,6 @@ test_expect_success 'push with receive.fsck.skipList' '
'
test_expect_success 'fetch with fetch.fsck.skipList' '
- commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
refspec=refs/heads/bogus:refs/heads/bogus &&
git push . $commit:refs/heads/bogus &&
rm -rf dst &&
@@ -204,7 +270,6 @@ test_expect_success 'fsck.<unknownmsg-id> dies' '
'
test_expect_success 'push with receive.fsck.missingEmail=warn' '
- commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
git push . $commit:refs/heads/bogus &&
rm -rf dst &&
git init dst &&
@@ -232,7 +297,6 @@ test_expect_success 'push with receive.fsck.missingEmail=warn' '
'
test_expect_success 'fetch with fetch.fsck.missingEmail=warn' '
- commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
refspec=refs/heads/bogus:refs/heads/bogus &&
git push . $commit:refs/heads/bogus &&
rm -rf dst &&
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index 12b339d..8630b0c 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -23,26 +23,26 @@ test_expect_success 'create http-accessible bare repository' '
setup_askpass_helper
-cat >exp <<EOF
-> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
-> Accept: */*
-> Accept-Encoding: ENCODINGS
-> Pragma: no-cache
-< HTTP/1.1 200 OK
-< Pragma: no-cache
-< Cache-Control: no-cache, max-age=0, must-revalidate
-< Content-Type: application/x-git-upload-pack-advertisement
-> POST /smart/repo.git/git-upload-pack HTTP/1.1
-> Accept-Encoding: ENCODINGS
-> Content-Type: application/x-git-upload-pack-request
-> Accept: application/x-git-upload-pack-result
-> Content-Length: xxx
-< HTTP/1.1 200 OK
-< Pragma: no-cache
-< Cache-Control: no-cache, max-age=0, must-revalidate
-< Content-Type: application/x-git-upload-pack-result
-EOF
test_expect_success 'clone http repository' '
+ cat >exp <<-\EOF &&
+ > GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
+ > Accept: */*
+ > Accept-Encoding: ENCODINGS
+ > Pragma: no-cache
+ < HTTP/1.1 200 OK
+ < Pragma: no-cache
+ < Cache-Control: no-cache, max-age=0, must-revalidate
+ < Content-Type: application/x-git-upload-pack-advertisement
+ > POST /smart/repo.git/git-upload-pack HTTP/1.1
+ > Accept-Encoding: ENCODINGS
+ > Content-Type: application/x-git-upload-pack-request
+ > Accept: application/x-git-upload-pack-result
+ > Content-Length: xxx
+ < HTTP/1.1 200 OK
+ < Pragma: no-cache
+ < Cache-Control: no-cache, max-age=0, must-revalidate
+ < Content-Type: application/x-git-upload-pack-result
+ EOF
GIT_TRACE_CURL=true git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&
test_cmp file clone/file &&
tr '\''\015'\'' Q <err |
@@ -96,13 +96,13 @@ test_expect_success 'fetch changes via http' '
test_cmp file clone/file
'
-cat >exp <<EOF
-GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
-POST /smart/repo.git/git-upload-pack HTTP/1.1 200
-GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
-POST /smart/repo.git/git-upload-pack HTTP/1.1 200
-EOF
test_expect_success 'used upload-pack service' '
+ cat >exp <<-\EOF &&
+ GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
+ POST /smart/repo.git/git-upload-pack HTTP/1.1 200
+ GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
+ POST /smart/repo.git/git-upload-pack HTTP/1.1 200
+ EOF
check_access_log exp
'
@@ -203,19 +203,19 @@ test_expect_success 'dumb clone via http-backend respects namespace' '
test_cmp expect actual
'
-cat >cookies.txt <<EOF
-127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
-EOF
-cat >expect_cookies.txt <<EOF
-
-127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
-127.0.0.1 FALSE /smart_cookies/repo.git/info/ FALSE 0 name value
-EOF
test_expect_success 'cookies stored in http.cookiefile when http.savecookies set' '
+ cat >cookies.txt <<-\EOF &&
+ 127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
+ EOF
+ sort >expect_cookies.txt <<-\EOF &&
+
+ 127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
+ 127.0.0.1 FALSE /smart_cookies/repo.git/info/ FALSE 0 name value
+ EOF
git config http.cookiefile cookies.txt &&
git config http.savecookies true &&
git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&
- tail -3 cookies.txt >cookies_tail.txt &&
+ tail -3 cookies.txt | sort >cookies_tail.txt &&
test_cmp expect_cookies.txt cookies_tail.txt
'
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index bbbe753..6391437 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -34,10 +34,12 @@ test_expect_success 'setup bare clone for server' '
# confirm partial clone was registered in the local config.
test_expect_success 'do partial clone 1' '
git clone --no-checkout --filter=blob:none "file://$(pwd)/srv.bare" pc1 &&
- git -C pc1 rev-list HEAD --quiet --objects --missing=print \
- | awk -f print_1.awk \
- | sed "s/?//" \
- | sort >observed.oids &&
+
+ git -C pc1 rev-list --quiet --objects --missing=print HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/?//" |
+ sort >observed.oids &&
+
test_cmp expect_1.oids observed.oids &&
test "$(git -C pc1 config --local core.repositoryformatversion)" = "1" &&
test "$(git -C pc1 config --local extensions.partialclone)" = "origin" &&
@@ -46,10 +48,10 @@ test_expect_success 'do partial clone 1' '
# checkout master to force dynamic object fetch of blobs at HEAD.
test_expect_success 'verify checkout with dynamic object fetch' '
- git -C pc1 rev-list HEAD --quiet --objects --missing=print >observed &&
+ git -C pc1 rev-list --quiet --objects --missing=print HEAD >observed &&
test_line_count = 4 observed &&
git -C pc1 checkout master &&
- git -C pc1 rev-list HEAD --quiet --objects --missing=print >observed &&
+ git -C pc1 rev-list --quiet --objects --missing=print HEAD >observed &&
test_line_count = 0 observed
'
@@ -72,7 +74,8 @@ test_expect_success 'push new commits to server' '
# have the new blobs.
test_expect_success 'partial fetch inherits filter settings' '
git -C pc1 fetch origin &&
- git -C pc1 rev-list master..origin/master --quiet --objects --missing=print >observed &&
+ git -C pc1 rev-list --quiet --objects --missing=print \
+ master..origin/master >observed &&
test_line_count = 5 observed
'
@@ -80,7 +83,8 @@ test_expect_success 'partial fetch inherits filter settings' '
# we should only get 1 new blob (for the file in origin/master).
test_expect_success 'verify diff causes dynamic object fetch' '
git -C pc1 diff master..origin/master -- file.1.txt &&
- git -C pc1 rev-list master..origin/master --quiet --objects --missing=print >observed &&
+ git -C pc1 rev-list --quiet --objects --missing=print \
+ master..origin/master >observed &&
test_line_count = 4 observed
'
@@ -89,7 +93,8 @@ test_expect_success 'verify diff causes dynamic object fetch' '
test_expect_success 'verify blame causes dynamic object fetch' '
git -C pc1 blame origin/master -- file.1.txt >observed.blame &&
test_cmp expect.blame observed.blame &&
- git -C pc1 rev-list master..origin/master --quiet --objects --missing=print >observed &&
+ git -C pc1 rev-list --quiet --objects --missing=print \
+ master..origin/master >observed &&
test_line_count = 0 observed
'
@@ -109,7 +114,8 @@ test_expect_success 'push new commits to server for file.2.txt' '
# Verify we have all the new blobs.
test_expect_success 'override inherited filter-spec using --no-filter' '
git -C pc1 fetch --no-filter origin &&
- git -C pc1 rev-list master..origin/master --quiet --objects --missing=print >observed &&
+ git -C pc1 rev-list --quiet --objects --missing=print \
+ master..origin/master >observed &&
test_line_count = 0 observed
'
@@ -130,16 +136,22 @@ test_expect_success 'push new commits to server for file.3.txt' '
# perhaps combined with a command in dry-run mode.
test_expect_success 'manual prefetch of missing objects' '
git -C pc1 fetch --filter=blob:none origin &&
- git -C pc1 rev-list master..origin/master --quiet --objects --missing=print \
- | awk -f print_1.awk \
- | sed "s/?//" \
- | sort >observed.oids &&
+
+ git -C pc1 rev-list --quiet --objects --missing=print \
+ master..origin/master >revs &&
+ awk -f print_1.awk revs |
+ sed "s/?//" |
+ sort >observed.oids &&
+
test_line_count = 6 observed.oids &&
git -C pc1 fetch-pack --stdin "file://$(pwd)/srv.bare" <observed.oids &&
- git -C pc1 rev-list master..origin/master --quiet --objects --missing=print \
- | awk -f print_1.awk \
- | sed "s/?//" \
- | sort >observed.oids &&
+
+ git -C pc1 rev-list --quiet --objects --missing=print \
+ master..origin/master >revs &&
+ awk -f print_1.awk revs |
+ sed "s/?//" |
+ sort >observed.oids &&
+
test_line_count = 0 observed.oids
'
@@ -170,6 +182,23 @@ test_expect_success 'partial clone fetches blobs pointed to by refs even if norm
git -C dst fsck
'
+test_expect_success 'fetch what is specified on CLI even if already promised' '
+ rm -rf src dst.git &&
+ git init src &&
+ test_commit -C src foo &&
+ test_config -C src uploadpack.allowfilter 1 &&
+ test_config -C src uploadpack.allowanysha1inwant 1 &&
+
+ git hash-object --stdin <src/foo.t >blob &&
+
+ git clone --bare --filter=blob:none "file://$(pwd)/src" dst.git &&
+ git -C dst.git rev-list --objects --quiet --missing=print HEAD >missing_before &&
+ grep "?$(cat blob)" missing_before &&
+ git -C dst.git fetch origin $(cat blob) &&
+ git -C dst.git rev-list --objects --quiet --missing=print HEAD >missing_after &&
+ ! grep "?$(cat blob)" missing_after
+'
+
. "$TEST_DIRECTORY"/lib-httpd.sh
start_httpd
@@ -194,7 +223,7 @@ test_expect_success 'upon cloning, check that all refs point to objects' '
# Craft a packfile not including that blob.
git -C "$SERVER" rev-parse HEAD |
- git -C "$SERVER" pack-objects --stdout >incomplete.pack &&
+ git -C "$SERVER" pack-objects --stdout >incomplete.pack &&
# Replace the existing packfile with the crafted one. The protocol
# requires that the packfile be sent in sideband 1, hence the extra
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh
index 75ec79e..ae79c6b 100755
--- a/t/t5701-git-serve.sh
+++ b/t/t5701-git-serve.sh
@@ -15,13 +15,13 @@ test_expect_success 'test capability advertisement' '
EOF
git serve --advertise-capabilities >out &&
- test-pkt-line unpack <out >actual &&
- test_cmp actual expect
+ test-tool pkt-line unpack <out >actual &&
+ test_cmp expect actual
'
test_expect_success 'stateless-rpc flag does not list capabilities' '
# Empty request
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
0000
EOF
git serve --stateless-rpc >out <in &&
@@ -33,7 +33,7 @@ test_expect_success 'stateless-rpc flag does not list capabilities' '
'
test_expect_success 'request invalid capability' '
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
foobar
0000
EOF
@@ -42,7 +42,7 @@ test_expect_success 'request invalid capability' '
'
test_expect_success 'request with no command' '
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
agent=git/test
0000
EOF
@@ -51,7 +51,7 @@ test_expect_success 'request with no command' '
'
test_expect_success 'request invalid command' '
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=foo
agent=git/test
0000
@@ -71,7 +71,7 @@ test_expect_success 'setup some refs and tags' '
'
test_expect_success 'basics of ls-refs' '
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=ls-refs
0000
EOF
@@ -88,12 +88,12 @@ test_expect_success 'basics of ls-refs' '
EOF
git serve --stateless-rpc <in >out &&
- test-pkt-line unpack <out >actual &&
- test_cmp actual expect
+ test-tool pkt-line unpack <out >actual &&
+ test_cmp expect actual
'
test_expect_success 'basic ref-prefixes' '
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=ls-refs
0001
ref-prefix refs/heads/master
@@ -108,12 +108,12 @@ test_expect_success 'basic ref-prefixes' '
EOF
git serve --stateless-rpc <in >out &&
- test-pkt-line unpack <out >actual &&
- test_cmp actual expect
+ test-tool pkt-line unpack <out >actual &&
+ test_cmp expect actual
'
test_expect_success 'refs/heads prefix' '
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=ls-refs
0001
ref-prefix refs/heads/
@@ -128,12 +128,12 @@ test_expect_success 'refs/heads prefix' '
EOF
git serve --stateless-rpc <in >out &&
- test-pkt-line unpack <out >actual &&
- test_cmp actual expect
+ test-tool pkt-line unpack <out >actual &&
+ test_cmp expect actual
'
test_expect_success 'peel parameter' '
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=ls-refs
0001
peel
@@ -149,12 +149,12 @@ test_expect_success 'peel parameter' '
EOF
git serve --stateless-rpc <in >out &&
- test-pkt-line unpack <out >actual &&
- test_cmp actual expect
+ test-tool pkt-line unpack <out >actual &&
+ test_cmp expect actual
'
test_expect_success 'symrefs parameter' '
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=ls-refs
0001
symrefs
@@ -170,12 +170,12 @@ test_expect_success 'symrefs parameter' '
EOF
git serve --stateless-rpc <in >out &&
- test-pkt-line unpack <out >actual &&
- test_cmp actual expect
+ test-tool pkt-line unpack <out >actual &&
+ test_cmp expect actual
'
test_expect_success 'sending server-options' '
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=ls-refs
server-option=hello
server-option=world
@@ -190,14 +190,14 @@ test_expect_success 'sending server-options' '
EOF
git serve --stateless-rpc <in >out &&
- test-pkt-line unpack <out >actual &&
- test_cmp actual expect
+ test-tool pkt-line unpack <out >actual &&
+ test_cmp expect actual
'
test_expect_success 'unexpected lines are not allowed in fetch request' '
git init server &&
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=fetch
0001
this-is-not-a-command
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index b82b5f8..8360188 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -29,7 +29,7 @@ test_expect_success 'list refs with git:// using protocol v2' '
grep "git< version 2" log &&
git ls-remote --symref "$GIT_DAEMON_URL/parent" >expect &&
- test_cmp actual expect
+ test_cmp expect actual
'
test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' '
@@ -42,7 +42,7 @@ test_expect_success 'ref advertisment is filtered with ls-remote using protocol
$(git -C "$daemon_parent" rev-parse refs/heads/master)$(printf "\t")refs/heads/master
EOF
- test_cmp actual expect
+ test_cmp expect actual
'
test_expect_success 'clone with git:// using protocol v2' '
@@ -151,7 +151,7 @@ test_expect_success 'list refs with file:// using protocol v2' '
grep "git< version 2" log &&
git ls-remote --symref "file://$(pwd)/file_parent" >expect &&
- test_cmp actual expect
+ test_cmp expect actual
'
test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' '
@@ -164,7 +164,7 @@ test_expect_success 'ref advertisment is filtered with ls-remote using protocol
$(git -C file_parent rev-parse refs/heads/master)$(printf "\t")refs/heads/master
EOF
- test_cmp actual expect
+ test_cmp expect actual
'
test_expect_success 'server-options are sent when using ls-remote' '
@@ -177,7 +177,7 @@ test_expect_success 'server-options are sent when using ls-remote' '
$(git -C file_parent rev-parse refs/heads/master)$(printf "\t")refs/heads/master
EOF
- test_cmp actual expect &&
+ test_cmp expect actual &&
grep "server-option=hello" log &&
grep "server-option=world" log
'
@@ -284,7 +284,7 @@ test_expect_success 'partial clone' '
grep "version 2" trace &&
# Ensure that the old version of the file is missing
- git -C client rev-list master --quiet --objects --missing=print \
+ git -C client rev-list --quiet --objects --missing=print master \
>observed.oids &&
grep "$(git -C server rev-parse message1:a.txt)" observed.oids &&
@@ -314,7 +314,7 @@ test_expect_success 'partial fetch' '
grep "version 2" trace &&
# Ensure that the old version of the file is missing
- git -C client rev-list other --quiet --objects --missing=print \
+ git -C client rev-list --quiet --objects --missing=print other \
>observed.oids &&
grep "$(git -C server rev-parse message1:a.txt)" observed.oids &&
@@ -351,7 +351,7 @@ test_expect_success 'even with handcrafted request, filter does not work if not
git -C server config uploadpack.allowfilter 0 &&
# Custom request that tries to filter even though it is not advertised.
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=fetch
0001
want $(git -C server rev-parse master)
diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh
index d1ccc22..3f58f05 100755
--- a/t/t5703-upload-pack-ref-in-want.sh
+++ b/t/t5703-upload-pack-ref-in-want.sh
@@ -9,14 +9,14 @@ get_actual_refs () {
/wanted-refs/d
/0001/d
p
- }' <out | test-pkt-line unpack >actual_refs
+ }' <out | test-tool pkt-line unpack >actual_refs
}
get_actual_commits () {
sed -n -e '/packfile/,/0000/{
/packfile/d
p
- }' <out | test-pkt-line unpack-sideband >o.pack &&
+ }' <out | test-tool pkt-line unpack-sideband >o.pack &&
git index-pack o.pack &&
git verify-pack -v o.idx | grep commit | cut -c-40 | sort >actual_commits
}
@@ -61,7 +61,7 @@ test_expect_success 'config controls ref-in-want advertisement' '
'
test_expect_success 'invalid want-ref line' '
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=fetch
0001
no-progress
@@ -80,7 +80,7 @@ test_expect_success 'basic want-ref' '
EOF
git rev-parse f | sort >expected_commits &&
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=fetch
0001
no-progress
@@ -101,7 +101,7 @@ test_expect_success 'multiple want-ref lines' '
EOF
git rev-parse c d | sort >expected_commits &&
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=fetch
0001
no-progress
@@ -122,7 +122,7 @@ test_expect_success 'mix want and want-ref' '
EOF
git rev-parse e f | sort >expected_commits &&
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=fetch
0001
no-progress
@@ -143,7 +143,7 @@ test_expect_success 'want-ref with ref we already have commit for' '
EOF
>expected_commits &&
- test-pkt-line pack >in <<-EOF &&
+ test-tool pkt-line pack >in <<-EOF &&
command=fetch
0001
no-progress
diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
index 20aee43..51ee887 100755
--- a/t/t6023-merge-file.sh
+++ b/t/t6023-merge-file.sh
@@ -99,7 +99,7 @@ EOF
printf "propter nomen suum." >> expect.txt
test_expect_success "merge does not add LF away of change" \
- "test_cmp test3.txt expect.txt"
+ "test_cmp expect.txt test3.txt"
cp test.txt backup.txt
test_expect_success "merge with conflicts" \
@@ -122,7 +122,7 @@ non timebo mala, quoniam tu mecum es:
virga tua et baculus tuus ipsa me consolata sunt.
EOF
-test_expect_success "expected conflict markers" "test_cmp test.txt expect.txt"
+test_expect_success "expected conflict markers" "test_cmp expect.txt test.txt"
cp backup.txt test.txt
@@ -138,7 +138,7 @@ non timebo mala, quoniam tu mecum es:
virga tua et baculus tuus ipsa me consolata sunt.
EOF
test_expect_success "merge conflicting with --ours" \
- "git merge-file --ours test.txt orig.txt new3.txt && test_cmp test.txt expect.txt"
+ "git merge-file --ours test.txt orig.txt new3.txt && test_cmp expect.txt test.txt"
cp backup.txt test.txt
cat > expect.txt << EOF
@@ -154,7 +154,7 @@ non timebo mala, quoniam tu mecum es:
virga tua et baculus tuus ipsa me consolata sunt.
EOF
test_expect_success "merge conflicting with --theirs" \
- "git merge-file --theirs test.txt orig.txt new3.txt && test_cmp test.txt expect.txt"
+ "git merge-file --theirs test.txt orig.txt new3.txt && test_cmp expect.txt test.txt"
cp backup.txt test.txt
cat > expect.txt << EOF
@@ -171,7 +171,7 @@ non timebo mala, quoniam tu mecum es:
virga tua et baculus tuus ipsa me consolata sunt.
EOF
test_expect_success "merge conflicting with --union" \
- "git merge-file --union test.txt orig.txt new3.txt && test_cmp test.txt expect.txt"
+ "git merge-file --union test.txt orig.txt new3.txt && test_cmp expect.txt test.txt"
cp backup.txt test.txt
test_expect_success "merge with conflicts, using -L" \
@@ -195,7 +195,7 @@ virga tua et baculus tuus ipsa me consolata sunt.
EOF
test_expect_success "expected conflict markers, with -L" \
- "test_cmp test.txt expect.txt"
+ "test_cmp expect.txt test.txt"
sed "s/ tu / TU /" < new1.txt > new5.txt
test_expect_success "conflict in removed tail" \
diff --git a/t/t6027-merge-binary.sh b/t/t6027-merge-binary.sh
index 0773541..4e6c7cb 100755
--- a/t/t6027-merge-binary.sh
+++ b/t/t6027-merge-binary.sh
@@ -45,7 +45,7 @@ test_expect_success resolve '
false
else
git ls-files -s >current
- test_cmp current expect
+ test_cmp expect current
fi
'
@@ -60,7 +60,7 @@ test_expect_success recursive '
false
else
git ls-files -s >current
- test_cmp current expect
+ test_cmp expect current
fi
'
diff --git a/t/t6031-merge-filemode.sh b/t/t6031-merge-filemode.sh
index 7d06461..87741ef 100755
--- a/t/t6031-merge-filemode.sh
+++ b/t/t6031-merge-filemode.sh
@@ -61,7 +61,7 @@ do_both_modes () {
git checkout -f a2 &&
test_must_fail git merge -s $strategy b2 &&
git ls-files -u >actual &&
- test_cmp actual expect &&
+ test_cmp expect actual &&
git ls-files -s file2 | grep ^100755
'
diff --git a/t/t6112-rev-list-filters-objects.sh b/t/t6112-rev-list-filters-objects.sh
index d4ff0b3..53975c5 100755
--- a/t/t6112-rev-list-filters-objects.sh
+++ b/t/t6112-rev-list-filters-objects.sh
@@ -21,24 +21,31 @@ test_expect_success 'setup r1' '
test_expect_success 'verify blob:none omits all 5 blobs' '
git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \
- | awk -f print_2.awk \
- | sort >expected &&
- git -C r1 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:none \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
- test_cmp observed expected
+ >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
+ git -C r1 rev-list --quiet --objects --filter-print-omitted \
+ --filter=blob:none HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify emitted+omitted == all' '
- git -C r1 rev-list HEAD --objects \
- | awk -f print_1.awk \
- | sort >expected &&
- git -C r1 rev-list HEAD --objects --filter-print-omitted --filter=blob:none \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
- test_cmp observed expected
+ git -C r1 rev-list --objects HEAD >revs &&
+ awk -f print_1.awk revs |
+ sort >expected &&
+
+ git -C r1 rev-list --objects --filter-print-omitted --filter=blob:none \
+ HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
@@ -58,65 +65,82 @@ test_expect_success 'setup r2' '
'
test_expect_success 'verify blob:limit=500 omits all blobs' '
- git -C r2 ls-files -s large.1000 large.10000 \
- | awk -f print_2.awk \
- | sort >expected &&
- git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=500 \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
- test_cmp observed expected
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
+ git -C r2 rev-list --quiet --objects --filter-print-omitted \
+ --filter=blob:limit=500 HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify emitted+omitted == all' '
- git -C r2 rev-list HEAD --objects \
- | awk -f print_1.awk \
- | sort >expected &&
- git -C r2 rev-list HEAD --objects --filter-print-omitted --filter=blob:limit=500 \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
- test_cmp observed expected
+ git -C r2 rev-list --objects HEAD >revs &&
+ awk -f print_1.awk revs |
+ sort >expected &&
+
+ git -C r2 rev-list --objects --filter-print-omitted \
+ --filter=blob:limit=500 HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify blob:limit=1000' '
- git -C r2 ls-files -s large.1000 large.10000 \
- | awk -f print_2.awk \
- | sort >expected &&
- git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1000 \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
- test_cmp observed expected
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
+ git -C r2 rev-list --quiet --objects --filter-print-omitted \
+ --filter=blob:limit=1000 HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify blob:limit=1001' '
- git -C r2 ls-files -s large.10000 \
- | awk -f print_2.awk \
- | sort >expected &&
- git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1001 \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
- test_cmp observed expected
+ git -C r2 ls-files -s large.10000 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
+ git -C r2 rev-list --quiet --objects --filter-print-omitted \
+ --filter=blob:limit=1001 HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify blob:limit=1k' '
- git -C r2 ls-files -s large.10000 \
- | awk -f print_2.awk \
- | sort >expected &&
- git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1k \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
- test_cmp observed expected
+ git -C r2 ls-files -s large.10000 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
+ git -C r2 rev-list --quiet --objects --filter-print-omitted \
+ --filter=blob:limit=1k HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify blob:limit=1m' '
- git -C r2 rev-list HEAD --quiet --objects --filter-print-omitted --filter=blob:limit=1m \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
+ git -C r2 rev-list --quiet --objects --filter-print-omitted \
+ --filter=blob:limit=1m HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
test_must_be_empty observed
'
@@ -141,25 +165,31 @@ test_expect_success 'setup r3' '
'
test_expect_success 'verify sparse:path=pattern1 omits top-level files' '
- git -C r3 ls-files -s sparse1 sparse2 \
- | awk -f print_2.awk \
- | sort >expected &&
- git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:path=../pattern1 \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
- test_cmp observed expected
+ git -C r3 ls-files -s sparse1 sparse2 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
+ git -C r3 rev-list --quiet --objects --filter-print-omitted \
+ --filter=sparse:path=../pattern1 HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify sparse:path=pattern2 omits both sparse2 files' '
- git -C r3 ls-files -s sparse2 dir1/sparse2 \
- | awk -f print_2.awk \
- | sort >expected &&
- git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:path=../pattern2 \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
- test_cmp observed expected
+ git -C r3 ls-files -s sparse2 dir1/sparse2 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
+ git -C r3 rev-list --quiet --objects --filter-print-omitted \
+ --filter=sparse:path=../pattern2 HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
# Test sparse:oid=<oid-ish> filter.
@@ -173,26 +203,33 @@ test_expect_success 'setup r3 part 2' '
'
test_expect_success 'verify sparse:oid=OID omits top-level files' '
- git -C r3 ls-files -s pattern sparse1 sparse2 \
- | awk -f print_2.awk \
- | sort >expected &&
+ git -C r3 ls-files -s pattern sparse1 sparse2 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
oid=$(git -C r3 ls-files -s pattern | awk -f print_2.awk) &&
- git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:oid=$oid \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r3 rev-list --quiet --objects --filter-print-omitted \
+ --filter=sparse:oid=$oid HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'verify sparse:oid=oid-ish omits top-level files' '
- git -C r3 ls-files -s pattern sparse1 sparse2 \
- | awk -f print_2.awk \
- | sort >expected &&
- git -C r3 rev-list HEAD --quiet --objects --filter-print-omitted --filter=sparse:oid=master:pattern \
- | awk -f print_1.awk \
- | sed "s/~//" \
- | sort >observed &&
- test_cmp observed expected
+ git -C r3 ls-files -s pattern sparse1 sparse2 >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
+ git -C r3 rev-list --quiet --objects --filter-print-omitted \
+ --filter=sparse:oid=master:pattern HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/~//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
# Delete some loose objects and use rev-list, but WITHOUT any filtering.
@@ -200,17 +237,21 @@ test_expect_success 'verify sparse:oid=oid-ish omits top-level files' '
test_expect_success 'rev-list W/ --missing=print' '
git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \
- | awk -f print_2.awk \
- | sort >expected &&
+ >ls_files_result &&
+ awk -f print_2.awk ls_files_result |
+ sort >expected &&
+
for id in `cat expected | sed "s|..|&/|"`
do
rm r1/.git/objects/$id
done &&
- git -C r1 rev-list --quiet HEAD --missing=print --objects \
- | awk -f print_1.awk \
- | sed "s/?//" \
- | sort >observed &&
- test_cmp observed expected
+
+ git -C r1 rev-list --quiet --missing=print --objects HEAD >revs &&
+ awk -f print_1.awk revs |
+ sed "s/?//" |
+ sort >observed &&
+
+ test_cmp expected observed
'
test_expect_success 'rev-list W/O --missing fails' '
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 818435f..4684d06 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -4,6 +4,7 @@ test_description='basic git gc tests
'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-terminal.sh
test_expect_success 'setup' '
# do not let the amount of physical memory affects gc
@@ -99,6 +100,26 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre
test_line_count = 2 new # There is one new pack and its .idx
'
+test_expect_success 'gc --no-quiet' '
+ git -c gc.writeCommitGraph=true gc --no-quiet >stdout 2>stderr &&
+ test_must_be_empty stdout &&
+ test_line_count = 1 stderr &&
+ test_i18ngrep "Computing commit graph generation numbers" stderr
+'
+
+test_expect_success TTY 'with TTY: gc --no-quiet' '
+ test_terminal git -c gc.writeCommitGraph=true gc --no-quiet >stdout 2>stderr &&
+ test_must_be_empty stdout &&
+ test_i18ngrep "Enumerating objects" stderr &&
+ test_i18ngrep "Computing commit graph generation numbers" stderr
+'
+
+test_expect_success 'gc --quiet' '
+ git -c gc.writeCommitGraph=true gc --quiet >stdout 2>stderr &&
+ test_must_be_empty stdout &&
+ test_must_be_empty stderr
+'
+
run_and_wait_for_auto_gc () {
# We read stdout from gc for the side effect of waiting until the
# background gc process exits, closing its fd 9. Furthermore, the
@@ -116,11 +137,11 @@ test_expect_success 'background auto gc does not run if gc.log is present and re
test_config gc.autopacklimit 1 &&
test_config gc.autodetach true &&
echo fleem >.git/gc.log &&
- test_must_fail git gc --auto 2>err &&
- test_i18ngrep "^error:" err &&
+ git gc --auto 2>err &&
+ test_i18ngrep "^warning:" err &&
test_config gc.logexpiry 5.days &&
test-tool chmtime =-345600 .git/gc.log &&
- test_must_fail git gc --auto &&
+ git gc --auto &&
test_config gc.logexpiry 2.days &&
run_and_wait_for_auto_gc &&
ls .git/objects/pack/pack-*.pack >packs &&
diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh
index 2da57fc..190ae14 100755
--- a/t/t7063-status-untracked-cache.sh
+++ b/t/t7063-status-untracked-cache.sh
@@ -55,7 +55,7 @@ test_expect_success 'setup' '
'
test_expect_success 'untracked cache is empty' '
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
cat >../expect-empty <<EOF &&
info/exclude 0000000000000000000000000000000000000000
core.excludesfile 0000000000000000000000000000000000000000
@@ -106,7 +106,7 @@ EOF
'
test_expect_success 'untracked cache after first status' '
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../dump.expect ../actual
'
@@ -126,7 +126,7 @@ EOF
'
test_expect_success 'untracked cache after second status' '
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../dump.expect ../actual
'
@@ -157,7 +157,7 @@ EOF
'
test_expect_success 'verify untracked cache dump' '
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
info/exclude $EMPTY_BLOB
core.excludesfile 0000000000000000000000000000000000000000
@@ -204,7 +204,7 @@ EOF
'
test_expect_success 'verify untracked cache dump' '
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
info/exclude $EMPTY_BLOB
core.excludesfile 0000000000000000000000000000000000000000
@@ -248,7 +248,7 @@ EOF
'
test_expect_success 'verify untracked cache dump' '
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
core.excludesfile 0000000000000000000000000000000000000000
@@ -267,7 +267,7 @@ EOF
test_expect_success 'move two from tracked to untracked' '
git rm --cached two &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
core.excludesfile 0000000000000000000000000000000000000000
@@ -304,7 +304,7 @@ EOF
'
test_expect_success 'verify untracked cache dump' '
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
core.excludesfile 0000000000000000000000000000000000000000
@@ -324,7 +324,7 @@ EOF
test_expect_success 'move two from untracked to tracked' '
git add two &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
core.excludesfile 0000000000000000000000000000000000000000
@@ -361,7 +361,7 @@ EOF
'
test_expect_success 'verify untracked cache dump' '
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
core.excludesfile 0000000000000000000000000000000000000000
@@ -405,7 +405,7 @@ EOF
'
test_expect_success 'untracked cache correct after commit' '
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
core.excludesfile 0000000000000000000000000000000000000000
@@ -464,7 +464,7 @@ EOF
'
test_expect_success 'untracked cache correct after status' '
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
cat >../expect <<EOF &&
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
core.excludesfile 0000000000000000000000000000000000000000
@@ -532,7 +532,7 @@ EOF
'
test_expect_success 'verify untracked cache dump (sparse/subdirs)' '
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
cat >../expect-from-test-dump <<EOF &&
info/exclude 13263c0978fb9fad16b2d580fb800b6d811c3ff0
core.excludesfile 0000000000000000000000000000000000000000
@@ -598,66 +598,66 @@ EOF
test_expect_success '--no-untracked-cache removes the cache' '
git update-index --no-untracked-cache &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
echo "no untracked cache" >../expect-no-uc &&
test_cmp ../expect-no-uc ../actual
'
test_expect_success 'git status does not change anything' '
git status &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-no-uc ../actual
'
test_expect_success 'setting core.untrackedCache to true and using git status creates the cache' '
git config core.untrackedCache true &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-no-uc ../actual &&
git status &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-from-test-dump ../actual
'
test_expect_success 'using --no-untracked-cache does not fail when core.untrackedCache is true' '
git update-index --no-untracked-cache &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-no-uc ../actual &&
git update-index --untracked-cache &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-empty ../actual
'
test_expect_success 'setting core.untrackedCache to false and using git status removes the cache' '
git config core.untrackedCache false &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-empty ../actual &&
git status &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-no-uc ../actual
'
test_expect_success 'using --untracked-cache does not fail when core.untrackedCache is false' '
git update-index --untracked-cache &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-empty ../actual
'
test_expect_success 'setting core.untrackedCache to keep' '
git config core.untrackedCache keep &&
git update-index --untracked-cache &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-empty ../actual &&
git status &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-from-test-dump ../actual &&
git update-index --no-untracked-cache &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-no-uc ../actual &&
git update-index --force-untracked-cache &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-empty ../actual &&
git status &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
test_cmp ../expect-from-test-dump ../actual
'
@@ -671,23 +671,23 @@ test_expect_success 'test ident field is working' '
test_expect_success 'untracked cache survives a checkout' '
git commit --allow-empty -m empty &&
- test-dump-untracked-cache >../before &&
+ test-tool dump-untracked-cache >../before &&
test_when_finished "git checkout master" &&
git checkout -b other_branch &&
- test-dump-untracked-cache >../after &&
+ test-tool dump-untracked-cache >../after &&
test_cmp ../before ../after &&
test_commit test &&
- test-dump-untracked-cache >../before &&
+ test-tool dump-untracked-cache >../before &&
git checkout master &&
- test-dump-untracked-cache >../after &&
+ test-tool dump-untracked-cache >../after &&
test_cmp ../before ../after
'
test_expect_success 'untracked cache survives a commit' '
- test-dump-untracked-cache >../before &&
+ test-tool dump-untracked-cache >../before &&
git add done/two &&
git commit -m commit &&
- test-dump-untracked-cache >../after &&
+ test-tool dump-untracked-cache >../after &&
test_cmp ../before ../after
'
@@ -751,7 +751,7 @@ test_expect_success '"status" after file replacement should be clean with UC=tru
git checkout master &&
avoid_racy &&
status_is_clean &&
- test-dump-untracked-cache >../actual &&
+ test-tool dump-untracked-cache >../actual &&
grep -F "recurse valid" ../actual >../actual.grep &&
cat >../expect.grep <<EOF &&
/ 0000000000000000000000000000000000000000 recurse valid
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 324933a..826987c 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -160,7 +160,7 @@ test_expect_success 'checkout -m with merge conflict' '
git diff master:one :3:uno |
sed -e "1,/^@@/d" -e "/^ /d" -e "s/^-/d/" -e "s/^+/a/" >current &&
fill d2 aT d7 aS >expect &&
- test_cmp current expect &&
+ test_cmp expect current &&
git diff --cached two >current &&
test_must_be_empty current
'
@@ -174,7 +174,7 @@ test_expect_success 'format of merge conflict from checkout -m' '
git ls-files >current &&
fill same two two two >expect &&
- test_cmp current expect &&
+ test_cmp expect current &&
cat <<-EOF >expect &&
<<<<<<< simple
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 10dc916..e87164a 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -789,7 +789,7 @@ test_expect_success 'submodule add places git-dir in superprojects git-dir' '
(cd .git/modules/deeper/submodule &&
git log > ../../../../actual
) &&
- test_cmp actual expected
+ test_cmp expected actual
)
'
@@ -807,7 +807,7 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir' '
(cd .git/modules/deeper/submodule &&
git log > ../../../../actual
) &&
- test_cmp actual expected
+ test_cmp expected actual
)
'
@@ -827,7 +827,7 @@ test_expect_success 'submodule add places git-dir in superprojects git-dir recur
git add deeper/submodule &&
git commit -m "update submodule" &&
git push origin : &&
- test_cmp actual expected
+ test_cmp expected actual
)
'
@@ -874,7 +874,7 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re
(cd .git/modules/submodule/modules/subsubmodule &&
git log > ../../../../../actual
) &&
- test_cmp actual expected
+ test_cmp expected actual
)
'
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index 170b481..31ab608 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -359,4 +359,27 @@ test_expect_success 'new line found before status message in commit template' '
test_i18ncmp expected-template editor-input
'
+test_expect_success 'setup empty commit with unstaged rename and copy' '
+ test_create_repo unstaged_rename_and_copy &&
+ (
+ cd unstaged_rename_and_copy &&
+
+ echo content >orig &&
+ git add orig &&
+ test_commit orig &&
+
+ cp orig new_copy &&
+ mv orig new_rename &&
+ git add -N new_copy new_rename
+ )
+'
+
+test_expect_success 'check commit with unstaged rename and copy' '
+ (
+ cd unstaged_rename_and_copy &&
+
+ test_must_fail git -c diff.renames=copy commit
+ )
+'
+
test_done
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 1a6773e..f1349af 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -99,12 +99,12 @@ test_expect_success '--dry-run with stuff to commit returns ok' '
git commit -m next -a --dry-run
'
-test_expect_failure '--short with stuff to commit returns ok' '
+test_expect_success '--short with stuff to commit returns ok' '
echo bongo bongo bongo >>file &&
git commit -m next -a --short
'
-test_expect_failure '--porcelain with stuff to commit returns ok' '
+test_expect_success '--porcelain with stuff to commit returns ok' '
echo bongo bongo bongo >>file &&
git commit -m next -a --porcelain
'
@@ -698,4 +698,10 @@ test_expect_success '--dry-run with conflicts fixed from a merge' '
git commit -m "conflicts fixed from merge."
'
+test_expect_success '--dry-run --short' '
+ >test-file &&
+ git add test-file &&
+ git commit --dry-run --short
+'
+
test_done
diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
index 756beb0..3e0a61d 100755
--- a/t/t7519-status-fsmonitor.sh
+++ b/t/t7519-status-fsmonitor.sh
@@ -4,13 +4,6 @@ test_description='git status with file system watcher'
. ./test-lib.sh
-#
-# To run the entire git test suite using fsmonitor:
-#
-# copy t/t7519/fsmonitor-all to a location in your path and then set
-# GIT_FSMONITOR_TEST=fsmonitor-all and run your tests.
-#
-
# Note, after "git reset --hard HEAD" no extensions exist other than 'TREE'
# "git update-index --fsmonitor" can be used to get the extension written
# before testing the results.
@@ -84,21 +77,21 @@ test_expect_success 'setup' '
# test that the fsmonitor extension is off by default
test_expect_success 'fsmonitor extension is off by default' '
- test-dump-fsmonitor >actual &&
+ test-tool dump-fsmonitor >actual &&
grep "^no fsmonitor" actual
'
# test that "update-index --fsmonitor" adds the fsmonitor extension
test_expect_success 'update-index --fsmonitor" adds the fsmonitor extension' '
git update-index --fsmonitor &&
- test-dump-fsmonitor >actual &&
+ test-tool dump-fsmonitor >actual &&
grep "^fsmonitor last update" actual
'
# test that "update-index --no-fsmonitor" removes the fsmonitor extension
test_expect_success 'update-index --no-fsmonitor" removes the fsmonitor extension' '
git update-index --no-fsmonitor &&
- test-dump-fsmonitor >actual &&
+ test-tool dump-fsmonitor >actual &&
grep "^no fsmonitor" actual
'
@@ -245,9 +238,9 @@ do
git config core.preloadIndex $preload_val &&
if test $preload_val = true
then
- GIT_FORCE_PRELOAD_TEST=$preload_val; export GIT_FORCE_PRELOAD_TEST
+ GIT_TEST_PRELOAD_INDEX=$preload_val; export GIT_TEST_PRELOAD_INDEX
else
- unset GIT_FORCE_PRELOAD_TEST
+ sane_unset GIT_TEST_PRELOAD_INDEX
fi
'
@@ -307,9 +300,9 @@ test_expect_success 'splitting the index results in the same state' '
dirty_repo &&
git update-index --fsmonitor &&
git ls-files -f >expect &&
- test-dump-fsmonitor >&2 && echo &&
+ test-tool dump-fsmonitor >&2 && echo &&
git update-index --fsmonitor --split-index &&
- test-dump-fsmonitor >&2 && echo &&
+ test-tool dump-fsmonitor >&2 && echo &&
git ls-files -f >actual &&
test_cmp expect actual
'
@@ -333,7 +326,7 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
git update-index --fsmonitor &&
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace-before" \
git status &&
- test-dump-untracked-cache >../before
+ test-tool dump-untracked-cache >../before
) &&
cat >>dot-git/.git/hooks/fsmonitor-test <<-\EOF &&
printf ".git\0"
@@ -345,7 +338,7 @@ test_expect_success UNTRACKED_CACHE 'ignore .git changes when invalidating UNTR'
cd dot-git &&
GIT_TRACE_UNTRACKED_STATS="$TRASH_DIRECTORY/trace-after" \
git status &&
- test-dump-untracked-cache >../after
+ test-tool dump-untracked-cache >../after
) &&
grep "directory invalidation" trace-before >>before &&
grep "directory invalidation" trace-after >>after &&
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 668bbee..562bd21 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -557,7 +557,7 @@ test_expect_success SYMLINKS 'difftool --dir-diff --symlink without unstaged cha
EOF
git difftool --dir-diff --symlink \
--extcmd "./.git/CHECK_SYMLINKS" branch HEAD &&
- test_cmp actual expect
+ test_cmp expect actual
'
write_script modify-right-file <<\EOF
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index be5c1bd..43aa416 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -309,6 +309,8 @@ do
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth -1 -n -e vvv $H >actual &&
+ test_cmp expected actual &&
+ git grep --recursive -n -e vvv $H >actual &&
test_cmp expected actual
'
@@ -317,6 +319,8 @@ do
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H >actual &&
+ test_cmp expected actual &&
+ git grep --no-recursive -n -e vvv $H >actual &&
test_cmp expected actual
'
@@ -327,6 +331,8 @@ do
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- "*" >actual &&
+ test_cmp expected actual &&
+ git grep --no-recursive -n -e vvv $H -- "*" >actual &&
test_cmp expected actual
'
@@ -344,6 +350,8 @@ do
echo ${HC}t/v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- t >actual &&
+ test_cmp expected actual &&
+ git grep --no-recursive -n -e vvv $H -- t >actual &&
test_cmp expected actual
'
@@ -353,6 +361,8 @@ do
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- . t >actual &&
+ test_cmp expected actual &&
+ git grep --no-recursive -n -e vvv $H -- . t >actual &&
test_cmp expected actual
'
@@ -362,6 +372,8 @@ do
echo ${HC}v:1:vvv
} >expected &&
git grep --max-depth 0 -n -e vvv $H -- t . >actual &&
+ test_cmp expected actual &&
+ git grep --no-recursive -n -e vvv $H -- t . >actual &&
test_cmp expected actual
'
test_expect_success "grep $L with grep.extendedRegexp=false" '
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 9af6078..2c309a5 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -221,7 +221,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
EOF
-test_expect_success POSIXPERM,SYMLINKS "$name" "test_cmp a expected"
+test_expect_success POSIXPERM,SYMLINKS "$name" "test_cmp expected a"
test_expect_success 'exit if remote refs are ambigious' '
git config --add svn-remote.svn.fetch \
diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
index 8a5c8dc..c26c4b0 100755
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
@@ -174,7 +174,8 @@ test_expect_success 'test create-ignore' "
cmp ./deeply/.gitignore create-ignore.expect &&
cmp ./deeply/nested/.gitignore create-ignore.expect &&
cmp ./deeply/nested/directory/.gitignore create-ignore.expect &&
- git ls-files -s | grep gitignore | cmp - create-ignore-index.expect
+ git ls-files -s >ls_files_result &&
+ grep gitignore ls_files_result | cmp - create-ignore-index.expect
"
cat >prop.expect <<\EOF
@@ -189,17 +190,21 @@ EOF
# This test can be improved: since all the svn:ignore contain the same
# pattern, it can pass even though the propget did not execute on the
# right directory.
-test_expect_success 'test propget' "
- git svn propget svn:ignore . | cmp - prop.expect &&
+test_expect_success 'test propget' '
+ test_propget () {
+ git svn propget $1 $2 >actual &&
+ cmp $3 actual
+ } &&
+ test_propget svn:ignore . prop.expect &&
cd deeply &&
- git svn propget svn:ignore . | cmp - ../prop.expect &&
- git svn propget svn:entry:committed-rev nested/directory/.keep \
- | cmp - ../prop2.expect &&
- git svn propget svn:ignore .. | cmp - ../prop.expect &&
- git svn propget svn:ignore nested/ | cmp - ../prop.expect &&
- git svn propget svn:ignore ./nested | cmp - ../prop.expect &&
- git svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect
- "
+ test_propget svn:ignore . ../prop.expect &&
+ test_propget svn:entry:committed-rev nested/directory/.keep \
+ ../prop2.expect &&
+ test_propget svn:ignore .. ../prop.expect &&
+ test_propget svn:ignore nested/ ../prop.expect &&
+ test_propget svn:ignore ./nested ../prop.expect &&
+ test_propget svn:ignore .././deeply/nested ../prop.expect
+ '
cat >prop.expect <<\EOF
Properties on '.':
@@ -218,8 +223,11 @@ Properties on 'nested/directory/.keep':
EOF
test_expect_success 'test proplist' "
- git svn proplist . | cmp - prop.expect &&
- git svn proplist nested/directory/.keep | cmp - prop2.expect
+ git svn proplist . >actual &&
+ cmp prop.expect actual &&
+
+ git svn proplist nested/directory/.keep >actual &&
+ cmp prop2.expect actual
"
test_done
diff --git a/t/t9133-git-svn-nested-git-repo.sh b/t/t9133-git-svn-nested-git-repo.sh
index f3c30e6..f894860 100755
--- a/t/t9133-git-svn-nested-git-repo.sh
+++ b/t/t9133-git-svn-nested-git-repo.sh
@@ -45,7 +45,7 @@ test_expect_success 'update git svn-cloned repo' '
git svn rebase &&
echo a > expect &&
echo b >> expect &&
- test_cmp a expect &&
+ test_cmp expect a &&
rm expect
)
'
@@ -69,7 +69,7 @@ test_expect_success 'update git svn-cloned repo' '
git svn rebase &&
echo a > expect &&
echo b >> expect &&
- test_cmp a expect &&
+ test_cmp expect a &&
rm expect
)
'
@@ -93,7 +93,7 @@ test_expect_success 'update git svn-cloned repo again' '
echo a > expect &&
echo b >> expect &&
echo c >> expect &&
- test_cmp a expect &&
+ test_cmp expect a &&
rm expect
)
'
diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh
index 5dfee07..251fdd6 100755
--- a/t/t9600-cvsimport.sh
+++ b/t/t9600-cvsimport.sh
@@ -148,7 +148,7 @@ test_expect_success PERL 'import from a CVS working tree' '
git cvsimport -a -z0 &&
echo 1 >expect &&
git log -1 --pretty=format:%s%n >actual &&
- test_cmp actual expect
+ test_cmp expect actual
)
'
diff --git a/t/t9603-cvsimport-patchsets.sh b/t/t9603-cvsimport-patchsets.sh
index c4c3c49..3e64b11 100755
--- a/t/t9603-cvsimport-patchsets.sh
+++ b/t/t9603-cvsimport-patchsets.sh
@@ -29,11 +29,11 @@ test_expect_failure PERL 'import with criss cross times on revisions' '
Rev 3
Rev 2
Rev 1" > expect-master &&
- test_cmp actual-master expect-master &&
+ test_cmp expect-master actual-master &&
echo "Rev 5 Branch A Wed Mar 11 19:09:10 2009 +0000
Rev 4 Branch A Wed Mar 11 19:03:52 2009 +0000" > expect-A &&
- test_cmp actual-A expect-A
+ test_cmp expect-A actual-A
'
test_done
diff --git a/t/t9604-cvsimport-timestamps.sh b/t/t9604-cvsimport-timestamps.sh
index a4b3db2..2ff4aa9 100755
--- a/t/t9604-cvsimport-timestamps.sh
+++ b/t/t9604-cvsimport-timestamps.sh
@@ -31,7 +31,7 @@ test_expect_success PERL 'check timestamps are UTC (TZ=CST6CDT)' '
Rev 2 2005-02-01 00:00:00 +0000
Rev 1 2005-01-01 00:00:00 +0000
EOF
- test_cmp actual-1 expect-1
+ test_cmp expect-1 actual-1
'
test_expect_success PERL 'check timestamps with author-specific timezones' '
@@ -65,7 +65,7 @@ test_expect_success PERL 'check timestamps with author-specific timezones' '
Rev 2 2005-01-31 18:00:00 -0600 User Two
Rev 1 2005-01-01 00:00:00 +0000 User One
EOF
- test_cmp actual-2 expect-2
+ test_cmp expect-2 actual-2
'
test_done
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index d82fac9..78d8c37 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1157,3 +1157,72 @@ depacketize () {
}
'
}
+
+# Set the hash algorithm in use to $1. Only useful when testing the testsuite.
+test_set_hash () {
+ test_hash_algo="$1"
+}
+
+# Detect the hash algorithm in use.
+test_detect_hash () {
+ # Currently we only support SHA-1, but in the future this function will
+ # actually detect the algorithm in use.
+ test_hash_algo='sha1'
+}
+
+# Load common hash metadata and common placeholder object IDs for use with
+# test_oid.
+test_oid_init () {
+ test -n "$test_hash_algo" || test_detect_hash &&
+ test_oid_cache <"$TEST_DIRECTORY/oid-info/hash-info" &&
+ test_oid_cache <"$TEST_DIRECTORY/oid-info/oid"
+}
+
+# Load key-value pairs from stdin suitable for use with test_oid. Blank lines
+# and lines starting with "#" are ignored. Keys must be shell identifier
+# characters.
+#
+# Examples:
+# rawsz sha1:20
+# rawsz sha256:32
+test_oid_cache () {
+ local tag rest k v &&
+
+ { test -n "$test_hash_algo" || test_detect_hash; } &&
+ while read tag rest
+ do
+ case $tag in
+ \#*)
+ continue;;
+ ?*)
+ # non-empty
+ ;;
+ *)
+ # blank line
+ continue;;
+ esac &&
+
+ k="${rest%:*}" &&
+ v="${rest#*:}" &&
+
+ if ! expr "$k" : '[a-z0-9][a-z0-9]*$' >/dev/null
+ then
+ error 'bug in the test script: bad hash algorithm'
+ fi &&
+ eval "test_oid_${k}_$tag=\"\$v\""
+ done
+}
+
+# Look up a per-hash value based on a key ($1). The value must have been loaded
+# by test_oid_init or test_oid_cache.
+test_oid () {
+ local var="test_oid_${test_hash_algo}_$1" &&
+
+ # If the variable is unset, we must be missing an entry for this
+ # key-hash pair, so exit with an error.
+ if eval "test -z \"\${$var+set}\""
+ then
+ error "bug in the test script: undefined key '$1'" >&2
+ fi &&
+ eval "printf '%s' \"\${$var}\""
+}
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 3f95bfd..897e6fc 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -134,9 +134,40 @@ export EDITOR
GIT_TRACE_BARE=1
export GIT_TRACE_BARE
-if test -n "${TEST_GIT_INDEX_VERSION:+isset}"
+check_var_migration () {
+ # the warnings and hints given from this helper depends
+ # on end-user settings, which will disrupt the self-test
+ # done on the test framework itself.
+ case "$GIT_TEST_FRAMEWORK_SELFTEST" in
+ t) return ;;
+ esac
+
+ old_name=$1 new_name=$2
+ eval "old_isset=\${${old_name}:+isset}"
+ eval "new_isset=\${${new_name}:+isset}"
+
+ case "$old_isset,$new_isset" in
+ isset,)
+ echo >&2 "warning: $old_name is now $new_name"
+ echo >&2 "hint: set $new_name too during the transition period"
+ eval "$new_name=\$$old_name"
+ ;;
+ isset,isset)
+ # do this later
+ # echo >&2 "warning: $old_name is now $new_name"
+ # echo >&2 "hint: remove $old_name"
+ ;;
+ esac
+}
+
+check_var_migration GIT_FSMONITOR_TEST GIT_TEST_FSMONITOR
+check_var_migration TEST_GIT_INDEX_VERSION GIT_TEST_INDEX_VERSION
+check_var_migration GIT_FORCE_PRELOAD_TEST GIT_TEST_PRELOAD_INDEX
+
+# Use specific version of the index file format
+if test -n "${GIT_TEST_INDEX_VERSION:+isset}"
then
- GIT_INDEX_VERSION="$TEST_GIT_INDEX_VERSION"
+ GIT_INDEX_VERSION="$GIT_TEST_INDEX_VERSION"
export GIT_INDEX_VERSION
fi