diff options
Diffstat (limited to 't')
83 files changed, 1187 insertions, 253 deletions
@@ -397,6 +397,10 @@ GIT_TEST_STASH_USE_BUILTIN=<boolean>, when false, disables the built-in version of git-stash. See 'stash.useBuiltin' in git-config(1). +GIT_TEST_ADD_I_USE_BUILTIN=<boolean>, when true, enables the +built-in version of git add -i. See 'add.interactive.useBuiltin' in +git-config(1). + 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 diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh index 006d2a8152..1f32ca66ea 100644 --- a/t/gitweb-lib.sh +++ b/t/gitweb-lib.sh @@ -58,10 +58,11 @@ gitweb_run () { GATEWAY_INTERFACE='CGI/1.1' HTTP_ACCEPT='*/*' REQUEST_METHOD='GET' - QUERY_STRING=""$1"" - PATH_INFO=""$2"" + QUERY_STRING=$1 + PATH_INFO=$2 + REQUEST_URI=/gitweb.cgi$PATH_INFO export GATEWAY_INTERFACE HTTP_ACCEPT REQUEST_METHOD \ - QUERY_STRING PATH_INFO + QUERY_STRING PATH_INFO REQUEST_URI GITWEB_CONFIG=$(pwd)/gitweb_config.perl export GITWEB_CONFIG diff --git a/t/helper/test-read-graph.c b/t/helper/test-read-graph.c new file mode 100644 index 0000000000..d2884efe0a --- /dev/null +++ b/t/helper/test-read-graph.c @@ -0,0 +1,53 @@ +#include "test-tool.h" +#include "cache.h" +#include "commit-graph.h" +#include "repository.h" +#include "object-store.h" + +int cmd__read_graph(int argc, const char **argv) +{ + struct commit_graph *graph = NULL; + char *graph_name; + int open_ok; + int fd; + struct stat st; + const char *object_dir; + + setup_git_directory(); + object_dir = get_object_directory(); + + graph_name = get_commit_graph_filename(object_dir); + + open_ok = open_commit_graph(graph_name, &fd, &st); + if (!open_ok) + die_errno(_("Could not open commit-graph '%s'"), graph_name); + + graph = load_commit_graph_one_fd_st(fd, &st); + if (!graph) + return 1; + + FREE_AND_NULL(graph_name); + + printf("header: %08x %d %d %d %d\n", + ntohl(*(uint32_t*)graph->data), + *(unsigned char*)(graph->data + 4), + *(unsigned char*)(graph->data + 5), + *(unsigned char*)(graph->data + 6), + *(unsigned char*)(graph->data + 7)); + printf("num_commits: %u\n", graph->num_commits); + printf("chunks:"); + + if (graph->chunk_oid_fanout) + printf(" oid_fanout"); + if (graph->chunk_oid_lookup) + printf(" oid_lookup"); + if (graph->chunk_commit_data) + printf(" commit_metadata"); + if (graph->chunk_extra_edges) + printf(" extra_edges"); + printf("\n"); + + UNLEAK(graph); + + return 0; +} diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index 19ee26d931..f20989d449 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -45,6 +45,7 @@ static struct test_cmd cmds[] = { { "progress", cmd__progress }, { "reach", cmd__reach }, { "read-cache", cmd__read_cache }, + { "read-graph", cmd__read_graph }, { "read-midx", cmd__read_midx }, { "ref-store", cmd__ref_store }, { "regex", cmd__regex }, diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h index c2aa56ef50..8ed2af71d1 100644 --- a/t/helper/test-tool.h +++ b/t/helper/test-tool.h @@ -35,6 +35,7 @@ int cmd__prio_queue(int argc, const char **argv); int cmd__progress(int argc, const char **argv); int cmd__reach(int argc, const char **argv); int cmd__read_cache(int argc, const char **argv); +int cmd__read_graph(int argc, const char **argv); int cmd__read_midx(int argc, const char **argv); int cmd__ref_store(int argc, const char **argv); int cmd__regex(int argc, const char **argv); diff --git a/t/perf/bisect_regression b/t/perf/bisect_regression index a94d9955d0..ce47e1662a 100755 --- a/t/perf/bisect_regression +++ b/t/perf/bisect_regression @@ -51,7 +51,7 @@ oldtime=$(echo "$oldtime" | sed -e 's/^\([0-9]\+\.[0-9]\+\).*$/\1/') newtime=$(echo "$newtime" | sed -e 's/^\([0-9]\+\.[0-9]\+\).*$/\1/') test $(echo "$newtime" "$oldtime" | awk '{ print ($1 > $2) }') = 1 || - die "New time '$newtime' shoud be greater than old time '$oldtime'" + die "New time '$newtime' should be greater than old time '$oldtime'" tmpdir=$(mktemp -d -t bisect_regression_XXXXXX) || die "Failed to create temp directory" echo "$oldtime" >"$tmpdir/oldtime" || die "Failed to write to '$tmpdir/oldtime'" diff --git a/t/perf/p5303-many-packs.sh b/t/perf/p5303-many-packs.sh index 3779851941..a369152c47 100755 --- a/t/perf/p5303-many-packs.sh +++ b/t/perf/p5303-many-packs.sh @@ -77,6 +77,7 @@ do # actual pack generation, without smudging the on-disk setup # between trials. test_perf "repack ($nr_packs)" ' + GIT_TEST_FULL_IN_PACK_ARRAY=1 \ git pack-objects --keep-true-parents \ --honor-pack-keep --non-empty --all \ --reflog --indexed-objects --delta-base-offset \ diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 4d3f7ba295..7aabde1a69 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -126,7 +126,7 @@ check_sub_test_lib_test () { check_sub_test_lib_test_err () { name="$1" # stdin is the expected output from the test - # expected error output is in descriptior 3 + # expected error output is in descriptor 3 ( cd "$name" && sed -e 's/^> //' -e 's/Z$//' >expect.out && diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh index 959b6da449..9fcd56fab3 100755 --- a/t/t0027-auto-crlf.sh +++ b/t/t0027-auto-crlf.sh @@ -215,7 +215,7 @@ stats_ascii () { } -# contruct the attr/ returned by git ls-files --eol +# construct the attr/ returned by git ls-files --eol # Take none (=empty), one or two args # convert.c: eol=XX overrides text=auto attr_ascii () { diff --git a/t/t0028-working-tree-encoding.sh b/t/t0028-working-tree-encoding.sh index 7aa0945d8d..bfc4fb9af5 100755 --- a/t/t0028-working-tree-encoding.sh +++ b/t/t0028-working-tree-encoding.sh @@ -17,7 +17,7 @@ test_lazy_prereq NO_UTF32_BOM ' write_utf16 () { if test_have_prereq NO_UTF16_BOM then - printf '\xfe\xff' + printf '\376\377' fi && iconv -f UTF-8 -t UTF-16 } @@ -25,7 +25,7 @@ write_utf16 () { write_utf32 () { if test_have_prereq NO_UTF32_BOM then - printf '\x00\x00\xfe\xff' + printf '\0\0\376\377' fi && iconv -f UTF-8 -t UTF-32 } diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh index 501e1a288d..553e94bc5a 100755 --- a/t/t0060-path-utils.sh +++ b/t/t0060-path-utils.sh @@ -285,8 +285,10 @@ test_git_path GIT_OBJECT_DIRECTORY=foo objects/foo foo/foo test_git_path GIT_OBJECT_DIRECTORY=foo objects2 .git/objects2 test_expect_success 'setup common repository' 'git --git-dir=bar init' test_git_path GIT_COMMON_DIR=bar index .git/index +test_git_path GIT_COMMON_DIR=bar index.lock .git/index.lock test_git_path GIT_COMMON_DIR=bar HEAD .git/HEAD test_git_path GIT_COMMON_DIR=bar logs/HEAD .git/logs/HEAD +test_git_path GIT_COMMON_DIR=bar logs/HEAD.lock .git/logs/HEAD.lock test_git_path GIT_COMMON_DIR=bar logs/refs/bisect/foo .git/logs/refs/bisect/foo test_git_path GIT_COMMON_DIR=bar logs/refs bar/logs/refs test_git_path GIT_COMMON_DIR=bar logs/refs/ bar/logs/refs/ diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh index 24ccbd8d3b..d2d088d9a0 100755 --- a/t/t0500-progress-display.sh +++ b/t/t0500-progress-display.sh @@ -76,7 +76,7 @@ EOF ' test_expect_success 'progress display breaks long lines #2' ' - # Note: we dont need that many spaces after the title to cover up + # Note: we do not need that many spaces after the title to cover up # the last line before breaking the progress line. sed -e "s/Z$//" >expect <<\EOF && Working hard.......2.........3.........4.........5.........6: 0% (1/100000)<CR> @@ -104,7 +104,7 @@ EOF ' test_expect_success 'progress display breaks long lines #3 - even the first is too long' ' - # Note: we dont actually need any spaces at the end of the title + # Note: we do not actually need any spaces at the end of the title # line, because there is no previous progress line to cover up. sed -e "s/Z$//" >expect <<\EOF && Working hard.......2.........3.........4.........5.........6: Z diff --git a/t/t1050-large.sh b/t/t1050-large.sh index dcb4dbba67..d3b2adb28b 100755 --- a/t/t1050-large.sh +++ b/t/t1050-large.sh @@ -194,15 +194,15 @@ test_expect_success 'pack-objects with large loose object' ' test_cmp huge actual ' -test_expect_success 'tar achiving' ' +test_expect_success 'tar archiving' ' git archive --format=tar HEAD >/dev/null ' -test_expect_success 'zip achiving, store only' ' +test_expect_success 'zip archiving, store only' ' git archive --format=zip -0 HEAD >/dev/null ' -test_expect_success 'zip achiving, deflate' ' +test_expect_success 'zip archiving, deflate' ' git archive --format=zip HEAD >/dev/null ' diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 1fbd940408..69a7f27311 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -344,14 +344,16 @@ test_expect_success "verifying $m's log (logged by config)" ' test_cmp expect .git/logs/$m ' -git update-ref $m $D -cat >.git/logs/$m <<EOF -$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 -$Z $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500 -EOF +test_expect_success 'set up for querying the reflog' ' + git update-ref $m $D && + cat >.git/logs/$m <<-EOF + $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 + $Z $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500 + EOF +' ed="Thu, 26 May 2005 18:32:00 -0500" gd="Thu, 26 May 2005 18:33:00 -0500" diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 50d28e6fdb..7c7ff7e961 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -616,7 +616,7 @@ test_expect_success 'fsck --name-objects' ' remove_object $(git rev-parse julius:caesar.t) && test_must_fail git fsck --name-objects >out && tree=$(git rev-parse --verify julius:) && - test_i18ngrep -E "$tree \((refs/heads/master|HEAD)@\{[0-9]*\}:" out + test_i18ngrep "$tree (refs/tags/julius:" out ) ' diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh index 0177fd815c..603019b541 100755 --- a/t/t1500-rev-parse.sh +++ b/t/t1500-rev-parse.sh @@ -146,6 +146,16 @@ test_expect_success 'rev-parse --show-object-format in repo' ' grep "unknown mode for --show-object-format: squeamish-ossifrage" err ' +test_expect_success '--show-toplevel from subdir of working tree' ' + pwd >expect && + git -C sub/dir rev-parse --show-toplevel >actual && + test_cmp expect actual +' + +test_expect_success '--show-toplevel from inside .git' ' + test_must_fail git -C .git rev-parse --show-toplevel +' + test_expect_success 'showing the superproject correctly' ' git rev-parse --show-superproject-working-tree >out && test_must_be_empty out && diff --git a/t/t1512-rev-parse-disambiguation.sh b/t/t1512-rev-parse-disambiguation.sh index c19fb500cb..25744e270a 100755 --- a/t/t1512-rev-parse-disambiguation.sh +++ b/t/t1512-rev-parse-disambiguation.sh @@ -339,7 +339,7 @@ test_expect_success C_LOCALE_OUTPUT 'ambiguity hints' ' test_expect_success C_LOCALE_OUTPUT 'ambiguity hints respect type' ' test_must_fail git rev-parse 000000000^{commit} 2>stderr && grep ^hint: stderr >hints && - # 5 commits, 1 tag (which is a commitish), plus intro line + # 5 commits, 1 tag (which is a committish), plus intro line test_line_count = 7 hints ' diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh index e819ba741e..8a9831413c 100755 --- a/t/t2400-worktree-add.sh +++ b/t/t2400-worktree-add.sh @@ -587,4 +587,28 @@ test_expect_success '"add" should not fail because of another bad worktree' ' ) ' +test_expect_success '"add" with uninitialized submodule, with submodule.recurse unset' ' + test_create_repo submodule && + test_commit -C submodule first && + test_create_repo project && + git -C project submodule add ../submodule && + git -C project add submodule && + test_tick && + git -C project commit -m add_sub && + git clone project project-clone && + git -C project-clone worktree add ../project-2 +' +test_expect_success '"add" with uninitialized submodule, with submodule.recurse set' ' + git -C project-clone -c submodule.recurse worktree add ../project-3 +' + +test_expect_success '"add" with initialized submodule, with submodule.recurse unset' ' + git -C project-clone submodule update --init && + git -C project-clone worktree add ../project-4 +' + +test_expect_success '"add" with initialized submodule, with submodule.recurse set' ' + git -C project-clone -c submodule.recurse worktree add ../project-5 +' + test_done diff --git a/t/t3060-ls-files-with-tree.sh b/t/t3060-ls-files-with-tree.sh index 44f378ce41..52ed665fcd 100755 --- a/t/t3060-ls-files-with-tree.sh +++ b/t/t3060-ls-files-with-tree.sh @@ -47,7 +47,7 @@ test_expect_success setup ' git add . ' -test_expect_success 'git -ls-files --with-tree should succeed from subdir' ' +test_expect_success 'git ls-files --with-tree should succeed from subdir' ' # We have to run from a sub-directory to trigger prune_path # Then we finally get to run our --with-tree test ( @@ -57,7 +57,7 @@ test_expect_success 'git -ls-files --with-tree should succeed from subdir' ' ' test_expect_success \ - 'git -ls-files --with-tree should add entries from named tree.' \ + 'git ls-files --with-tree should add entries from named tree.' \ 'test_cmp expected output' test_done diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index 0579cd9969..ec2b456dbb 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -8,8 +8,8 @@ test_description='range-diff tests' # harm than good. We need some real history. test_expect_success 'setup' ' - git fast-import < "$TEST_DIRECTORY"/t3206/history.export && - test_oid_cache <<-EOF + git fast-import <"$TEST_DIRECTORY"/t3206/history.export && + test_oid_cache <<-\EOF # topic t1 sha1:4de457d t2 sha1:fccce22 @@ -121,88 +121,88 @@ test_expect_success 'setup' ' test_expect_success 'simple A..B A..C (unmodified)' ' git range-diff --no-color master..topic master..unmodified \ >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ 4: $(test_oid t4) = 4: $(test_oid u4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'simple B...C (unmodified)' ' git range-diff --no-color topic...unmodified >actual && - # same "expected" as above - test_cmp expected actual + # same "expect" as above + test_cmp expect actual ' test_expect_success 'simple A B C (unmodified)' ' git range-diff --no-color master topic unmodified >actual && - # same "expected" as above - test_cmp expected actual + # same "expect" as above + test_cmp expect actual ' test_expect_success 'trivial reordering' ' git range-diff --no-color master topic reordered >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid r1) s/5/A/ 3: $(test_oid t3) = 2: $(test_oid r2) s/11/B/ 4: $(test_oid t4) = 3: $(test_oid r3) s/12/B/ 2: $(test_oid t2) = 4: $(test_oid r4) s/4/A/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'removed a commit' ' git range-diff --no-color master topic removed >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid d1) s/5/A/ 2: $(test_oid t2) < -: $(test_oid __) s/4/A/ 3: $(test_oid t3) = 2: $(test_oid d2) s/11/B/ 4: $(test_oid t4) = 3: $(test_oid d3) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'added a commit' ' git range-diff --no-color master topic added >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid a1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid a2) s/4/A/ -: $(test_oid __) > 3: $(test_oid a3) s/6/A/ 3: $(test_oid t3) = 4: $(test_oid a4) s/11/B/ 4: $(test_oid t4) = 5: $(test_oid a5) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'new base, A B C' ' git range-diff --no-color master topic rebased >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid b1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid b2) s/4/A/ 3: $(test_oid t3) = 3: $(test_oid b3) s/11/B/ 4: $(test_oid t4) = 4: $(test_oid b4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'new base, B...C' ' # this syntax includes the commits from master! git range-diff --no-color topic...rebased >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && -: $(test_oid __) > 1: $(test_oid b5) unrelated 1: $(test_oid t1) = 2: $(test_oid b1) s/5/A/ 2: $(test_oid t2) = 3: $(test_oid b2) s/4/A/ 3: $(test_oid t3) = 4: $(test_oid b3) s/11/B/ 4: $(test_oid t4) = 5: $(test_oid b4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'changed commit' ' git range-diff --no-color topic...changed >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid c2) s/4/A/ 3: $(test_oid t3) ! 3: $(test_oid c3) s/11/B/ @@ -226,23 +226,23 @@ test_expect_success 'changed commit' ' +B 13 EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'changed commit with --no-patch diff option' ' git range-diff --no-color --no-patch topic...changed >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid c2) s/4/A/ 3: $(test_oid t3) ! 3: $(test_oid c3) s/11/B/ 4: $(test_oid t4) ! 4: $(test_oid c4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'changed commit with --stat diff option' ' git range-diff --no-color --stat topic...changed >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ a => b | 0 1 file changed, 0 insertions(+), 0 deletions(-) @@ -256,12 +256,12 @@ test_expect_success 'changed commit with --stat diff option' ' a => b | 0 1 file changed, 0 insertions(+), 0 deletions(-) EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'changed commit with sm config' ' git range-diff --no-color --submodule=log topic...changed >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid c2) s/4/A/ 3: $(test_oid t3) ! 3: $(test_oid c3) s/11/B/ @@ -285,12 +285,12 @@ test_expect_success 'changed commit with sm config' ' +B 13 EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'renamed file' ' git range-diff --no-color --submodule=log topic...renamed-file >actual && - sed s/Z/\ /g >expected <<-EOF && + sed s/Z/\ /g >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid n1) s/5/A/ 2: $(test_oid t2) ! 2: $(test_oid n2) s/4/A/ @@ Metadata @@ -330,12 +330,12 @@ test_expect_success 'renamed file' ' Z 10 Z B EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'file with mode only change' ' git range-diff --no-color --submodule=log topic...mode-only-change >actual && - sed s/Z/\ /g >expected <<-EOF && + sed s/Z/\ /g >expect <<-EOF && 1: fccce22 ! 1: 4d39cb3 s/4/A/ @@ Metadata ZAuthor: Thomas Rast <trast@inf.ethz.ch> @@ -370,12 +370,12 @@ test_expect_success 'file with mode only change' ' + ## other-file (mode change 100644 => 100755) ## 3: a63e992 = 3: 4c1e0f5 s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'file added and later removed' ' git range-diff --no-color --submodule=log topic...added-removed >actual && - sed s/Z/\ /g >expected <<-EOF && + sed s/Z/\ /g >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid s1) s/5/A/ 2: $(test_oid t2) ! 2: $(test_oid s2) s/4/A/ @@ Metadata @@ -411,7 +411,7 @@ test_expect_success 'file added and later removed' ' + ## new-file (deleted) ## 4: $(test_oid t4) = 4: $(test_oid s4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'no commits on one side' ' @@ -421,7 +421,7 @@ test_expect_success 'no commits on one side' ' test_expect_success 'changed message' ' git range-diff --no-color topic...changed-message >actual && - sed s/Z/\ /g >expected <<-EOF && + sed s/Z/\ /g >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid m1) s/5/A/ 2: $(test_oid t2) ! 2: $(test_oid m2) s/4/A/ @@ Metadata @@ -436,7 +436,7 @@ test_expect_success 'changed message' ' 3: $(test_oid t3) = 3: $(test_oid m3) s/11/B/ 4: $(test_oid t4) = 4: $(test_oid m4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'dual-coloring' ' @@ -505,4 +505,202 @@ test_expect_success 'range-diff overrides diff.noprefix internally' ' git -c diff.noprefix=true range-diff HEAD^... ' +test_expect_success 'range-diff compares notes by default' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + git range-diff --no-color master..topic master..unmodified \ + >actual && + sed s/Z/\ /g >expect <<-EOF && + 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ + 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ + 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ + 4: $(test_oid t4) ! 4: $(test_oid u4) s/12/B/ + @@ Commit message + Z + Z + Z ## Notes ## + - topic note + + unmodified note + Z + Z ## file ## + Z@@ file: A + EOF + test_cmp expect actual +' + +test_expect_success 'range-diff with --no-notes' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + git range-diff --no-color --no-notes master..topic master..unmodified \ + >actual && + cat >expect <<-EOF && + 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ + 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ + 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ + 4: $(test_oid t4) = 4: $(test_oid u4) s/12/B/ + EOF + test_cmp expect actual +' + +test_expect_success 'range-diff with multiple --notes' ' + git notes --ref=note1 add -m "topic note1" topic && + git notes --ref=note1 add -m "unmodified note1" unmodified && + test_when_finished git notes --ref=note1 remove topic unmodified && + git notes --ref=note2 add -m "topic note2" topic && + git notes --ref=note2 add -m "unmodified note2" unmodified && + test_when_finished git notes --ref=note2 remove topic unmodified && + git range-diff --no-color --notes=note1 --notes=note2 master..topic master..unmodified \ + >actual && + sed s/Z/\ /g >expect <<-EOF && + 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ + 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ + 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ + 4: $(test_oid t4) ! 4: $(test_oid u4) s/12/B/ + @@ Commit message + Z + Z + Z ## Notes (note1) ## + - topic note1 + + unmodified note1 + Z + Z + Z ## Notes (note2) ## + - topic note2 + + unmodified note2 + Z + Z ## file ## + Z@@ file: A + EOF + test_cmp expect actual +' + +test_expect_success 'format-patch --range-diff does not compare notes by default' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + git format-patch --cover-letter --range-diff=$prev \ + master..unmodified >actual && + test_when_finished "rm 000?-*" && + test_line_count = 5 actual && + test_i18ngrep "^Range-diff:$" 0000-* && + grep "= 1: .* s/5/A" 0000-* && + grep "= 2: .* s/4/A" 0000-* && + grep "= 3: .* s/11/B" 0000-* && + grep "= 4: .* s/12/B" 0000-* && + ! grep "Notes" 0000-* && + ! grep "note" 0000-* +' + +test_expect_success 'format-patch --range-diff with --no-notes' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + git format-patch --no-notes --cover-letter --range-diff=$prev \ + master..unmodified >actual && + test_when_finished "rm 000?-*" && + test_line_count = 5 actual && + test_i18ngrep "^Range-diff:$" 0000-* && + grep "= 1: .* s/5/A" 0000-* && + grep "= 2: .* s/4/A" 0000-* && + grep "= 3: .* s/11/B" 0000-* && + grep "= 4: .* s/12/B" 0000-* && + ! grep "Notes" 0000-* && + ! grep "note" 0000-* +' + +test_expect_success 'format-patch --range-diff with --notes' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + git format-patch --notes --cover-letter --range-diff=$prev \ + master..unmodified >actual && + test_when_finished "rm 000?-*" && + test_line_count = 5 actual && + test_i18ngrep "^Range-diff:$" 0000-* && + grep "= 1: .* s/5/A" 0000-* && + grep "= 2: .* s/4/A" 0000-* && + grep "= 3: .* s/11/B" 0000-* && + grep "! 4: .* s/12/B" 0000-* && + sed s/Z/\ /g >expect <<-EOF && + @@ Commit message + Z + Z + Z ## Notes ## + - topic note + + unmodified note + Z + Z ## file ## + Z@@ file: A + EOF + sed "/@@ Commit message/,/@@ file: A/!d" 0000-* >actual && + test_cmp expect actual +' + +test_expect_success 'format-patch --range-diff with --notes' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + test_config format.notes true && + git format-patch --cover-letter --range-diff=$prev \ + master..unmodified >actual && + test_when_finished "rm 000?-*" && + test_line_count = 5 actual && + test_i18ngrep "^Range-diff:$" 0000-* && + grep "= 1: .* s/5/A" 0000-* && + grep "= 2: .* s/4/A" 0000-* && + grep "= 3: .* s/11/B" 0000-* && + grep "! 4: .* s/12/B" 0000-* && + sed s/Z/\ /g >expect <<-EOF && + @@ Commit message + Z + Z + Z ## Notes ## + - topic note + + unmodified note + Z + Z ## file ## + Z@@ file: A + EOF + sed "/@@ Commit message/,/@@ file: A/!d" 0000-* >actual && + test_cmp expect actual +' + +test_expect_success 'format-patch --range-diff with multiple notes' ' + git notes --ref=note1 add -m "topic note1" topic && + git notes --ref=note1 add -m "unmodified note1" unmodified && + test_when_finished git notes --ref=note1 remove topic unmodified && + git notes --ref=note2 add -m "topic note2" topic && + git notes --ref=note2 add -m "unmodified note2" unmodified && + test_when_finished git notes --ref=note2 remove topic unmodified && + git format-patch --notes=note1 --notes=note2 --cover-letter --range-diff=$prev \ + master..unmodified >actual && + test_when_finished "rm 000?-*" && + test_line_count = 5 actual && + test_i18ngrep "^Range-diff:$" 0000-* && + grep "= 1: .* s/5/A" 0000-* && + grep "= 2: .* s/4/A" 0000-* && + grep "= 3: .* s/11/B" 0000-* && + grep "! 4: .* s/12/B" 0000-* && + sed s/Z/\ /g >expect <<-EOF && + @@ Commit message + Z + Z + Z ## Notes (note1) ## + - topic note1 + + unmodified note1 + Z + Z + Z ## Notes (note2) ## + - topic note2 + + unmodified note2 + Z + Z ## file ## + Z@@ file: A + EOF + sed "/@@ Commit message/,/@@ file: A/!d" 0000-* >actual && + test_cmp expect actual +' + test_done diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh index 9ea5fa4fd2..f41b2afb99 100755 --- a/t/t3210-pack-refs.sh +++ b/t/t3210-pack-refs.sh @@ -240,7 +240,7 @@ test_expect_success 'retry acquiring packed-refs.lock' ' test_expect_success SYMLINKS 'pack symlinked packed-refs' ' # First make sure that symlinking works when reading: - git update-ref refs/heads/loosy refs/heads/master && + git update-ref refs/heads/lossy refs/heads/master && git for-each-ref >all-refs-before && mv .git/packed-refs .git/my-deviant-packed-refs && ln -s my-deviant-packed-refs .git/packed-refs && diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh index 1f5122b632..ee8a8dba52 100755 --- a/t/t3403-rebase-skip.sh +++ b/t/t3403-rebase-skip.sh @@ -7,6 +7,8 @@ test_description='git rebase --merge --skip tests' . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-rebase.sh + # we assume the default git am -3 --skip strategy is tested independently # and always works :) @@ -20,6 +22,13 @@ test_expect_success setup ' git commit -a -m "hello world" && echo goodbye >> hello && git commit -a -m "goodbye" && + git tag goodbye && + + git checkout --detach && + git checkout HEAD^ . && + test_tick && + git commit -m reverted-goodbye && + git tag reverted-goodbye && git checkout -f skip-reference && echo moo > hello && @@ -76,4 +85,27 @@ test_expect_success 'moved back to branch correctly' ' test_debug 'gitk --all & sleep 1' +test_expect_success 'fixup that empties commit fails' ' + test_when_finished "git rebase --abort" && + ( + set_fake_editor && + test_must_fail env FAKE_LINES="1 fixup 2" git rebase -i \ + goodbye^ reverted-goodbye + ) +' + +test_expect_success 'squash that empties commit fails' ' + test_when_finished "git rebase --abort" && + ( + set_fake_editor && + test_must_fail env FAKE_LINES="1 squash 2" git rebase -i \ + goodbye^ reverted-goodbye + ) +' + +# Must be the last test in this file +test_expect_success '$EDITOR and friends are unchanged' ' + test_editor_unchanged +' + test_done diff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh index 9efcf4808a..7ab0152d3e 100755 --- a/t/t3430-rebase-merges.sh +++ b/t/t3430-rebase-merges.sh @@ -408,7 +408,7 @@ test_expect_success 'octopus merges' ' | | * three | * | two | |/ - * | one + * / one |/ o before-octopus EOF @@ -468,4 +468,31 @@ test_expect_success '--rebase-merges with strategies' ' test_cmp expect G.t ' +test_expect_success '--rebase-merges with commit that can generate bad characters for filename' ' + git checkout -b colon-in-label E && + git merge -m "colon: this should work" G && + git rebase --rebase-merges --force-rebase E +' + +test_expect_success '--rebase-merges with message matched with onto label' ' + git checkout -b onto-label E && + git merge -m onto G && + git rebase --rebase-merges --force-rebase E && + test_cmp_graph <<-\EOF + * onto + |\ + | * G + | * F + * | E + |\ \ + | * | B + * | | D + | |/ + |/| + * | C + |/ + * A + EOF +' + test_done diff --git a/t/t3434-rebase-i18n.sh b/t/t3434-rebase-i18n.sh new file mode 100755 index 0000000000..4b5b128cd6 --- /dev/null +++ b/t/t3434-rebase-i18n.sh @@ -0,0 +1,84 @@ +#!/bin/sh +# +# Copyright (c) 2019 Doan Tran Cong Danh +# + +test_description='rebase with changing encoding + +Initial setup: + +1 - 2 master + \ + 3 - 4 first + \ + 5 - 6 second +' + +. ./test-lib.sh + +compare_msg () { + iconv -f "$2" -t "$3" "$TEST_DIRECTORY/t3434/$1" >expect && + git cat-file commit HEAD >raw && + sed "1,/^$/d" raw >actual && + test_cmp expect actual +} + +test_expect_success setup ' + test_commit one && + git branch first && + test_commit two && + git switch first && + test_commit three && + git branch second && + test_commit four && + git switch second && + test_commit five && + test_commit six +' + +test_expect_success 'rebase --rebase-merges update encoding eucJP to UTF-8' ' + git switch -c merge-eucJP-UTF-8 first && + git config i18n.commitencoding eucJP && + git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second && + git config i18n.commitencoding UTF-8 && + git rebase --rebase-merges master && + compare_msg eucJP.txt eucJP UTF-8 +' + +test_expect_failure 'rebase --rebase-merges update encoding eucJP to ISO-2022-JP' ' + git switch -c merge-eucJP-ISO-2022-JP first && + git config i18n.commitencoding eucJP && + git merge -F "$TEST_DIRECTORY/t3434/eucJP.txt" second && + git config i18n.commitencoding ISO-2022-JP && + git rebase --rebase-merges master && + compare_msg eucJP.txt eucJP ISO-2022-JP +' + +test_rebase_continue_update_encode () { + old=$1 + new=$2 + msgfile=$3 + test_expect_success "rebase --continue update from $old to $new" ' + (git rebase --abort || : abort current git-rebase failure) && + git switch -c conflict-$old-$new one && + echo for-conflict >two.t && + git add two.t && + git config i18n.commitencoding $old && + git commit -F "$TEST_DIRECTORY/t3434/$msgfile" && + git config i18n.commitencoding $new && + test_must_fail git rebase -m master && + test -f .git/rebase-merge/message && + git stripspace <.git/rebase-merge/message >two.t && + git add two.t && + git rebase --continue && + compare_msg $msgfile $old $new && + : git-commit assume invalid utf-8 is latin1 && + test_cmp expect two.t + ' +} + +test_rebase_continue_update_encode ISO-8859-1 UTF-8 ISO8859-1.txt +test_rebase_continue_update_encode eucJP UTF-8 eucJP.txt +test_rebase_continue_update_encode eucJP ISO-2022-JP eucJP.txt + +test_done diff --git a/t/t3434/ISO8859-1.txt b/t/t3434/ISO8859-1.txt new file mode 100644 index 0000000000..7cbef0ee6f --- /dev/null +++ b/t/t3434/ISO8859-1.txt @@ -0,0 +1,3 @@ +ÄËÑÏÖ + +Ábçdèfg diff --git a/t/t3434/eucJP.txt b/t/t3434/eucJP.txt new file mode 100644 index 0000000000..546f2aac01 --- /dev/null +++ b/t/t3434/eucJP.txt @@ -0,0 +1,4 @@ +¤Ï¤ì¤Ò¤Û¤Õ + +¤·¤Æ¤¤¤ë¤Î¤¬¡¢¤¤¤ë¤Î¤Ç¡£ +ßÀÉͤۤì¤×¤ê¤Ý¤ì¤Þ¤Ó¤°¤ê¤í¤Ø¡£ diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index d50e165ca8..d4f9386621 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@ -647,4 +647,29 @@ test_expect_success 'checkout -p works with pathological context lines' ' test_write_lines a b a b a a b a b a >expect && test_cmp expect a ' + +test_expect_success 'show help from add--helper' ' + git reset --hard && + cat >expect <<-EOF && + + <BOLD>*** Commands ***<RESET> + 1: <BOLD;BLUE>s<RESET>tatus 2: <BOLD;BLUE>u<RESET>pdate 3: <BOLD;BLUE>r<RESET>evert 4: <BOLD;BLUE>a<RESET>dd untracked + 5: <BOLD;BLUE>p<RESET>atch 6: <BOLD;BLUE>d<RESET>iff 7: <BOLD;BLUE>q<RESET>uit 8: <BOLD;BLUE>h<RESET>elp + <BOLD;BLUE>What now<RESET>> <BOLD;RED>status - show paths with changes<RESET> + <BOLD;RED>update - add working tree state to the staged set of changes<RESET> + <BOLD;RED>revert - revert staged set of changes back to the HEAD version<RESET> + <BOLD;RED>patch - pick hunks and update selectively<RESET> + <BOLD;RED>diff - view diff between HEAD and index<RESET> + <BOLD;RED>add untracked - add contents of untracked files to the staged set of changes<RESET> + <BOLD>*** Commands ***<RESET> + 1: <BOLD;BLUE>s<RESET>tatus 2: <BOLD;BLUE>u<RESET>pdate 3: <BOLD;BLUE>r<RESET>evert 4: <BOLD;BLUE>a<RESET>dd untracked + 5: <BOLD;BLUE>p<RESET>atch 6: <BOLD;BLUE>d<RESET>iff 7: <BOLD;BLUE>q<RESET>uit 8: <BOLD;BLUE>h<RESET>elp + <BOLD;BLUE>What now<RESET>>$SP + Bye. + EOF + test_write_lines h | GIT_PAGER_IN_USE=true TERM=vt100 git add -i >actual.colored && + test_decode_color <actual.colored >actual && + test_i18ncmp expect actual +' + test_done diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh index b92ff95977..d277a9f4b7 100755 --- a/t/t3900-i18n-commit.sh +++ b/t/t3900-i18n-commit.sh @@ -204,4 +204,41 @@ test_commit_autosquash_flags eucJP fixup test_commit_autosquash_flags ISO-2022-JP squash +test_commit_autosquash_multi_encoding () { + flag=$1 + old=$2 + new=$3 + msg=$4 + test_expect_success "commit --$flag into $old from $new" ' + git checkout -b $flag-$old-$new C0 && + git config i18n.commitencoding $old && + echo $old >>F && + git commit -a -F "$TEST_DIRECTORY"/t3900/$msg && + test_tick && + echo intermediate stuff >>G && + git add G && + git commit -a -m "intermediate commit" && + test_tick && + git config i18n.commitencoding $new && + echo $new-$flag >>F && + git commit -a --$flag HEAD^ && + git rebase --autosquash -i HEAD^^^ && + git rev-list HEAD >actual && + test_line_count = 3 actual && + iconv -f $old -t UTF-8 "$TEST_DIRECTORY"/t3900/$msg >expect && + if test $flag = squash; then + subject="$(head -1 expect)" && + printf "\nsquash! %s\n" "$subject" >>expect + fi && + git cat-file commit HEAD^ >raw && + (sed "1,/^$/d" raw | iconv -f $new -t utf-8) >actual && + test_cmp expect actual + ' +} + +test_commit_autosquash_multi_encoding fixup UTF-8 ISO-8859-1 1-UTF-8.txt +test_commit_autosquash_multi_encoding squash ISO-8859-1 UTF-8 ISO8859-1.txt +test_commit_autosquash_multi_encoding squash eucJP ISO-2022-JP eucJP.txt +test_commit_autosquash_multi_encoding fixup ISO-2022-JP UTF-8 ISO-2022-JP.txt + test_done diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index a4da72f0ab..ea56e85e70 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -244,8 +244,11 @@ test_expect_success 'save -q is quiet' ' test_must_be_empty output.out ' -test_expect_success 'pop -q is quiet' ' +test_expect_success 'pop -q works and is quiet' ' git stash pop -q >output.out 2>&1 && + echo bar >expect && + git show :file >actual && + test_cmp expect actual && test_must_be_empty output.out ' @@ -254,6 +257,8 @@ test_expect_success 'pop -q --index works and is quiet' ' git add file && git stash save --quiet && git stash pop -q --index >output.out 2>&1 && + git diff-files file2 >file2.diff && + test_must_be_empty file2.diff && test foo = "$(git show :file)" && test_must_be_empty output.out ' diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh index 29ca76f2fb..f075c7f1f3 100755 --- a/t/t3905-stash-include-untracked.sh +++ b/t/t3905-stash-include-untracked.sh @@ -277,8 +277,8 @@ test_expect_success 'stash -u -- <ignored> leaves ignored file alone' ' test_path_is_file ignored.d/bar ' -test_expect_success 'stash -u -- <non-existant> shows no changes when there are none' ' - git stash push -u -- non-existant >actual && +test_expect_success 'stash -u -- <non-existent> shows no changes when there are none' ' + git stash push -u -- non-existent >actual && echo "No local changes to save" >expect && test_i18ncmp expect actual ' diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh index 6f5ef0035e..c0f4839543 100755 --- a/t/t4018-diff-funcname.sh +++ b/t/t4018-diff-funcname.sh @@ -32,6 +32,7 @@ diffpatterns=" csharp css dts + elixir fortran fountain golang diff --git a/t/t4018/elixir-do-not-pick-end b/t/t4018/elixir-do-not-pick-end new file mode 100644 index 0000000000..fae08ba7e8 --- /dev/null +++ b/t/t4018/elixir-do-not-pick-end @@ -0,0 +1,5 @@ +defmodule RIGHT do +end +# +# +# ChangeMe; do not pick up 'end' line diff --git a/t/t4018/elixir-ex-unit-test b/t/t4018/elixir-ex-unit-test new file mode 100644 index 0000000000..0560a2b697 --- /dev/null +++ b/t/t4018/elixir-ex-unit-test @@ -0,0 +1,6 @@ +defmodule Test do + test "RIGHT" do + assert true == true + assert ChangeMe + end +end diff --git a/t/t4018/elixir-function b/t/t4018/elixir-function new file mode 100644 index 0000000000..d452f495a7 --- /dev/null +++ b/t/t4018/elixir-function @@ -0,0 +1,5 @@ +def function(RIGHT, arg) do + # comment + # comment + ChangeMe +end diff --git a/t/t4018/elixir-macro b/t/t4018/elixir-macro new file mode 100644 index 0000000000..4f925e9ad4 --- /dev/null +++ b/t/t4018/elixir-macro @@ -0,0 +1,5 @@ +defmacro foo(RIGHT) do + # Code + # Code + ChangeMe +end diff --git a/t/t4018/elixir-module b/t/t4018/elixir-module new file mode 100644 index 0000000000..91a4e7aa20 --- /dev/null +++ b/t/t4018/elixir-module @@ -0,0 +1,9 @@ +defmodule RIGHT do + @moduledoc """ + Foo bar + """ + + def ChangeMe(a) where is_map(a) do + a + end +end diff --git a/t/t4018/elixir-module-func b/t/t4018/elixir-module-func new file mode 100644 index 0000000000..c9910d0675 --- /dev/null +++ b/t/t4018/elixir-module-func @@ -0,0 +1,8 @@ +defmodule Foo do + def fun(RIGHT) do + # Code + # Code + # Code + ChangeMe + end +end diff --git a/t/t4018/elixir-nested-module b/t/t4018/elixir-nested-module new file mode 100644 index 0000000000..771ebc5c42 --- /dev/null +++ b/t/t4018/elixir-nested-module @@ -0,0 +1,9 @@ +defmodule MyApp.RIGHT do + @moduledoc """ + Foo bar + """ + + def ChangeMe(a) where is_map(a) do + a + end +end diff --git a/t/t4018/elixir-private-function b/t/t4018/elixir-private-function new file mode 100644 index 0000000000..1aabe33b7a --- /dev/null +++ b/t/t4018/elixir-private-function @@ -0,0 +1,5 @@ +defp function(RIGHT, arg) do + # comment + # comment + ChangeMe +end diff --git a/t/t4018/elixir-protocol b/t/t4018/elixir-protocol new file mode 100644 index 0000000000..7d9173691e --- /dev/null +++ b/t/t4018/elixir-protocol @@ -0,0 +1,6 @@ +defprotocol RIGHT do + @doc """ + Calculates the size (and not the length!) of a data structure + """ + def size(data, ChangeMe) +end diff --git a/t/t4018/elixir-protocol-implementation b/t/t4018/elixir-protocol-implementation new file mode 100644 index 0000000000..f9234bbfc4 --- /dev/null +++ b/t/t4018/elixir-protocol-implementation @@ -0,0 +1,5 @@ +defimpl RIGHT do + # Docs + # Docs + def foo(ChangeMe), do: :ok +end diff --git a/t/t4018/python-async-def b/t/t4018/python-async-def new file mode 100644 index 0000000000..87640e03d2 --- /dev/null +++ b/t/t4018/python-async-def @@ -0,0 +1,4 @@ +async def RIGHT(pi: int = 3.14): + while True: + break + return ChangeMe() diff --git a/t/t4018/python-class b/t/t4018/python-class new file mode 100644 index 0000000000..ba9e741430 --- /dev/null +++ b/t/t4018/python-class @@ -0,0 +1,4 @@ +class RIGHT(int, str): + # comment + # another comment + # ChangeMe diff --git a/t/t4018/python-def b/t/t4018/python-def new file mode 100644 index 0000000000..e50b31b0ad --- /dev/null +++ b/t/t4018/python-def @@ -0,0 +1,4 @@ +def RIGHT(pi: int = 3.14): + while True: + break + return ChangeMe() diff --git a/t/t4018/python-indented-async-def b/t/t4018/python-indented-async-def new file mode 100644 index 0000000000..f5d03258af --- /dev/null +++ b/t/t4018/python-indented-async-def @@ -0,0 +1,7 @@ +class Foo: + async def RIGHT(self, x: int): + return [ + 1, + 2, + ChangeMe, + ] diff --git a/t/t4018/python-indented-class b/t/t4018/python-indented-class new file mode 100644 index 0000000000..19b4f35c4c --- /dev/null +++ b/t/t4018/python-indented-class @@ -0,0 +1,5 @@ +if TYPE_CHECKING: + class RIGHT: + # comment + # another comment + # ChangeMe diff --git a/t/t4018/python-indented-def b/t/t4018/python-indented-def new file mode 100644 index 0000000000..208fbadd2b --- /dev/null +++ b/t/t4018/python-indented-def @@ -0,0 +1,7 @@ +class Foo: + def RIGHT(self, x: int): + return [ + 1, + 2, + ChangeMe, + ] diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh index 619bf97098..f852136585 100755 --- a/t/t4041-diff-submodule-option.sh +++ b/t/t4041-diff-submodule-option.sh @@ -284,7 +284,7 @@ test_expect_success 'submodule contains untracked content (all ignored)' ' test_must_be_empty actual ' -test_expect_success 'submodule contains untracked and modifed content' ' +test_expect_success 'submodule contains untracked and modified content' ' echo new > sm1/foo6 && git diff-index -p --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -294,7 +294,7 @@ test_expect_success 'submodule contains untracked and modifed content' ' test_cmp expected actual ' -test_expect_success 'submodule contains untracked and modifed content (untracked ignored)' ' +test_expect_success 'submodule contains untracked and modified content (untracked ignored)' ' echo new > sm1/foo6 && git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -303,19 +303,19 @@ test_expect_success 'submodule contains untracked and modifed content (untracked test_cmp expected actual ' -test_expect_success 'submodule contains untracked and modifed content (dirty ignored)' ' +test_expect_success 'submodule contains untracked and modified content (dirty ignored)' ' echo new > sm1/foo6 && git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual && test_must_be_empty actual ' -test_expect_success 'submodule contains untracked and modifed content (all ignored)' ' +test_expect_success 'submodule contains untracked and modified content (all ignored)' ' echo new > sm1/foo6 && git diff-index -p --ignore-submodules --submodule=log HEAD >actual && test_must_be_empty actual ' -test_expect_success 'submodule contains modifed content' ' +test_expect_success 'submodule contains modified content' ' rm -f sm1/new-file && git diff-index -p --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -369,7 +369,7 @@ test_expect_success 'modified submodule contains untracked content (all ignored) test_must_be_empty actual ' -test_expect_success 'modified submodule contains untracked and modifed content' ' +test_expect_success 'modified submodule contains untracked and modified content' ' echo modification >> sm1/foo6 && git diff-index -p --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -381,7 +381,7 @@ test_expect_success 'modified submodule contains untracked and modifed content' test_cmp expected actual ' -test_expect_success 'modified submodule contains untracked and modifed content (untracked ignored)' ' +test_expect_success 'modified submodule contains untracked and modified content (untracked ignored)' ' echo modification >> sm1/foo6 && git diff-index -p --ignore-submodules=untracked --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -392,7 +392,7 @@ test_expect_success 'modified submodule contains untracked and modifed content ( test_cmp expected actual ' -test_expect_success 'modified submodule contains untracked and modifed content (dirty ignored)' ' +test_expect_success 'modified submodule contains untracked and modified content (dirty ignored)' ' echo modification >> sm1/foo6 && git diff-index -p --ignore-submodules=dirty --submodule=log HEAD >actual && cat >expected <<-EOF && @@ -402,13 +402,13 @@ test_expect_success 'modified submodule contains untracked and modifed content ( test_cmp expected actual ' -test_expect_success 'modified submodule contains untracked and modifed content (all ignored)' ' +test_expect_success 'modified submodule contains untracked and modified content (all ignored)' ' echo modification >> sm1/foo6 && git diff-index -p --ignore-submodules --submodule=log HEAD >actual && test_must_be_empty actual ' -test_expect_success 'modified submodule contains modifed content' ' +test_expect_success 'modified submodule contains modified content' ' rm -f sm1/new-file && git diff-index -p --submodule=log HEAD >actual && cat >expected <<-EOF && diff --git a/t/t4057-diff-combined-paths.sh b/t/t4057-diff-combined-paths.sh index dff36b77ec..4f4b541658 100755 --- a/t/t4057-diff-combined-paths.sh +++ b/t/t4057-diff-combined-paths.sh @@ -33,7 +33,7 @@ test_expect_success 'trivial merge - combine-diff empty' ' ' -test_expect_success 'only one trully conflicting path' ' +test_expect_success 'only one truly conflicting path' ' git checkout side && for i in $(test_seq 2 9) do diff --git a/t/t4100/t-apply-1.patch b/t/t4100/t-apply-1.patch index 90ab54f0f5..43394f8285 100644 --- a/t/t4100/t-apply-1.patch +++ b/t/t4100/t-apply-1.patch @@ -75,8 +75,8 @@ diff --git a/Documentation/git.txt b/Documentation/git.txt +link:git-ssh-pull.html[git-ssh-pull]:: Pulls from a remote repository over ssh connection - Interogators: -@@ -156,8 +156,8 @@ Interogators: + Interrogators: +@@ -156,8 +156,8 @@ Interrogators: link:git-diff-helper.html[git-diff-helper]:: Generates patch format output for git-diff-* diff --git a/t/t4100/t-apply-3.patch b/t/t4100/t-apply-3.patch index 90cdbaa5bb..cac172e779 100644 --- a/t/t4100/t-apply-3.patch +++ b/t/t4100/t-apply-3.patch @@ -211,7 +211,7 @@ dissimilarity index 82% - - /* If this is an exact directory match, we may have - * directory files following this path. Match on them. -- * Otherwise, we're at a pach subcomponent, and we need +- * Otherwise, we're at a patch subcomponent, and we need - * to try to match again. - */ - if (mtype == 0) diff --git a/t/t4100/t-apply-5.patch b/t/t4100/t-apply-5.patch index 5f6ddc1059..57ec79d887 100644 --- a/t/t4100/t-apply-5.patch +++ b/t/t4100/t-apply-5.patch @@ -185,8 +185,8 @@ diff a/Documentation/git.txt b/Documentation/git.txt +link:git-ssh-pull.html[git-ssh-pull]:: Pulls from a remote repository over ssh connection - Interogators: -@@ -156,8 +156,8 @@ Interogators: + Interrogators: +@@ -156,8 +156,8 @@ Interrogators: link:git-diff-helper.html[git-diff-helper]:: Generates patch format output for git-diff-* diff --git a/t/t4100/t-apply-7.patch b/t/t4100/t-apply-7.patch index 07c6589e74..fa24305108 100644 --- a/t/t4100/t-apply-7.patch +++ b/t/t4100/t-apply-7.patch @@ -335,7 +335,7 @@ diff a/ls-tree.c b/ls-tree.c - /* If this is an exact directory match, we may have - * directory files following this path. Match on them. -- * Otherwise, we're at a pach subcomponent, and we need +- * Otherwise, we're at a patch subcomponent, and we need - * to try to match again. + if (e->directory) { + /* If this is a directory, we have the following cases: diff --git a/t/t4202-log.sh b/t/t4202-log.sh index e803ba402e..2c9489484a 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -667,7 +667,7 @@ cat > expect <<\EOF * | | fifth * | | fourth |/ / -* | third +* / third |/ * second * initial @@ -1570,6 +1570,14 @@ test_expect_success GPG 'setup signed branch' ' git commit -S -m signed_commit ' +test_expect_success GPG 'setup signed branch with subkey' ' + test_when_finished "git reset --hard && git checkout master" && + git checkout -b signed-subkey master && + echo foo >foo && + git add foo && + git commit -SB7227189 -m signed_commit +' + test_expect_success GPGSM 'setup signed branch x509' ' test_when_finished "git reset --hard && git checkout master" && git checkout -b signed-x509 master && @@ -1580,6 +1588,18 @@ test_expect_success GPGSM 'setup signed branch x509' ' git commit -S -m signed_commit ' +test_expect_success GPGSM 'log x509 fingerprint' ' + echo "F8BF62E0693D0694816377099909C779FA23FD65 | " >expect && + git log -n1 --format="%GF | %GP" signed-x509 >actual && + test_cmp expect actual +' + +test_expect_success GPGSM 'log OpenPGP fingerprint' ' + echo "D4BE22311AD3131E5EDA29A461092E85B7227189" > expect && + git log -n1 --format="%GP" signed-subkey >actual && + test_cmp expect actual +' + test_expect_success GPG 'log --graph --show-signature' ' git log --graph --show-signature -n1 signed >actual && grep "^| gpg: Signature made" actual && diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh index f42a69faa2..2f251b27d0 100755 --- a/t/t4205-log-pretty-formats.sh +++ b/t/t4205-log-pretty-formats.sh @@ -640,7 +640,7 @@ test_expect_success 'pretty format %(trailers:key=foo) multiple keys' ' test_cmp expect actual ' -test_expect_success '%(trailers:key=nonexistant) becomes empty' ' +test_expect_success '%(trailers:key=nonexistent) becomes empty' ' git log --no-walk --pretty="x%(trailers:key=Nacked-by)x" >actual && echo "xx" >expect && test_cmp expect actual diff --git a/t/t4213-log-tabexpand.sh b/t/t4213-log-tabexpand.sh index 7f90f58c03..53a4af3244 100755 --- a/t/t4213-log-tabexpand.sh +++ b/t/t4213-log-tabexpand.sh @@ -36,7 +36,7 @@ count_expand () esac # Prefix the output with the command line arguments, and - # replace SP with a dot both in the expecte and actual output + # replace SP with a dot both in the expected and actual output # so that test_cmp would show the difference together with the # breakage in a way easier to consume by the debugging user. { diff --git a/t/t4214-log-graph-octopus.sh b/t/t4214-log-graph-octopus.sh index 3ae8e51e50..40d27db674 100755 --- a/t/t4214-log-graph-octopus.sh +++ b/t/t4214-log-graph-octopus.sh @@ -26,15 +26,14 @@ test_expect_success 'set up merge history' ' test_expect_success 'log --graph with tricky octopus merge, no color' ' cat >expect.uncolored <<-\EOF && * left - | *---. octopus-merge - | |\ \ \ - |/ / / / + | *-. octopus-merge + |/|\ \ | | | * 4 | | * | 3 | | |/ - | * | 2 + | * / 2 | |/ - * | 1 + * / 1 |/ * initial EOF @@ -47,15 +46,14 @@ test_expect_success 'log --graph with tricky octopus merge with colors' ' test_config log.graphColors red,green,yellow,blue,magenta,cyan && cat >expect.colors <<-\EOF && * left - <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge - <RED>|<RESET> <RED>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET> - <RED>|<RESET><RED>/<RESET> <YELLOW>/<RESET> <BLUE>/<RESET> <MAGENTA>/<RESET> + <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge + <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4 <RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3 <RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET> - <RED>|<RESET> * <MAGENTA>|<RESET> 2 + <RED>|<RESET> * <MAGENTA>/<RESET> 2 <RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET> - * <MAGENTA>|<RESET> 1 + * <MAGENTA>/<RESET> 1 <MAGENTA>|<RESET><MAGENTA>/<RESET> * initial EOF @@ -74,9 +72,9 @@ test_expect_success 'log --graph with normal octopus merge, no color' ' | | | * 4 | | * | 3 | | |/ - | * | 2 + | * / 2 | |/ - * | 1 + * / 1 |/ * initial EOF @@ -92,9 +90,9 @@ test_expect_success 'log --graph with normal octopus merge with colors' ' <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 4 <RED>|<RESET> <GREEN>|<RESET> * <BLUE>|<RESET> 3 <RED>|<RESET> <GREEN>|<RESET> <BLUE>|<RESET><BLUE>/<RESET> - <RED>|<RESET> * <BLUE>|<RESET> 2 + <RED>|<RESET> * <BLUE>/<RESET> 2 <RED>|<RESET> <BLUE>|<RESET><BLUE>/<RESET> - * <BLUE>|<RESET> 1 + * <BLUE>/<RESET> 1 <BLUE>|<RESET><BLUE>/<RESET> * initial EOF @@ -112,9 +110,9 @@ test_expect_success 'log --graph with normal octopus merge and child, no color' | | | * 4 | | * | 3 | | |/ - | * | 2 + | * / 2 | |/ - * | 1 + * / 1 |/ * initial EOF @@ -123,7 +121,7 @@ test_expect_success 'log --graph with normal octopus merge and child, no color' test_cmp expect.uncolored actual ' -test_expect_failure 'log --graph with normal octopus and child merge with colors' ' +test_expect_success 'log --graph with normal octopus and child merge with colors' ' cat >expect.colors <<-\EOF && * after-merge *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge @@ -131,9 +129,9 @@ test_expect_failure 'log --graph with normal octopus and child merge with colors <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4 <GREEN>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3 <GREEN>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET> - <GREEN>|<RESET> * <MAGENTA>|<RESET> 2 + <GREEN>|<RESET> * <MAGENTA>/<RESET> 2 <GREEN>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET> - * <MAGENTA>|<RESET> 1 + * <MAGENTA>/<RESET> 1 <MAGENTA>|<RESET><MAGENTA>/<RESET> * initial EOF @@ -147,15 +145,14 @@ test_expect_success 'log --graph with tricky octopus merge and its child, no col cat >expect.uncolored <<-\EOF && * left | * after-merge - | *---. octopus-merge - | |\ \ \ - |/ / / / + | *-. octopus-merge + |/|\ \ | | | * 4 | | * | 3 | | |/ - | * | 2 + | * / 2 | |/ - * | 1 + * / 1 |/ * initial EOF @@ -164,20 +161,19 @@ test_expect_success 'log --graph with tricky octopus merge and its child, no col test_cmp expect.uncolored actual ' -test_expect_failure 'log --graph with tricky octopus merge and its child with colors' ' +test_expect_success 'log --graph with tricky octopus merge and its child with colors' ' test_config log.graphColors red,green,yellow,blue,magenta,cyan && cat >expect.colors <<-\EOF && * left <RED>|<RESET> * after-merge - <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><CYAN>-<RESET><CYAN>.<RESET> octopus-merge - <RED>|<RESET> <RED>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <CYAN>\<RESET> - <RED>|<RESET><RED>/<RESET> <BLUE>/<RESET> <MAGENTA>/<RESET> <CYAN>/<RESET> + <RED>|<RESET> *<CYAN>-<RESET><CYAN>.<RESET> octopus-merge + <RED>|<RESET><RED>/<RESET><BLUE>|<RESET><MAGENTA>\<RESET> <CYAN>\<RESET> <RED>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4 <RED>|<RESET> <BLUE>|<RESET> * <CYAN>|<RESET> 3 <RED>|<RESET> <BLUE>|<RESET> <CYAN>|<RESET><CYAN>/<RESET> - <RED>|<RESET> * <CYAN>|<RESET> 2 + <RED>|<RESET> * <CYAN>/<RESET> 2 <RED>|<RESET> <CYAN>|<RESET><CYAN>/<RESET> - * <CYAN>|<RESET> 1 + * <CYAN>/<RESET> 1 <CYAN>|<RESET><CYAN>/<RESET> * initial EOF @@ -209,7 +205,7 @@ test_expect_success 'log --graph with crossover in octopus merge, no color' ' test_cmp expect.uncolored actual ' -test_expect_failure 'log --graph with crossover in octopus merge with colors' ' +test_expect_success 'log --graph with crossover in octopus merge with colors' ' test_config log.graphColors red,green,yellow,blue,magenta,cyan && cat >expect.colors <<-\EOF && * after-4 @@ -257,7 +253,7 @@ test_expect_success 'log --graph with crossover in octopus merge and its child, test_cmp expect.uncolored actual ' -test_expect_failure 'log --graph with crossover in octopus merge and its child with colors' ' +test_expect_success 'log --graph with crossover in octopus merge and its child with colors' ' test_config log.graphColors red,green,yellow,blue,magenta,cyan && cat >expect.colors <<-\EOF && * after-4 @@ -353,7 +349,7 @@ test_expect_success 'log --graph with unrelated commit and octopus child, no col test_cmp expect.uncolored actual ' -test_expect_failure 'log --graph with unrelated commit and octopus child with colors' ' +test_expect_success 'log --graph with unrelated commit and octopus child with colors' ' test_config log.graphColors red,green,yellow,blue,magenta,cyan && cat >expect.colors <<-\EOF && * after-initial diff --git a/t/t4215-log-skewed-merges.sh b/t/t4215-log-skewed-merges.sh new file mode 100755 index 0000000000..18709a723e --- /dev/null +++ b/t/t4215-log-skewed-merges.sh @@ -0,0 +1,243 @@ +#!/bin/sh + +test_description='git log --graph of skewed merges' + +. ./test-lib.sh + +check_graph () { + cat >expect && + git log --graph --pretty=tformat:%s "$@" >actual.raw && + sed "s/ *$//" actual.raw >actual && + test_cmp expect actual +} + +test_expect_success 'log --graph with merge fusing with its left and right neighbors' ' + git checkout --orphan _p && + test_commit A && + test_commit B && + git checkout -b _q @^ && test_commit C && + git checkout -b _r @^ && test_commit D && + git checkout _p && git merge --no-ff _q _r -m E && + git checkout _r && test_commit F && + git checkout _p && git merge --no-ff _r -m G && + git checkout @^^ && git merge --no-ff _p -m H && + + check_graph <<-\EOF + * H + |\ + | * G + | |\ + | | * F + | * | E + |/|\| + | | * D + | * | C + | |/ + * / B + |/ + * A + EOF +' + +test_expect_success 'log --graph with left-skewed merge' ' + git checkout --orphan 0_p && test_commit 0_A && + git checkout -b 0_q 0_p && test_commit 0_B && + git checkout -b 0_r 0_p && + test_commit 0_C && + test_commit 0_D && + git checkout -b 0_s 0_p && test_commit 0_E && + git checkout -b 0_t 0_p && git merge --no-ff 0_r^ 0_s -m 0_F && + git checkout 0_p && git merge --no-ff 0_s -m 0_G && + git checkout @^ && git merge --no-ff 0_q 0_r 0_t 0_p -m 0_H && + + check_graph <<-\EOF + *-----. 0_H + |\ \ \ \ + | | | | * 0_G + | |_|_|/| + |/| | | | + | | | * | 0_F + | |_|/|\| + |/| | | | + | | | | * 0_E + | |_|_|/ + |/| | | + | | * | 0_D + | | |/ + | | * 0_C + | |/ + |/| + | * 0_B + |/ + * 0_A + EOF +' + +test_expect_success 'log --graph with nested left-skewed merge' ' + git checkout --orphan 1_p && + test_commit 1_A && + test_commit 1_B && + test_commit 1_C && + git checkout -b 1_q @^ && test_commit 1_D && + git checkout 1_p && git merge --no-ff 1_q -m 1_E && + git checkout -b 1_r @~3 && test_commit 1_F && + git checkout 1_p && git merge --no-ff 1_r -m 1_G && + git checkout @^^ && git merge --no-ff 1_p -m 1_H && + + check_graph <<-\EOF + * 1_H + |\ + | * 1_G + | |\ + | | * 1_F + | * | 1_E + |/| | + | * | 1_D + * | | 1_C + |/ / + * / 1_B + |/ + * 1_A + EOF +' + +test_expect_success 'log --graph with nested left-skewed merge following normal merge' ' + git checkout --orphan 2_p && + test_commit 2_A && + test_commit 2_B && + test_commit 2_C && + git checkout -b 2_q @^^ && + test_commit 2_D && + test_commit 2_E && + git checkout -b 2_r @^ && test_commit 2_F && + git checkout 2_q && + git merge --no-ff 2_r -m 2_G && + git merge --no-ff 2_p^ -m 2_H && + git checkout -b 2_s @^^ && git merge --no-ff 2_q -m 2_J && + git checkout 2_p && git merge --no-ff 2_s -m 2_K && + + check_graph <<-\EOF + * 2_K + |\ + | * 2_J + | |\ + | | * 2_H + | | |\ + | | * | 2_G + | |/| | + | | * | 2_F + | * | | 2_E + | |/ / + | * | 2_D + * | | 2_C + | |/ + |/| + * | 2_B + |/ + * 2_A + EOF +' + +test_expect_success 'log --graph with nested right-skewed merge following left-skewed merge' ' + git checkout --orphan 3_p && + test_commit 3_A && + git checkout -b 3_q && + test_commit 3_B && + test_commit 3_C && + git checkout -b 3_r @^ && + test_commit 3_D && + git checkout 3_q && git merge --no-ff 3_r -m 3_E && + git checkout 3_p && git merge --no-ff 3_q -m 3_F && + git checkout 3_r && test_commit 3_G && + git checkout 3_p && git merge --no-ff 3_r -m 3_H && + git checkout @^^ && git merge --no-ff 3_p -m 3_J && + + check_graph <<-\EOF + * 3_J + |\ + | * 3_H + | |\ + | | * 3_G + | * | 3_F + |/| | + | * | 3_E + | |\| + | | * 3_D + | * | 3_C + | |/ + | * 3_B + |/ + * 3_A + EOF +' + +test_expect_success 'log --graph with right-skewed merge following a left-skewed one' ' + git checkout --orphan 4_p && + test_commit 4_A && + test_commit 4_B && + test_commit 4_C && + git checkout -b 4_q @^^ && test_commit 4_D && + git checkout -b 4_r 4_p^ && git merge --no-ff 4_q -m 4_E && + git checkout -b 4_s 4_p^^ && + git merge --no-ff 4_r -m 4_F && + git merge --no-ff 4_p -m 4_G && + git checkout @^^ && git merge --no-ff 4_s -m 4_H && + + check_graph --date-order <<-\EOF + * 4_H + |\ + | * 4_G + | |\ + | * | 4_F + |/| | + | * | 4_E + | |\ \ + | | * | 4_D + | |/ / + |/| | + | | * 4_C + | |/ + | * 4_B + |/ + * 4_A + EOF +' + +test_expect_success 'log --graph with octopus merge with column joining its penultimate parent' ' + git checkout --orphan 5_p && + test_commit 5_A && + git branch 5_q && + git branch 5_r && + test_commit 5_B && + git checkout 5_q && test_commit 5_C && + git checkout 5_r && test_commit 5_D && + git checkout 5_p && + git merge --no-ff 5_q 5_r -m 5_E && + git checkout 5_q && test_commit 5_F && + git checkout -b 5_s 5_p^ && + git merge --no-ff 5_p 5_q -m 5_G && + git checkout 5_r && + git merge --no-ff 5_s -m 5_H && + + check_graph <<-\EOF + * 5_H + |\ + | *-. 5_G + | |\ \ + | | | * 5_F + | | * | 5_E + | |/|\ \ + | |_|/ / + |/| | / + | | |/ + * | | 5_D + | | * 5_C + | |/ + |/| + | * 5_B + |/ + * 5_A + EOF +' + +test_done diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh index d42b3efe39..5a3e4e331a 100755 --- a/t/t5318-commit-graph.sh +++ b/t/t5318-commit-graph.sh @@ -85,7 +85,7 @@ graph_read_expect() { num_commits: $1 chunks: oid_fanout oid_lookup commit_metadata$OPTIONAL EOF - git commit-graph read >output && + test-tool read-graph >output && test_cmp expect output } @@ -660,7 +660,7 @@ test_expect_success 'corrupt commit-graph write (missing tree)' ' git commit-tree -p "$broken" -m "good" "$tree" >good && test_must_fail git commit-graph write --stdin-commits \ <good 2>test_err && - test_i18ngrep "unable to get tree for" test_err + test_i18ngrep "unable to parse commit" test_err ) ' diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh index 115aabd141..c24823431f 100755 --- a/t/t5324-split-commit-graph.sh +++ b/t/t5324-split-commit-graph.sh @@ -25,7 +25,7 @@ graph_read_expect() { num_commits: $1 chunks: oid_fanout oid_lookup commit_metadata EOF - git commit-graph read >output && + test-tool read-graph >output && test_cmp expect output } diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh index 44309566f1..4d1e0c363e 100755 --- a/t/t5528-push-default.sh +++ b/t/t5528-push-default.sh @@ -163,7 +163,7 @@ test_pushdefault_workflow success current master # update parent1's foo (which is our upstream) test_pushdefault_workflow success upstream foo -# upsream is foo which is not the name of the current branch +# upstream is foo which is not the name of the current branch test_pushdefault_workflow failure simple master # master and foo are updated diff --git a/t/t5535-fetch-push-symref.sh b/t/t5535-fetch-push-symref.sh index 8ed58d27f2..e8f6d233ff 100755 --- a/t/t5535-fetch-push-symref.sh +++ b/t/t5535-fetch-push-symref.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='avoiding conflicting update thru symref aliasing' +test_description='avoiding conflicting update through symref aliasing' . ./test-lib.sh diff --git a/t/t5545-push-options.sh b/t/t5545-push-options.sh index 04b34c4de1..38e6f7340e 100755 --- a/t/t5545-push-options.sh +++ b/t/t5545-push-options.sh @@ -115,7 +115,7 @@ test_expect_success 'push options and submodules' ' git -C parent submodule add ../upstream workbench && git -C parent/workbench remote add up ../../upstream && - git -C parent commit -m "add submoule" && + git -C parent commit -m "add submodule" && test_commit -C parent/workbench two && git -C parent add workbench && diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh index eaa33a852b..fea56cda6d 100755 --- a/t/t5616-partial-clone.sh +++ b/t/t5616-partial-clone.sh @@ -304,6 +304,76 @@ test_expect_success 'partial clone with unresolvable sparse filter fails cleanly test_i18ngrep "unable to parse sparse filter data in" err ' +setup_triangle () { + rm -rf big-blob.txt server client promisor-remote && + + printf "line %d\n" $(test_seq 1 100) >big-blob.txt && + + # Create a server with 2 commits: a commit with a big blob and a child + # commit with an incremental change. Also, create a partial clone + # client that only contains the first commit. + git init server && + git -C server config --local uploadpack.allowfilter 1 && + cp big-blob.txt server && + git -C server add big-blob.txt && + git -C server commit -m "initial" && + git clone --bare --filter=tree:0 "file://$(pwd)/server" client && + echo another line >>server/big-blob.txt && + git -C server commit -am "append line to big blob" && + + # Create a promisor remote that only contains the blob from the first + # commit, and set it as the promisor remote of client. Thus, whenever + # the client lazy fetches, the lazy fetch will succeed only if it is + # for this blob. + git init promisor-remote && + test_commit -C promisor-remote one && # so that ref advertisement is not empty + git -C promisor-remote config --local uploadpack.allowanysha1inwant 1 && + git -C promisor-remote hash-object -w --stdin <big-blob.txt && + git -C client remote set-url origin "file://$(pwd)/promisor-remote" +} + +# NEEDSWORK: The tests beginning with "fetch lazy-fetches" below only +# test that "fetch" avoid fetching trees and blobs, but not commits or +# tags. Revisit this if Git is ever taught to support partial clones +# with commits and/or tags filtered out. + +test_expect_success 'fetch lazy-fetches only to resolve deltas' ' + setup_triangle && + + # Exercise to make sure it works. Git will not fetch anything from the + # promisor remote other than for the big blob (because it needs to + # resolve the delta). + GIT_TRACE_PACKET="$(pwd)/trace" git -C client \ + fetch "file://$(pwd)/server" master && + + # Verify the assumption that the client needed to fetch the delta base + # to resolve the delta. + git hash-object big-blob.txt >hash && + grep "want $(cat hash)" trace +' + +test_expect_success 'fetch lazy-fetches only to resolve deltas, protocol v2' ' + setup_triangle && + + git -C server config --local protocol.version 2 && + git -C client config --local protocol.version 2 && + git -C promisor-remote config --local protocol.version 2 && + + # Exercise to make sure it works. Git will not fetch anything from the + # promisor remote other than for the big blob (because it needs to + # resolve the delta). + GIT_TRACE_PACKET="$(pwd)/trace" git -C client \ + fetch "file://$(pwd)/server" master && + + # Verify that protocol version 2 was used. + grep "fetch< version 2" trace && + + # Verify the assumption that the client needed to fetch the delta base + # to resolve the delta. + git hash-object big-blob.txt >hash && + grep "want $(cat hash)" trace +' + . "$TEST_DIRECTORY"/lib-httpd.sh start_httpd diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh index ae9175cedf..e73067d23f 100755 --- a/t/t5702-protocol-v2.sh +++ b/t/t5702-protocol-v2.sh @@ -32,7 +32,7 @@ test_expect_success 'list refs with git:// using protocol v2' ' test_cmp expect actual ' -test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' ' +test_expect_success 'ref advertisement is filtered with ls-remote using protocol v2' ' test_when_finished "rm -f log" && GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \ @@ -154,7 +154,7 @@ test_expect_success 'list refs with file:// using protocol v2' ' test_cmp expect actual ' -test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' ' +test_expect_success 'ref advertisement is filtered with ls-remote using protocol v2' ' test_when_finished "rm -f log" && GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \ @@ -225,7 +225,7 @@ test_expect_success 'fetch with file:// using protocol v2' ' grep "fetch< version 2" log ' -test_expect_success 'ref advertisment is filtered during fetch using protocol v2' ' +test_expect_success 'ref advertisement is filtered during fetch using protocol v2' ' test_when_finished "rm -f log" && test_commit -C file_parent three && @@ -682,9 +682,9 @@ test_expect_success 'push with http:// and a config of v2 does not request v2' ' git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" log -1 --format=%s client_branch >expect && test_cmp expect actual && - # Client didnt request to use protocol v2 + # Client did not request to use protocol v2 ! grep "Git-Protocol: version=2" log && - # Server didnt respond using protocol v2 + # Server did not respond using protocol v2 ! grep "git< version 2" log ' diff --git a/t/t6016-rev-list-graph-simplify-history.sh b/t/t6016-rev-list-graph-simplify-history.sh index f7181d1d6a..f5e6e92f5b 100755 --- a/t/t6016-rev-list-graph-simplify-history.sh +++ b/t/t6016-rev-list-graph-simplify-history.sh @@ -67,11 +67,10 @@ test_expect_success '--graph --all' ' echo "| * $C4" >> expected && echo "| * $C3" >> expected && echo "* | $A5" >> expected && - echo "| | " >> expected && - echo "| \\ " >> expected && - echo "*-. \\ $A4" >> expected && - echo "|\\ \\ \\ " >> expected && - echo "| | |/ " >> expected && + echo "| | " >> expected && + echo "| \\ " >> expected && + echo "*-. | $A4" >> expected && + echo "|\\ \\| " >> expected && echo "| | * $C2" >> expected && echo "| | * $C1" >> expected && echo "| * | $B2" >> expected && @@ -97,11 +96,10 @@ test_expect_success '--graph --simplify-by-decoration' ' echo "| * $C4" >> expected && echo "| * $C3" >> expected && echo "* | $A5" >> expected && - echo "| | " >> expected && - echo "| \\ " >> expected && - echo "*-. \\ $A4" >> expected && - echo "|\\ \\ \\ " >> expected && - echo "| | |/ " >> expected && + echo "| | " >> expected && + echo "| \\ " >> expected && + echo "*-. | $A4" >> expected && + echo "|\\ \\| " >> expected && echo "| | * $C2" >> expected && echo "| | * $C1" >> expected && echo "| * | $B2" >> expected && @@ -131,9 +129,8 @@ test_expect_success '--graph --simplify-by-decoration prune branch B' ' echo "| * $C4" >> expected && echo "| * $C3" >> expected && echo "* | $A5" >> expected && - echo "* | $A4" >> expected && - echo "|\\ \\ " >> expected && - echo "| |/ " >> expected && + echo "* | $A4" >> expected && + echo "|\\| " >> expected && echo "| * $C2" >> expected && echo "| * $C1" >> expected && echo "* | $A3" >> expected && @@ -151,9 +148,8 @@ test_expect_success '--graph --full-history -- bar.txt' ' echo "|\\ " >> expected && echo "| * $C4" >> expected && echo "* | $A5" >> expected && - echo "* | $A4" >> expected && - echo "|\\ \\ " >> expected && - echo "| |/ " >> expected && + echo "* | $A4" >> expected && + echo "|\\| " >> expected && echo "* | $A3" >> expected && echo "|/ " >> expected && echo "* $A2" >> expected && @@ -255,7 +251,7 @@ test_expect_success '--graph --boundary ^C3' ' echo "* | | | $A3" >> expected && echo "o | | | $A2" >> expected && echo "|/ / / " >> expected && - echo "o | | $A1" >> expected && + echo "o / / $A1" >> expected && echo " / / " >> expected && echo "| o $C3" >> expected && echo "|/ " >> expected && diff --git a/t/t6024-recursive-merge.sh b/t/t6024-recursive-merge.sh index 27c7de90ce..0c9e3c20e8 100755 --- a/t/t6024-recursive-merge.sh +++ b/t/t6024-recursive-merge.sh @@ -14,85 +14,90 @@ test_description='Test merge without common ancestors' GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100" export GIT_COMMITTER_DATE -test_expect_success "setup tests" ' -echo 1 > a1 && -git add a1 && -GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1 && - -git checkout -b A master && -echo A > a1 && -GIT_AUTHOR_DATE="2006-12-12 23:00:01" git commit -m A a1 && - -git checkout -b B master && -echo B > a1 && -GIT_AUTHOR_DATE="2006-12-12 23:00:02" git commit -m B a1 && - -git checkout -b D A && -git rev-parse B > .git/MERGE_HEAD && -echo D > a1 && -git update-index a1 && -GIT_AUTHOR_DATE="2006-12-12 23:00:03" git commit -m D && - -git symbolic-ref HEAD refs/heads/other && -echo 2 > a1 && -GIT_AUTHOR_DATE="2006-12-12 23:00:04" git commit -m 2 a1 && - -git checkout -b C && -echo C > a1 && -GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1 && - -git checkout -b E C && -git rev-parse B > .git/MERGE_HEAD && -echo E > a1 && -git update-index a1 && -GIT_AUTHOR_DATE="2006-12-12 23:00:06" git commit -m E && - -git checkout -b G E && -git rev-parse A > .git/MERGE_HEAD && -echo G > a1 && -git update-index a1 && -GIT_AUTHOR_DATE="2006-12-12 23:00:07" git commit -m G && - -git checkout -b F D && -git rev-parse C > .git/MERGE_HEAD && -echo F > a1 && -git update-index a1 && -GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F +test_expect_success 'setup tests' ' + echo 1 >a1 && + git add a1 && + GIT_AUTHOR_DATE="2006-12-12 23:00:00" git commit -m 1 a1 && + + git checkout -b A master && + echo A >a1 && + GIT_AUTHOR_DATE="2006-12-12 23:00:01" git commit -m A a1 && + + git checkout -b B master && + echo B >a1 && + GIT_AUTHOR_DATE="2006-12-12 23:00:02" git commit -m B a1 && + + git checkout -b D A && + git rev-parse B >.git/MERGE_HEAD && + echo D >a1 && + git update-index a1 && + GIT_AUTHOR_DATE="2006-12-12 23:00:03" git commit -m D && + + git symbolic-ref HEAD refs/heads/other && + echo 2 >a1 && + GIT_AUTHOR_DATE="2006-12-12 23:00:04" git commit -m 2 a1 && + + git checkout -b C && + echo C >a1 && + GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1 && + + git checkout -b E C && + git rev-parse B >.git/MERGE_HEAD && + echo E >a1 && + git update-index a1 && + GIT_AUTHOR_DATE="2006-12-12 23:00:06" git commit -m E && + + git checkout -b G E && + git rev-parse A >.git/MERGE_HEAD && + echo G >a1 && + git update-index a1 && + GIT_AUTHOR_DATE="2006-12-12 23:00:07" git commit -m G && + + git checkout -b F D && + git rev-parse C >.git/MERGE_HEAD && + echo F >a1 && + git update-index a1 && + GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F ' test_expect_success 'combined merge conflicts' ' test_must_fail env GIT_TEST_COMMIT_GRAPH=0 git merge -m final G ' -cat > expect << EOF -<<<<<<< HEAD -F -======= -G ->>>>>>> G -EOF +test_expect_success 'result contains a conflict' ' + cat >expect <<-\EOF && + <<<<<<< HEAD + F + ======= + G + >>>>>>> G + EOF -test_expect_success "result contains a conflict" "test_cmp expect a1" + test_cmp expect a1 +' + +test_expect_success 'virtual trees were processed' ' + git ls-files --stage >out && -git ls-files --stage > out -cat > expect << EOF -100644 ec3fe2a791706733f2d8fa7ad45d9a9672031f5e 1 a1 -100644 cf84443e49e1b366fac938711ddf4be2d4d1d9e9 2 a1 -100644 fd7923529855d0b274795ae3349c5e0438333979 3 a1 -EOF + cat >expect <<-\EOF && + 100644 ec3fe2a791706733f2d8fa7ad45d9a9672031f5e 1 a1 + 100644 cf84443e49e1b366fac938711ddf4be2d4d1d9e9 2 a1 + 100644 fd7923529855d0b274795ae3349c5e0438333979 3 a1 + EOF -test_expect_success "virtual trees were processed" "test_cmp expect out" + test_cmp expect out +' test_expect_success 'refuse to merge binary files' ' git reset --hard && - printf "\0" > binary-file && + printf "\0" >binary-file && git add binary-file && git commit -m binary && git checkout G && - printf "\0\0" > binary-file && + printf "\0\0" >binary-file && git add binary-file && git commit -m binary2 && - test_must_fail git merge F > merge.out 2> merge.err && + test_must_fail git merge F >merge.out 2>merge.err && grep "Cannot merge binary files: binary-file (HEAD vs. F)" merge.err ' @@ -116,7 +121,6 @@ test_expect_success 'mark rename/delete as unmerged' ' test 1 = $(git ls-files --unmerged | wc -l) && test_must_fail git rev-parse --verify :2:a2 && git rev-parse --verify :3:a2 - ' test_done diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh index 7fddcc8c73..7d73afdcda 100755 --- a/t/t6036-recursive-corner-cases.sh +++ b/t/t6036-recursive-corner-cases.sh @@ -1532,7 +1532,7 @@ test_expect_success 'setup nested conflicts' ' mv -f b_R1 b && mv -f a_R1 a && git add b a && - test_tick && git commit -m "verson R1 of files" && + test_tick && git commit -m "version R1 of files" && git tag R1 && # Create first merge on left side @@ -1696,7 +1696,7 @@ test_expect_success 'setup virtual merge base with nested conflicts' ' git checkout R && echo right >>content && git add content && - test_tick && git commit -m "verson R1 of content" && + test_tick && git commit -m "version R1 of content" && git tag R1 && # Create L2 diff --git a/t/t6043-merge-rename-directories.sh b/t/t6043-merge-rename-directories.sh index bd2f97ba95..83792c5ef1 100755 --- a/t/t6043-merge-rename-directories.sh +++ b/t/t6043-merge-rename-directories.sh @@ -754,7 +754,7 @@ test_expect_success '3b: Avoid implicit rename if involved as source on current # # What if we were to attempt to do directory rename detection when someone # "mostly" moved a directory but still left some files around, or, -# equivalently, fully renamed a directory in one commmit and then recreated +# equivalently, fully renamed a directory in one commit and then recreated # that directory in a later commit adding some new files and then tried to # merge? # @@ -953,7 +953,7 @@ test_expect_success '5a: Merge directories, other side adds files to original an # Commit B: z/{b,c,d_1,e}, y/d_3 # Expected: y/{b,c,e}, CONFLICT(add/add: y/d_2 vs. y/d_3) # NOTE: If z/d_1 in commit B were to be involved in dir rename detection, as -# we normaly would since z/ is being renamed to y/, then this would be +# we normally would since z/ is being renamed to y/, then this would be # a rename/delete (z/d_1 -> y/d_1 vs. deleted) AND an add/add/add # conflict of y/d_1 vs. y/d_2 vs. y/d_3. Add/add/add is not # representable in the index, so the existence of y/d_3 needs to @@ -2116,7 +2116,7 @@ test_expect_success '8b: Dual-directory rename, one into the others way, with co # # Note: It could easily be argued that the correct resolution here is # y/{b,c,e}, CONFLICT(rename/delete: z/d -> y/d vs deleted) -# and that the modifed version of d should be present in y/ after +# and that the modified version of d should be present in y/ after # the merge, just marked as conflicted. Indeed, I previously did # argue that. But applying directory renames to the side of # history where a file is merely modified results in spurious diff --git a/t/t6102-rev-list-unexpected-objects.sh b/t/t6102-rev-list-unexpected-objects.sh index 28611c978e..52cde097dd 100755 --- a/t/t6102-rev-list-unexpected-objects.sh +++ b/t/t6102-rev-list-unexpected-objects.sh @@ -52,7 +52,7 @@ test_expect_success 'traverse unexpected non-commit parent (lone)' ' ' test_expect_success 'traverse unexpected non-commit parent (seen)' ' - test_must_fail git rev-list --objects $commit $broken_commit \ + test_must_fail git rev-list --objects $blob $broken_commit \ >output 2>&1 && test_i18ngrep "not a commit" output ' diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 80eb13d94e..4a09bea1d6 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -227,10 +227,10 @@ test_expect_success \ test_expect_success \ 'trying to delete two tags, existing and not, should fail in the 2nd' ' tag_exists mytag && - ! tag_exists myhead && - test_must_fail git tag -d mytag anothertag && + ! tag_exists nonexistingtag && + test_must_fail git tag -d mytag nonexistingtag && ! tag_exists mytag && - ! tag_exists myhead + ! tag_exists nonexistingtag ' test_expect_success 'trying to delete an already deleted tag should fail' \ @@ -1420,7 +1420,7 @@ test_expect_success \ get_tag_header reuse $commit commit $time >expect echo "An annotation to be reused" >> expect test_expect_success \ - 'overwriting an annoted tag should use its previous body' ' + 'overwriting an annotated tag should use its previous body' ' git tag -a -m "An annotation to be reused" reuse && GIT_EDITOR=true git tag -f -a reuse && get_tag_msg reuse >actual && diff --git a/t/t7030-verify-tag.sh b/t/t7030-verify-tag.sh index 041e319e79..8f077bea60 100755 --- a/t/t7030-verify-tag.sh +++ b/t/t7030-verify-tag.sh @@ -44,8 +44,8 @@ test_expect_success GPG 'create signed tags' ' test_expect_success GPGSM 'create signed tags x509 ' ' test_config gpg.format x509 && test_config user.signingkey $GIT_COMMITTER_EMAIL && - echo 9 >file && test_tick && git commit -a -m "nineth gpgsm-signed" && - git tag -s -m nineth nineth-signed-x509 + echo 9 >file && test_tick && git commit -a -m "ninth gpgsm-signed" && + git tag -s -m ninth ninth-signed-x509 ' test_expect_success GPG 'verify and show signatures' ' @@ -80,10 +80,10 @@ test_expect_success GPG 'verify and show signatures' ' ' test_expect_success GPGSM 'verify and show signatures x509' ' - git verify-tag nineth-signed-x509 2>actual && + git verify-tag ninth-signed-x509 2>actual && grep "Good signature from" actual && ! grep "BAD signature from" actual && - echo nineth-signed-x509 OK + echo ninth-signed-x509 OK ' test_expect_success GPG 'detect fudged signature' ' @@ -127,10 +127,10 @@ test_expect_success GPG 'verify signatures with --raw' ' ' test_expect_success GPGSM 'verify signatures with --raw x509' ' - git verify-tag --raw nineth-signed-x509 2>actual && + git verify-tag --raw ninth-signed-x509 2>actual && grep "GOODSIG" actual && ! grep "BADSIG" actual && - echo nineth-signed-x509 OK + echo ninth-signed-x509 OK ' test_expect_success GPG 'verify multiple tags' ' @@ -147,7 +147,7 @@ test_expect_success GPG 'verify multiple tags' ' ' test_expect_success GPGSM 'verify multiple tags x509' ' - tags="seventh-signed nineth-signed-x509" && + tags="seventh-signed ninth-signed-x509" && for i in $tags do git verify-tag -v --raw $i || return 1 diff --git a/t/t7508-status.sh b/t/t7508-status.sh index 4e676cdce8..482ce3510e 100755 --- a/t/t7508-status.sh +++ b/t/t7508-status.sh @@ -1571,7 +1571,7 @@ test_expect_success '"status.showStash=true" weaker than "--no-show-stash"' ' test_cmp expected_without_stash actual ' -test_expect_success 'no additionnal info if no stash entries' ' +test_expect_success 'no additional info if no stash entries' ' git stash clear && git -c status.showStash=true status >actual && test_cmp expected_without_stash actual diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh index f19202b509..6602790b5f 100755 --- a/t/t7513-interpret-trailers.sh +++ b/t/t7513-interpret-trailers.sh @@ -1234,7 +1234,7 @@ test_expect_success 'with simple command' ' test_cmp expected actual ' -test_expect_success 'with command using commiter information' ' +test_expect_success 'with command using committer information' ' git config trailer.sign.ifExists "addIfDifferent" && git config trailer.sign.command "echo \"\$GIT_COMMITTER_NAME <\$GIT_COMMITTER_EMAIL>\"" && cat complex_message_body >expected && diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh index 997d5fb349..1e47ed2ca2 100755 --- a/t/t7519-status-fsmonitor.sh +++ b/t/t7519-status-fsmonitor.sh @@ -294,7 +294,7 @@ do done done -# test that splitting the index dosn't interfere +# test that splitting the index doesn't interfere test_expect_success 'splitting the index results in the same state' ' write_integration_script && dirty_repo && diff --git a/t/t7519/fsmonitor-watchman b/t/t7519/fsmonitor-watchman index 5514edcf68..d8e7a1e5ba 100755 --- a/t/t7519/fsmonitor-watchman +++ b/t/t7519/fsmonitor-watchman @@ -23,7 +23,8 @@ my ($version, $time) = @ARGV; if ($version == 1) { # convert nanoseconds to seconds - $time = int $time / 1000000000; + # subtract one second to make sure watchman will return all changes + $time = int ($time / 1000000000) - 1; } else { die "Unsupported query-fsmonitor hook version '$version'.\n" . "Falling back to scanning...\n"; @@ -54,18 +55,12 @@ sub launch_watchman { # # To accomplish this, we're using the "since" generator to use the # recency index to select candidate nodes and "fields" to limit the - # output to file names only. Then we're using the "expression" term to - # further constrain the results. - # - # The category of transient files that we want to ignore will have a - # creation clock (cclock) newer than $time_t value and will also not - # currently exist. + # output to file names only. my $query = <<" END"; ["query", "$git_work_tree", { "since": $time, - "fields": ["name"], - "expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]] + "fields": ["name"] }] END diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 997f90b42b..bd94779611 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1260,7 +1260,7 @@ test_expect_success $PREREQ 'sendemail.identity: --no-identity clears previous i grep "To: default@example.com" stdout ' -test_expect_success $PREREQ 'sendemail.identity: bool identity variable existance overrides' ' +test_expect_success $PREREQ 'sendemail.identity: bool identity variable existence overrides' ' git -c sendemail.identity=cloud \ -c sendemail.xmailer=true \ -c sendemail.cloud.xmailer=false \ diff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh index dadc70b7d5..ca223dca98 100755 --- a/t/t9301-fast-import-notes.sh +++ b/t/t9301-fast-import-notes.sh @@ -275,7 +275,7 @@ $whitespace third note for first commit EXPECT_END -test_expect_success 'add concatentation notes with M command' ' +test_expect_success 'add concatenation notes with M command' ' git fast-import <input && GIT_NOTES_REF=refs/notes/test git log | grep "^ " > actual && diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh index 2e4e214815..db084fe625 100755 --- a/t/t9350-fast-export.sh +++ b/t/t9350-fast-export.sh @@ -541,7 +541,7 @@ test_expect_success 'tree_tag' ' # NEEDSWORK: not just check return status, but validate the output # Note that these tests DO NOTHING other than print a warning that -# they are ommitting the one tag we asked them to export (because the +# they are omitting the one tag we asked them to export (because the # tags resolve to a tree). They exist just to make sure we do not # abort but instead just warn. test_expect_success 'tree_tag-obj' 'git fast-export tree_tag-obj' diff --git a/t/t9502-gitweb-standalone-parse-output.sh b/t/t9502-gitweb-standalone-parse-output.sh index 0796a438bc..e38cbc97d3 100755 --- a/t/t9502-gitweb-standalone-parse-output.sh +++ b/t/t9502-gitweb-standalone-parse-output.sh @@ -188,8 +188,8 @@ test_expect_success 'forks: project_index lists all projects (incl. forks)' ' ' xss() { - echo >&2 "Checking $1..." && - gitweb_run "$1" && + echo >&2 "Checking $*..." && + gitweb_run "$@" && if grep "$TAG" gitweb.body; then echo >&2 "xss: $TAG should have been quoted in output" return 1 @@ -200,7 +200,8 @@ xss() { test_expect_success 'xss checks' ' TAG="<magic-xss-tag>" && xss "a=rss&p=$TAG" && - xss "a=rss&p=foo.git&f=$TAG" + xss "a=rss&p=foo.git&f=$TAG" && + xss "" "$TAG+" ' test_done diff --git a/t/t9809-git-p4-client-view.sh b/t/t9809-git-p4-client-view.sh index 3cff1fce1b..9c9710d8c7 100755 --- a/t/t9809-git-p4-client-view.sh +++ b/t/t9809-git-p4-client-view.sh @@ -407,7 +407,7 @@ test_expect_success 'reinit depot' ' ' # -# What happens when two files of the same name are overlayed together? +# What happens when two files of the same name are overlaid together? # The last-listed file should take preference. # # //depot diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index e90ac565e1..ec3eccfd3d 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -378,7 +378,7 @@ test_expect_success '__gitdir - finds repo' ' ' -test_expect_success '__gitdir - returns error when cant find repo' ' +test_expect_success '__gitdir - returns error when cannot find repo' ' ( __git_dir="non-existing" && test_must_fail __gitdir >"$actual" @@ -945,7 +945,7 @@ test_expect_success 'setup for filtering matching refs' ' rm -f .git/FETCH_HEAD ' -test_expect_success '__git_refs - dont filter refs unless told so' ' +test_expect_success '__git_refs - do not filter refs unless told so' ' cat >expected <<-EOF && HEAD master @@ -1257,7 +1257,7 @@ test_path_completion () # In the following tests calling this function we only # care about how __git_complete_index_file() deals with # unusual characters in path names. By requesting only - # untracked files we dont have to bother adding any + # untracked files we do not have to bother adding any # paths to the index in those tests. __git_complete_index_file --others && print_comp diff --git a/t/test-lib.sh b/t/test-lib.sh index 46c4440843..e8ae150d75 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1004,6 +1004,12 @@ test_skip () { to_skip=t skipped_reason="GIT_SKIP_TESTS" fi + if test -z "$to_skip" && test -n "$run_list" && + ! match_test_selector_list '--run' $test_count "$run_list" + then + to_skip=t + skipped_reason="--run" + fi if test -z "$to_skip" && test -n "$test_prereq" && ! test_have_prereq "$test_prereq" then @@ -1016,12 +1022,6 @@ test_skip () { fi skipped_reason="missing $missing_prereq${of_prereq}" fi - if test -z "$to_skip" && test -n "$run_list" && - ! match_test_selector_list '--run' $test_count "$run_list" - then - to_skip=t - skipped_reason="--run" - fi case "$to_skip" in t) |