summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/helper/.gitignore1
-rw-r--r--t/helper/test-strcmp-offset.c22
-rwxr-xr-xt/perf/aggregate.perl3
-rwxr-xr-xt/perf/p0000-perf-lib-sanity.sh2
-rwxr-xr-xt/perf/p0005-status.sh49
-rwxr-xr-xt/perf/p0006-read-tree-checkout.sh67
-rw-r--r--t/perf/repos/.gitignore1
-rwxr-xr-xt/perf/repos/inflate-repo.sh85
-rwxr-xr-xt/perf/repos/many-files.sh110
-rwxr-xr-xt/t0025-crlf-auto.sh26
-rwxr-xr-xt/t0065-strcmp-offset.sh21
-rwxr-xr-xt/t1305-config-include.sh65
-rwxr-xr-xt/t1309-early-config.sh18
-rwxr-xr-xt/t1400-update-ref.sh335
-rwxr-xr-xt/t1450-fsck.sh13
-rwxr-xr-xt/t2025-worktree-add.sh6
-rwxr-xr-xt/t2027-worktree-list.sh35
-rwxr-xr-xt/t3007-ls-files-recurse-submodules.sh12
-rwxr-xr-xt/t3428-rebase-signoff.sh46
-rwxr-xr-xt/t3429-rebase-edit-todo.sh14
-rwxr-xr-xt/t3701-add-interactive.sh22
-rwxr-xr-xt/t5533-push-cas.sh29
-rwxr-xr-xt/t5547-push-quarantine.sh11
-rwxr-xr-xt/t7400-submodule-basic.sh22
-rwxr-xr-xt/t9902-completion.sh34
25 files changed, 867 insertions, 182 deletions
diff --git a/t/helper/.gitignore b/t/helper/.gitignore
index acd5db1..7216502 100644
--- a/t/helper/.gitignore
+++ b/t/helper/.gitignore
@@ -28,6 +28,7 @@
/test-sha1
/test-sha1-array
/test-sigchain
+/test-strcmp-offset
/test-string-list
/test-submodule-config
/test-subprocess
diff --git a/t/helper/test-strcmp-offset.c b/t/helper/test-strcmp-offset.c
new file mode 100644
index 0000000..4a45a54
--- /dev/null
+++ b/t/helper/test-strcmp-offset.c
@@ -0,0 +1,22 @@
+#include "cache.h"
+
+int cmd_main(int argc, const char **argv)
+{
+ int result;
+ size_t offset;
+
+ if (!argv[1] || !argv[2])
+ die("usage: %s <string1> <string2>", argv[0]);
+
+ result = strcmp_offset(argv[1], argv[2], &offset);
+
+ /*
+ * Because differnt CRTs behave differently, only rely on signs
+ * of the result values.
+ */
+ result = (result < 0 ? -1 :
+ result > 0 ? 1 :
+ 0);
+ printf("%d %"PRIuMAX"\n", result, (uintmax_t)offset);
+ return 0;
+}
diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl
index 924b19d..1dbc85b 100755
--- a/t/perf/aggregate.perl
+++ b/t/perf/aggregate.perl
@@ -88,6 +88,7 @@ for my $t (@tests) {
sub read_descr {
my $name = shift;
open my $fh, "<", $name or return "<error reading description>";
+ binmode $fh, ":utf8" or die "PANIC on binmode: $!";
my $line = <$fh>;
close $fh or die "cannot close $name";
chomp $line;
@@ -147,6 +148,8 @@ for my $t (@subtests) {
my $totalwidth = 3*@dirs+$descrlen;
$totalwidth += $_ for (@colwidth);
+binmode STDOUT, ":utf8" or die "PANIC on binmode: $!";
+
printf "%-${descrlen}s", "Test";
for my $i (0..$#dirs) {
my $d = $dirs[$i];
diff --git a/t/perf/p0000-perf-lib-sanity.sh b/t/perf/p0000-perf-lib-sanity.sh
index cf8e1ef..002c21e 100755
--- a/t/perf/p0000-perf-lib-sanity.sh
+++ b/t/perf/p0000-perf-lib-sanity.sh
@@ -33,6 +33,8 @@ test_perf 'export a weird var' '
test_export bar
'
+test_perf 'éḿíẗ ńöń-ÁŚĆÍÍ ćḧáŕáćẗéŕś' 'true'
+
test_expect_success 'test_export works with weird vars' '
echo "$bar" &&
test "$bar" = "weird # variable"
diff --git a/t/perf/p0005-status.sh b/t/perf/p0005-status.sh
new file mode 100755
index 0000000..0b0aa98
--- /dev/null
+++ b/t/perf/p0005-status.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# This test measures the performance of various read-tree
+# and status operations. It is primarily interested in
+# the algorithmic costs of index operations and recursive
+# tree traversal -- and NOT disk I/O on thousands of files.
+
+test_description="Tests performance of read-tree"
+
+. ./perf-lib.sh
+
+test_perf_default_repo
+
+# If the test repo was generated by ./repos/many-files.sh
+# then we know something about the data shape and branches,
+# so we can isolate testing to the ballast-related commits
+# and setup sparse-checkout so we don't have to populate
+# the ballast files and directories.
+#
+# Otherwise, we make some general assumptions about the
+# repo and consider the entire history of the current
+# branch to be the ballast.
+
+test_expect_success "setup repo" '
+ if git rev-parse --verify refs/heads/p0006-ballast^{commit}
+ then
+ echo Assuming synthetic repo from many-files.sh
+ git branch br_base master
+ git branch br_ballast p0006-ballast
+ git config --local core.sparsecheckout 1
+ cat >.git/info/sparse-checkout <<-EOF
+ /*
+ !ballast/*
+ EOF
+ else
+ echo Assuming non-synthetic repo...
+ git branch br_base $(git rev-list HEAD | tail -n 1)
+ git branch br_ballast HEAD
+ fi &&
+ git checkout -q br_ballast &&
+ nr_files=$(git ls-files | wc -l)
+'
+
+test_perf "read-tree status br_ballast ($nr_files)" '
+ git read-tree HEAD &&
+ git status
+'
+
+test_done
diff --git a/t/perf/p0006-read-tree-checkout.sh b/t/perf/p0006-read-tree-checkout.sh
new file mode 100755
index 0000000..78cc23f
--- /dev/null
+++ b/t/perf/p0006-read-tree-checkout.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# This test measures the performance of various read-tree
+# and checkout operations. It is primarily interested in
+# the algorithmic costs of index operations and recursive
+# tree traversal -- and NOT disk I/O on thousands of files.
+
+test_description="Tests performance of read-tree"
+
+. ./perf-lib.sh
+
+test_perf_default_repo
+
+# If the test repo was generated by ./repos/many-files.sh
+# then we know something about the data shape and branches,
+# so we can isolate testing to the ballast-related commits
+# and setup sparse-checkout so we don't have to populate
+# the ballast files and directories.
+#
+# Otherwise, we make some general assumptions about the
+# repo and consider the entire history of the current
+# branch to be the ballast.
+
+test_expect_success "setup repo" '
+ if git rev-parse --verify refs/heads/p0006-ballast^{commit}
+ then
+ echo Assuming synthetic repo from many-files.sh
+ git branch br_base master
+ git branch br_ballast p0006-ballast^
+ git branch br_ballast_alias p0006-ballast^
+ git branch br_ballast_plus_1 p0006-ballast
+ git config --local core.sparsecheckout 1
+ cat >.git/info/sparse-checkout <<-EOF
+ /*
+ !ballast/*
+ EOF
+ else
+ echo Assuming non-synthetic repo...
+ git branch br_base $(git rev-list HEAD | tail -n 1)
+ git branch br_ballast HEAD^ || error "no ancestor commit from current head"
+ git branch br_ballast_alias HEAD^
+ git branch br_ballast_plus_1 HEAD
+ fi &&
+ git checkout -q br_ballast &&
+ nr_files=$(git ls-files | wc -l)
+'
+
+test_perf "read-tree br_base br_ballast ($nr_files)" '
+ git read-tree -m br_base br_ballast -n
+'
+
+test_perf "switch between br_base br_ballast ($nr_files)" '
+ git checkout -q br_base &&
+ git checkout -q br_ballast
+'
+
+test_perf "switch between br_ballast br_ballast_plus_1 ($nr_files)" '
+ git checkout -q br_ballast_plus_1 &&
+ git checkout -q br_ballast
+'
+
+test_perf "switch between aliases ($nr_files)" '
+ git checkout -q br_ballast_alias &&
+ git checkout -q br_ballast
+'
+
+test_done
diff --git a/t/perf/repos/.gitignore b/t/perf/repos/.gitignore
new file mode 100644
index 0000000..72e3dc3
--- /dev/null
+++ b/t/perf/repos/.gitignore
@@ -0,0 +1 @@
+gen-*/
diff --git a/t/perf/repos/inflate-repo.sh b/t/perf/repos/inflate-repo.sh
new file mode 100755
index 0000000..fcfc992
--- /dev/null
+++ b/t/perf/repos/inflate-repo.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+# Inflate the size of an EXISTING repo.
+#
+# This script should be run inside the worktree of a TEST repo.
+# It will use the contents of the current HEAD to generate a
+# commit containing copies of the current worktree such that the
+# total size of the commit has at least <target_size> files.
+#
+# Usage: [-t target_size] [-b branch_name]
+
+set -e
+
+target_size=10000
+branch_name=p0006-ballast
+ballast=ballast
+
+while test "$#" -ne 0
+do
+ case "$1" in
+ -b)
+ shift;
+ test "$#" -ne 0 || { echo 'error: -b requires an argument' >&2; exit 1; }
+ branch_name=$1;
+ shift ;;
+ -t)
+ shift;
+ test "$#" -ne 0 || { echo 'error: -t requires an argument' >&2; exit 1; }
+ target_size=$1;
+ shift ;;
+ *)
+ echo "error: unknown option '$1'" >&2; exit 1 ;;
+ esac
+done
+
+git ls-tree -r HEAD >GEN_src_list
+nr_src_files=$(cat GEN_src_list | wc -l)
+
+src_branch=$(git symbolic-ref --short HEAD)
+
+echo "Branch $src_branch initially has $nr_src_files files."
+
+if test $target_size -le $nr_src_files
+then
+ echo "Repository already exceeds target size $target_size."
+ rm GEN_src_list
+ exit 1
+fi
+
+# Create well-known branch and add 1 file change to start
+# if off before the ballast.
+git checkout -b $branch_name HEAD
+echo "$target_size" > inflate-repo.params
+git add inflate-repo.params
+git commit -q -m params
+
+# Create ballast for in our branch.
+copy=1
+nr_files=$nr_src_files
+while test $nr_files -lt $target_size
+do
+ sed -e "s| | $ballast/$copy/|" <GEN_src_list |
+ git update-index --index-info
+
+ nr_files=$(expr $nr_files + $nr_src_files)
+ copy=$(expr $copy + 1)
+done
+rm GEN_src_list
+git commit -q -m "ballast"
+
+# Modify 1 file and commit.
+echo "$target_size" >> inflate-repo.params
+git add inflate-repo.params
+git commit -q -m "ballast plus 1"
+
+nr_files=$(git ls-files | wc -l)
+
+# Checkout master to put repo in canonical state (because
+# the perf test may need to clone and enable sparse-checkout
+# before attempting to checkout a commit with the ballast
+# (because it may contain 100K directories and 1M files)).
+git checkout $src_branch
+
+echo "Repository inflated. Branch $branch_name has $nr_files files."
+
+exit 0
diff --git a/t/perf/repos/many-files.sh b/t/perf/repos/many-files.sh
new file mode 100755
index 0000000..28720e4
--- /dev/null
+++ b/t/perf/repos/many-files.sh
@@ -0,0 +1,110 @@
+#!/bin/sh
+# Generate test data repository using the given parameters.
+# When omitted, we create "gen-many-files-d-w-f.git".
+#
+# Usage: [-r repo] [-d depth] [-w width] [-f files]
+#
+# -r repo: path to the new repo to be generated
+# -d depth: the depth of sub-directories
+# -w width: the number of sub-directories at each level
+# -f files: the number of files created in each directory
+#
+# Note that all files will have the same SHA-1 and each
+# directory at a level will have the same SHA-1, so we
+# will potentially have a large index, but not a large
+# ODB.
+#
+# Ballast will be created under "ballast/".
+
+EMPTY_BLOB=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+
+set -e
+
+# (5, 10, 9) will create 999,999 ballast files.
+# (4, 10, 9) will create 99,999 ballast files.
+depth=5
+width=10
+files=9
+
+while test "$#" -ne 0
+do
+ case "$1" in
+ -r)
+ shift;
+ test "$#" -ne 0 || { echo 'error: -r requires an argument' >&2; exit 1; }
+ repo=$1;
+ shift ;;
+ -d)
+ shift;
+ test "$#" -ne 0 || { echo 'error: -d requires an argument' >&2; exit 1; }
+ depth=$1;
+ shift ;;
+ -w)
+ shift;
+ test "$#" -ne 0 || { echo 'error: -w requires an argument' >&2; exit 1; }
+ width=$1;
+ shift ;;
+ -f)
+ shift;
+ test "$#" -ne 0 || { echo 'error: -f requires an argument' >&2; exit 1; }
+ files=$1;
+ shift ;;
+ *)
+ echo "error: unknown option '$1'" >&2; exit 1 ;;
+ esac
+done
+
+# Inflate the index with thousands of empty files.
+# usage: dir depth width files
+fill_index() {
+ awk -v arg_dir=$1 -v arg_depth=$2 -v arg_width=$3 -v arg_files=$4 '
+ function make_paths(dir, depth, width, files, f, w) {
+ for (f = 1; f <= files; f++) {
+ print dir "/file" f
+ }
+ if (depth > 0) {
+ for (w = 1; w <= width; w++) {
+ make_paths(dir "/dir" w, depth - 1, width, files)
+ }
+ }
+ }
+ END { make_paths(arg_dir, arg_depth, arg_width, arg_files) }
+ ' </dev/null |
+ sed "s/^/100644 $EMPTY_BLOB /" |
+ git update-index --index-info
+ return 0
+}
+
+[ -z "$repo" ] && repo=gen-many-files-$depth.$width.$files.git
+
+mkdir $repo
+cd $repo
+git init .
+
+# Create an initial commit just to define master.
+touch many-files.empty
+echo "$depth $width $files" >many-files.params
+git add many-files.*
+git commit -q -m params
+
+# Create ballast for p0006 based upon the given params and
+# inflate the index with thousands of empty files and commit.
+git checkout -b p0006-ballast
+fill_index "ballast" $depth $width $files
+git commit -q -m "ballast"
+
+nr_files=$(git ls-files | wc -l)
+
+# Modify 1 file and commit.
+echo "$depth $width $files" >>many-files.params
+git add many-files.params
+git commit -q -m "ballast plus 1"
+
+# Checkout master to put repo in canonical state (because
+# the perf test may need to clone and enable sparse-checkout
+# before attempting to checkout a commit with the ballast
+# (because it may contain 100K directories and 1M files)).
+git checkout master
+
+echo "Repository "$repo" ($depth, $width, $files) created. Ballast $nr_files."
+exit 0
diff --git a/t/t0025-crlf-auto.sh b/t/t0025-crlf-auto.sh
index d0bee08..89826c5 100755
--- a/t/t0025-crlf-auto.sh
+++ b/t/t0025-crlf-auto.sh
@@ -152,4 +152,30 @@ test_expect_success 'eol=crlf _does_ normalize binary files' '
test -z "$LFwithNULdiff"
'
+test_expect_success 'prepare unnormalized' '
+ > .gitattributes &&
+ git config core.autocrlf false &&
+ printf "LINEONE\nLINETWO\r\n" >mixed &&
+ git add mixed .gitattributes &&
+ git commit -m "Add mixed" &&
+ git ls-files --eol | egrep "i/crlf" &&
+ git ls-files --eol | egrep "i/mixed"
+'
+
+test_expect_success 'normalize unnormalized' '
+ echo "* text=auto" >.gitattributes &&
+ rm .git/index &&
+ git add . &&
+ git commit -m "Introduce end-of-line normalization" &&
+ git ls-files --eol | tr "\\t" " " | sort >act &&
+cat >exp <<EOF &&
+i/-text w/-text attr/text=auto LFwithNUL
+i/lf w/crlf attr/text=auto CRLFonly
+i/lf w/crlf attr/text=auto LFonly
+i/lf w/lf attr/text=auto .gitattributes
+i/lf w/mixed attr/text=auto mixed
+EOF
+ test_cmp exp act
+'
+
test_done
diff --git a/t/t0065-strcmp-offset.sh b/t/t0065-strcmp-offset.sh
new file mode 100755
index 0000000..7d6d214
--- /dev/null
+++ b/t/t0065-strcmp-offset.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+test_description='Test strcmp_offset functionality'
+
+. ./test-lib.sh
+
+while read s1 s2 expect
+do
+ test_expect_success "strcmp_offset($s1, $s2)" '
+ echo "$expect" >expect &&
+ test-strcmp-offset "$s1" "$s2" >actual &&
+ test_cmp expect actual
+ '
+done <<-EOF
+abc abc 0 3
+abc def -1 0
+abc abz -1 2
+abc abcdef -1 3
+EOF
+
+test_done
diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh
index e833939..933915e 100755
--- a/t/t1305-config-include.sh
+++ b/t/t1305-config-include.sh
@@ -3,6 +3,16 @@
test_description='test config file include directives'
. ./test-lib.sh
+# Force setup_explicit_git_dir() to run until the end. This is needed
+# by some tests to make sure real_path() is called on $GIT_DIR. The
+# caller needs to make sure git commands are run from a subdirectory
+# though or real_path() will not be called.
+force_setup_explicit_git_dir() {
+ GIT_DIR="$(pwd)/.git"
+ GIT_WORK_TREE="$(pwd)"
+ export GIT_DIR GIT_WORK_TREE
+}
+
test_expect_success 'include file by absolute path' '
echo "[test]one = 1" >one &&
echo "[include]path = \"$(pwd)/one\"" >.gitconfig &&
@@ -208,6 +218,61 @@ test_expect_success 'conditional include, both unanchored, icase' '
)
'
+test_expect_success 'conditional include, early config reading' '
+ (
+ cd foo &&
+ echo "[includeIf \"gitdir:foo/\"]path=bar6" >>.git/config &&
+ echo "[test]six=6" >.git/bar6 &&
+ echo 6 >expect &&
+ test-config read_early_config test.six >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success SYMLINKS 'conditional include, set up symlinked $HOME' '
+ mkdir real-home &&
+ ln -s real-home home &&
+ (
+ HOME="$TRASH_DIRECTORY/home" &&
+ export HOME &&
+ cd "$HOME" &&
+
+ git init foo &&
+ cd foo &&
+ mkdir sub
+ )
+'
+
+test_expect_success SYMLINKS 'conditional include, $HOME expansion with symlinks' '
+ (
+ HOME="$TRASH_DIRECTORY/home" &&
+ export HOME &&
+ cd "$HOME"/foo &&
+
+ echo "[includeIf \"gitdir:~/foo/\"]path=bar2" >>.git/config &&
+ echo "[test]two=2" >.git/bar2 &&
+ echo 2 >expect &&
+ force_setup_explicit_git_dir &&
+ git -C sub config test.two >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success SYMLINKS 'conditional include, relative path with symlinks' '
+ echo "[includeIf \"gitdir:./foo/.git\"]path=bar4" >home/.gitconfig &&
+ echo "[test]four=4" >home/bar4 &&
+ (
+ HOME="$TRASH_DIRECTORY/home" &&
+ export HOME &&
+ cd "$HOME"/foo &&
+
+ echo 4 >expect &&
+ force_setup_explicit_git_dir &&
+ git -C sub config test.four >actual &&
+ test_cmp expect actual
+ )
+'
+
test_expect_success 'include cycles are detected' '
cat >.gitconfig <<-\EOF &&
[test]value = gitconfig
diff --git a/t/t1309-early-config.sh b/t/t1309-early-config.sh
index b97357b..1af8c45 100755
--- a/t/t1309-early-config.sh
+++ b/t/t1309-early-config.sh
@@ -47,6 +47,24 @@ test_expect_success 'ceiling #2' '
test xdg = "$(cat output)"
'
+cmdline_config="'test.source=cmdline'"
+test_expect_success 'read config file in right order' '
+ echo "[test]source = home" >>.gitconfig &&
+ git init foo &&
+ (
+ cd foo &&
+ echo "[test]source = repo" >>.git/config &&
+ GIT_CONFIG_PARAMETERS=$cmdline_config test-config \
+ read_early_config test.source >actual &&
+ cat >expected <<-\EOF &&
+ home
+ repo
+ cmdline
+ EOF
+ test_cmp expected actual
+ )
+'
+
test_with_config () {
rm -rf throwaway &&
git init throwaway &&
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index a23cd7b..dc98b4b 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -35,14 +35,14 @@ test_expect_success setup '
cd -
'
-test_expect_success \
- "create $m" \
- "git update-ref $m $A &&
- test $A"' = $(cat .git/'"$m"')'
-test_expect_success \
- "create $m with oldvalue verification" \
- "git update-ref $m $B $A &&
- test $B"' = $(cat .git/'"$m"')'
+test_expect_success "create $m" '
+ git update-ref $m $A &&
+ test $A = $(cat .git/$m)
+'
+test_expect_success "create $m with oldvalue verification" '
+ git update-ref $m $B $A &&
+ test $B = $(cat .git/$m)
+'
test_expect_success "fail to delete $m with stale ref" '
test_must_fail git update-ref -d $m $A &&
test $B = "$(cat .git/$m)"
@@ -67,14 +67,14 @@ test_expect_success "fail to create $n" '
test_must_fail git update-ref $n $A
'
-test_expect_success \
- "create $m (by HEAD)" \
- "git update-ref HEAD $A &&
- test $A"' = $(cat .git/'"$m"')'
-test_expect_success \
- "create $m (by HEAD) with oldvalue verification" \
- "git update-ref HEAD $B $A &&
- test $B"' = $(cat .git/'"$m"')'
+test_expect_success "create $m (by HEAD)" '
+ git update-ref HEAD $A &&
+ test $A = $(cat .git/$m)
+'
+test_expect_success "create $m (by HEAD) with oldvalue verification" '
+ git update-ref HEAD $B $A &&
+ test $B = $(cat .git/$m)
+'
test_expect_success "fail to delete $m (by HEAD) with stale ref" '
test_must_fail git update-ref -d HEAD $A &&
test $B = $(cat .git/$m)
@@ -176,17 +176,17 @@ test_expect_success '--no-create-reflog overrides core.logAllRefUpdates=always'
test_must_fail git reflog exists $outside
'
-test_expect_success \
- "create $m (by HEAD)" \
- "git update-ref HEAD $A &&
- test $A"' = $(cat .git/'"$m"')'
-test_expect_success \
- "pack refs" \
- "git pack-refs --all"
-test_expect_success \
- "move $m (by HEAD)" \
- "git update-ref HEAD $B $A &&
- test $B"' = $(cat .git/'"$m"')'
+test_expect_success "create $m (by HEAD)" '
+ git update-ref HEAD $A &&
+ test $A = $(cat .git/$m)
+'
+test_expect_success 'pack refs' '
+ git pack-refs --all
+'
+test_expect_success "move $m (by HEAD)" '
+ git update-ref HEAD $B $A &&
+ test $B = $(cat .git/$m)
+'
test_expect_success "delete $m (by HEAD) should remove both packed and loose $m" '
test_when_finished "rm -f .git/$m" &&
git update-ref -d HEAD $B &&
@@ -195,13 +195,13 @@ test_expect_success "delete $m (by HEAD) should remove both packed and loose $m"
'
cp -f .git/HEAD .git/HEAD.orig
-test_expect_success "delete symref without dereference" '
+test_expect_success 'delete symref without dereference' '
test_when_finished "cp -f .git/HEAD.orig .git/HEAD" &&
git update-ref --no-deref -d HEAD &&
test_path_is_missing .git/HEAD
'
-test_expect_success "delete symref without dereference when the referred ref is packed" '
+test_expect_success 'delete symref without dereference when the referred ref is packed' '
test_when_finished "cp -f .git/HEAD.orig .git/HEAD" &&
echo foo >foo.c &&
git add foo.c &&
@@ -239,46 +239,46 @@ test_expect_success 'update-ref --no-deref -d can delete reference to bad ref' '
test_path_is_missing .git/refs/heads/ref-to-bad
'
-test_expect_success '(not) create HEAD with old sha1' "
+test_expect_success '(not) create HEAD with old sha1' '
test_must_fail git update-ref HEAD $A $B
-"
+'
test_expect_success "(not) prior created .git/$m" '
test_when_finished "rm -f .git/$m" &&
test_path_is_missing .git/$m
'
-test_expect_success \
- "create HEAD" \
- "git update-ref HEAD $A"
-test_expect_success '(not) change HEAD with wrong SHA1' "
+test_expect_success 'create HEAD' '
+ git update-ref HEAD $A
+'
+test_expect_success '(not) change HEAD with wrong SHA1' '
test_must_fail git update-ref HEAD $B $Z
-"
+'
test_expect_success "(not) changed .git/$m" '
test_when_finished "rm -f .git/$m" &&
! test $B = $(cat .git/$m)
'
rm -f .git/logs/refs/heads/master
-test_expect_success \
- "create $m (logged by touch)" \
- 'test_config core.logAllRefUpdates false &&
- GIT_COMMITTER_DATE="2005-05-26 23:30" \
- git update-ref --create-reflog HEAD '"$A"' -m "Initial Creation" &&
- test '"$A"' = $(cat .git/'"$m"')'
-test_expect_success \
- "update $m (logged by touch)" \
- 'test_config core.logAllRefUpdates false &&
- GIT_COMMITTER_DATE="2005-05-26 23:31" \
- git update-ref HEAD'" $B $A "'-m "Switch" &&
- test '"$B"' = $(cat .git/'"$m"')'
-test_expect_success \
- "set $m (logged by touch)" \
- 'test_config core.logAllRefUpdates false &&
- GIT_COMMITTER_DATE="2005-05-26 23:41" \
- git update-ref HEAD'" $A &&
- test $A"' = $(cat .git/'"$m"')'
-
-test_expect_success "empty directory removal" '
+test_expect_success "create $m (logged by touch)" '
+ test_config core.logAllRefUpdates false &&
+ GIT_COMMITTER_DATE="2005-05-26 23:30" \
+ git update-ref --create-reflog HEAD $A -m "Initial Creation" &&
+ test $A = $(cat .git/$m)
+'
+test_expect_success "update $m (logged by touch)" '
+ test_config core.logAllRefUpdates false &&
+ GIT_COMMITTER_DATE="2005-05-26 23:31" \
+ git update-ref HEAD $B $A -m "Switch" &&
+ test $B = $(cat .git/$m)
+'
+test_expect_success "set $m (logged by touch)" '
+ test_config core.logAllRefUpdates false &&
+ GIT_COMMITTER_DATE="2005-05-26 23:41" \
+ git update-ref HEAD $A &&
+ test $A = $(cat .git/$m)
+'
+
+test_expect_success 'empty directory removal' '
git branch d1/d2/r1 HEAD &&
git branch d1/r2 HEAD &&
test_path_is_file .git/refs/heads/d1/d2/r1 &&
@@ -290,7 +290,7 @@ test_expect_success "empty directory removal" '
test_path_is_file .git/logs/refs/heads/d1/r2
'
-test_expect_success "symref empty directory removal" '
+test_expect_success 'symref empty directory removal' '
git branch e1/e2/r1 HEAD &&
git branch e1/r2 HEAD &&
git checkout e1/e2/r1 &&
@@ -315,34 +315,34 @@ test_expect_success "verifying $m's log (logged by touch)" '
test_cmp expect .git/logs/$m
'
-test_expect_success \
- "create $m (logged by config)" \
- 'test_config core.logAllRefUpdates true &&
- GIT_COMMITTER_DATE="2005-05-26 23:32" \
- git update-ref HEAD'" $A "'-m "Initial Creation" &&
- test '"$A"' = $(cat .git/'"$m"')'
-test_expect_success \
- "update $m (logged by config)" \
- 'test_config core.logAllRefUpdates true &&
- GIT_COMMITTER_DATE="2005-05-26 23:33" \
- git update-ref HEAD'" $B $A "'-m "Switch" &&
- test '"$B"' = $(cat .git/'"$m"')'
-test_expect_success \
- "set $m (logged by config)" \
- 'test_config core.logAllRefUpdates true &&
- GIT_COMMITTER_DATE="2005-05-26 23:43" \
- git update-ref HEAD '"$A &&
- test $A"' = $(cat .git/'"$m"')'
+test_expect_success "create $m (logged by config)" '
+ test_config core.logAllRefUpdates true &&
+ GIT_COMMITTER_DATE="2005-05-26 23:32" \
+ git update-ref HEAD $A -m "Initial Creation" &&
+ test $A = $(cat .git/$m)
+'
+test_expect_success "update $m (logged by config)" '
+ test_config core.logAllRefUpdates true &&
+ GIT_COMMITTER_DATE="2005-05-26 23:33" \
+ git update-ref HEAD'" $B $A "'-m "Switch" &&
+ test $B = $(cat .git/$m)
+'
+test_expect_success "set $m (logged by config)" '
+ test_config core.logAllRefUpdates true &&
+ GIT_COMMITTER_DATE="2005-05-26 23:43" \
+ git update-ref HEAD $A &&
+ test $A = $(cat .git/$m)
+'
cat >expect <<EOF
$Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 +0000 Initial Creation
$A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 +0000 Switch
$B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000
EOF
-test_expect_success \
- "verifying $m's log (logged by config)" \
- 'test_when_finished "rm -f .git/$m .git/logs/$m expect" &&
- test_cmp expect .git/logs/$m'
+test_expect_success "verifying $m's log (logged by config)" '
+ test_when_finished "rm -f .git/$m .git/logs/$m expect" &&
+ test_cmp expect .git/logs/$m
+'
git update-ref $m $D
cat >.git/logs/$m <<EOF
@@ -356,86 +356,85 @@ EOF
ed="Thu, 26 May 2005 18:32:00 -0500"
gd="Thu, 26 May 2005 18:33:00 -0500"
ld="Thu, 26 May 2005 18:43:00 -0500"
-test_expect_success \
- 'Query "master@{May 25 2005}" (before history)' \
- 'test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{May 25 2005}" >o 2>e &&
- test '"$C"' = $(cat o) &&
- test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"'
-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_expect_success \
- 'Query "master@{May 26 2005 23:31:59}" (1 second before history)' \
- 'test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e &&
- test '"$C"' = $(cat o) &&
- test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"'
-test_expect_success \
- 'Query "master@{May 26 2005 23:32:00}" (exactly history start)' \
- 'test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
- test '"$C"' = $(cat o) &&
- test "" = "$(cat e)"'
-test_expect_success \
- 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' \
- 'test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e &&
- test '"$A"' = $(cat o) &&
- test "" = "$(cat e)"'
-test_expect_success \
- 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' \
- 'test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
- test '"$B"' = $(cat o) &&
- test "warning: Log for ref '"$m has gap after $gd"'." = "$(cat e)"'
-test_expect_success \
- 'Query "master@{2005-05-26 23:38:00}" (middle of history)' \
- 'test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
- test '"$Z"' = $(cat o) &&
- test "" = "$(cat e)"'
-test_expect_success \
- 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' \
- 'test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
- test '"$E"' = $(cat o) &&
- test "" = "$(cat e)"'
-test_expect_success \
- 'Query "master@{2005-05-28}" (past end of history)' \
- 'test_when_finished "rm -f o e" &&
- git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
- test '"$D"' = $(cat o) &&
- test "warning: Log for ref '"$m unexpectedly ended on $ld"'." = "$(cat e)"'
-
+test_expect_success 'Query "master@{May 25 2005}" (before history)' '
+ test_when_finished "rm -f o e" &&
+ git rev-parse --verify "master@{May 25 2005}" >o 2>e &&
+ test $C = $(cat o) &&
+ test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"
+'
+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_expect_success 'Query "master@{May 26 2005 23:31:59}" (1 second before history)' '
+ test_when_finished "rm -f o e" &&
+ git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e &&
+ test $C = $(cat o) &&
+ test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"
+'
+test_expect_success 'Query "master@{May 26 2005 23:32:00}" (exactly history start)' '
+ test_when_finished "rm -f o e" &&
+ git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
+ test $C = $(cat o) &&
+ test "" = "$(cat e)"
+'
+test_expect_success 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' '
+ test_when_finished "rm -f o e" &&
+ git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e &&
+ test $A = $(cat o) &&
+ test "" = "$(cat e)"
+'
+test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' '
+ test_when_finished "rm -f o e" &&
+ git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
+ test $B = $(cat o) &&
+ test "warning: Log for ref $m has gap after $gd." = "$(cat e)"
+'
+test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' '
+ test_when_finished "rm -f o e" &&
+ git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
+ test $Z = $(cat o) &&
+ test "" = "$(cat e)"
+'
+test_expect_success 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' '
+ test_when_finished "rm -f o e" &&
+ git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
+ test $E = $(cat o) &&
+ test "" = "$(cat e)"
+'
+test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
+ test_when_finished "rm -f o e" &&
+ git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
+ test $D = $(cat o) &&
+ test "warning: Log for ref $m unexpectedly ended on $ld." = "$(cat e)"
+'
rm -f .git/$m .git/logs/$m expect
-test_expect_success \
- 'creating initial files' \
- 'test_when_finished rm -f M &&
- echo TEST >F &&
- git add F &&
- GIT_AUTHOR_DATE="2005-05-26 23:30" \
- GIT_COMMITTER_DATE="2005-05-26 23:30" git commit -m add -a &&
- h_TEST=$(git rev-parse --verify HEAD) &&
- echo The other day this did not work. >M &&
- echo And then Bob told me how to fix it. >>M &&
- echo OTHER >F &&
- GIT_AUTHOR_DATE="2005-05-26 23:41" \
- GIT_COMMITTER_DATE="2005-05-26 23:41" git commit -F M -a &&
- h_OTHER=$(git rev-parse --verify HEAD) &&
- GIT_AUTHOR_DATE="2005-05-26 23:44" \
- GIT_COMMITTER_DATE="2005-05-26 23:44" git commit --amend &&
- h_FIXED=$(git rev-parse --verify HEAD) &&
- echo Merged initial commit and a later commit. >M &&
- echo $h_TEST >.git/MERGE_HEAD &&
- GIT_AUTHOR_DATE="2005-05-26 23:45" \
- GIT_COMMITTER_DATE="2005-05-26 23:45" git commit -F M &&
- h_MERGED=$(git rev-parse --verify HEAD)'
+test_expect_success 'creating initial files' '
+ test_when_finished rm -f M &&
+ echo TEST >F &&
+ git add F &&
+ GIT_AUTHOR_DATE="2005-05-26 23:30" \
+ GIT_COMMITTER_DATE="2005-05-26 23:30" git commit -m add -a &&
+ h_TEST=$(git rev-parse --verify HEAD) &&
+ echo The other day this did not work. >M &&
+ echo And then Bob told me how to fix it. >>M &&
+ echo OTHER >F &&
+ GIT_AUTHOR_DATE="2005-05-26 23:41" \
+ GIT_COMMITTER_DATE="2005-05-26 23:41" git commit -F M -a &&
+ h_OTHER=$(git rev-parse --verify HEAD) &&
+ GIT_AUTHOR_DATE="2005-05-26 23:44" \
+ GIT_COMMITTER_DATE="2005-05-26 23:44" git commit --amend &&
+ h_FIXED=$(git rev-parse --verify HEAD) &&
+ echo Merged initial commit and a later commit. >M &&
+ echo $h_TEST >.git/MERGE_HEAD &&
+ GIT_AUTHOR_DATE="2005-05-26 23:45" \
+ GIT_COMMITTER_DATE="2005-05-26 23:45" git commit -F M &&
+ h_MERGED=$(git rev-parse --verify HEAD)
+'
cat >expect <<EOF
$Z $h_TEST $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 commit (initial): add
@@ -443,20 +442,20 @@ $h_TEST $h_OTHER $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000 com
$h_OTHER $h_FIXED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151040 +0000 commit (amend): The other day this did not work.
$h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000 commit (merge): Merged initial commit and a later commit.
EOF
-test_expect_success \
- 'git commit logged updates' \
- "test_cmp expect .git/logs/$m"
+test_expect_success 'git commit logged updates' '
+ test_cmp expect .git/logs/$m
+'
unset h_TEST h_OTHER h_FIXED h_MERGED
-test_expect_success \
- 'git cat-file blob master:F (expect OTHER)' \
- 'test OTHER = $(git cat-file blob master:F)'
-test_expect_success \
- 'git cat-file blob master@{2005-05-26 23:30}:F (expect TEST)' \
- 'test TEST = $(git cat-file blob "master@{2005-05-26 23:30}:F")'
-test_expect_success \
- 'git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER)' \
- 'test OTHER = $(git cat-file blob "master@{2005-05-26 23:42}:F")'
+test_expect_success 'git cat-file blob master:F (expect OTHER)' '
+ test OTHER = $(git cat-file blob master:F)
+'
+test_expect_success 'git cat-file blob master@{2005-05-26 23:30}:F (expect TEST)' '
+ test TEST = $(git cat-file blob "master@{2005-05-26 23:30}:F")
+'
+test_expect_success 'git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER)' '
+ test OTHER = $(git cat-file blob "master@{2005-05-26 23:42}:F")
+'
a=refs/heads/a
b=refs/heads/b
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 33a51c9..677e15a 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -689,4 +689,17 @@ test_expect_success 'bogus head does not fallback to all heads' '
! grep $blob out
'
+test_expect_success 'detect corrupt index file in fsck' '
+ cp .git/index .git/index.backup &&
+ test_when_finished "mv .git/index.backup .git/index" &&
+ echo zzzzzzzz >zzzzzzzz &&
+ git add zzzzzzzz &&
+ sed -e "s/zzzzzzzz/yyyyyyyy/" .git/index >.git/index.yyy &&
+ mv .git/index.yyy .git/index &&
+ # Confirm that fsck detects invalid checksum
+ test_must_fail git fsck --cache &&
+ # Confirm that status no longer complains about invalid checksum
+ git status
+'
+
test_done
diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh
index b618d6b..b5c47ac 100755
--- a/t/t2025-worktree-add.sh
+++ b/t/t2025-worktree-add.sh
@@ -63,6 +63,12 @@ test_expect_success '"add" worktree' '
)
'
+test_expect_success '"add" worktree with lock' '
+ git rev-parse HEAD >expect &&
+ git worktree add --detach --lock here-with-lock master &&
+ test -f .git/worktrees/here-with-lock/locked
+'
+
test_expect_success '"add" worktree from a subdir' '
(
mkdir sub &&
diff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh
index 848da5f..720063b 100755
--- a/t/t2027-worktree-list.sh
+++ b/t/t2027-worktree-list.sh
@@ -20,7 +20,7 @@ test_expect_success 'rev-parse --git-common-dir on main worktree' '
test_expect_success 'rev-parse --git-path objects linked worktree' '
echo "$(git rev-parse --show-toplevel)/.git/objects" >expect &&
- test_when_finished "rm -rf linked-tree && git worktree prune" &&
+ test_when_finished "rm -rf linked-tree actual expect && git worktree prune" &&
git worktree add --detach linked-tree master &&
git -C linked-tree rev-parse --git-path objects >actual &&
test_cmp expect actual
@@ -28,19 +28,21 @@ test_expect_success 'rev-parse --git-path objects linked worktree' '
test_expect_success '"list" all worktrees from main' '
echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
- test_when_finished "rm -rf here && git worktree prune" &&
+ test_when_finished "rm -rf here out actual expect && git worktree prune" &&
git worktree add --detach here master &&
echo "$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
- git worktree list | sed "s/ */ /g" >actual &&
+ git worktree list >out &&
+ sed "s/ */ /g" <out >actual &&
test_cmp expect actual
'
test_expect_success '"list" all worktrees from linked' '
echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
- test_when_finished "rm -rf here && git worktree prune" &&
+ test_when_finished "rm -rf here out actual expect && git worktree prune" &&
git worktree add --detach here master &&
echo "$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
- git -C here worktree list | sed "s/ */ /g" >actual &&
+ git -C here worktree list >out &&
+ sed "s/ */ /g" <out >actual &&
test_cmp expect actual
'
@@ -49,7 +51,7 @@ test_expect_success '"list" all worktrees --porcelain' '
echo "HEAD $(git rev-parse HEAD)" >>expect &&
echo "branch $(git symbolic-ref HEAD)" >>expect &&
echo >>expect &&
- test_when_finished "rm -rf here && git worktree prune" &&
+ test_when_finished "rm -rf here actual expect && git worktree prune" &&
git worktree add --detach here master &&
echo "worktree $(git -C here rev-parse --show-toplevel)" >>expect &&
echo "HEAD $(git rev-parse HEAD)" >>expect &&
@@ -69,16 +71,17 @@ test_expect_success 'bare repo setup' '
'
test_expect_success '"list" all worktrees from bare main' '
- test_when_finished "rm -rf there && git -C bare1 worktree prune" &&
+ test_when_finished "rm -rf there out actual expect && git -C bare1 worktree prune" &&
git -C bare1 worktree add --detach ../there master &&
echo "$(pwd)/bare1 (bare)" >expect &&
echo "$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)" >>expect &&
- git -C bare1 worktree list | sed "s/ */ /g" >actual &&
+ git -C bare1 worktree list >out &&
+ sed "s/ */ /g" <out >actual &&
test_cmp expect actual
'
test_expect_success '"list" all worktrees --porcelain from bare main' '
- test_when_finished "rm -rf there && git -C bare1 worktree prune" &&
+ test_when_finished "rm -rf there actual expect && git -C bare1 worktree prune" &&
git -C bare1 worktree add --detach ../there master &&
echo "worktree $(pwd)/bare1" >expect &&
echo "bare" >>expect &&
@@ -92,11 +95,12 @@ test_expect_success '"list" all worktrees --porcelain from bare main' '
'
test_expect_success '"list" all worktrees from linked with a bare main' '
- test_when_finished "rm -rf there && git -C bare1 worktree prune" &&
+ test_when_finished "rm -rf there out actual expect && git -C bare1 worktree prune" &&
git -C bare1 worktree add --detach ../there master &&
echo "$(pwd)/bare1 (bare)" >expect &&
echo "$(git -C there rev-parse --show-toplevel) $(git -C there rev-parse --short HEAD) (detached HEAD)" >>expect &&
- git -C there worktree list | sed "s/ */ /g" >actual &&
+ git -C there worktree list >out &&
+ sed "s/ */ /g" <out >actual &&
test_cmp expect actual
'
@@ -118,9 +122,11 @@ test_expect_success 'broken main worktree still at the top' '
cd linked &&
echo "worktree $(pwd)" >expected &&
echo "ref: .broken" >../.git/HEAD &&
- git worktree list --porcelain | head -n 3 >actual &&
+ git worktree list --porcelain >out &&
+ head -n 3 out >actual &&
test_cmp ../expected actual &&
- git worktree list | head -n 1 >actual.2 &&
+ git worktree list >out &&
+ head -n 1 out >actual.2 &&
grep -F "(error)" actual.2
)
'
@@ -134,7 +140,8 @@ test_expect_success 'linked worktrees are sorted' '
test_commit new &&
git worktree add ../first &&
git worktree add ../second &&
- git worktree list --porcelain | grep ^worktree >actual
+ git worktree list --porcelain >out &&
+ grep ^worktree out >actual
) &&
cat >expected <<-EOF &&
worktree $(pwd)/sorted/main
diff --git a/t/t3007-ls-files-recurse-submodules.sh b/t/t3007-ls-files-recurse-submodules.sh
index 4cf6ccf..ebb956f 100755
--- a/t/t3007-ls-files-recurse-submodules.sh
+++ b/t/t3007-ls-files-recurse-submodules.sh
@@ -77,10 +77,22 @@ test_expect_success 'ls-files recurses more than 1 level' '
git -C submodule/subsub commit -m "add d" &&
git -C submodule submodule add ./subsub &&
git -C submodule commit -m "added subsub" &&
+ git submodule absorbgitdirs &&
git ls-files --recurse-submodules >actual &&
test_cmp expect actual
'
+test_expect_success 'ls-files works with GIT_DIR' '
+ cat >expect <<-\EOF &&
+ .gitmodules
+ c
+ subsub/d
+ EOF
+
+ git --git-dir=submodule/.git ls-files --recurse-submodules >actual &&
+ test_cmp expect actual
+'
+
test_expect_success '--recurse-submodules and pathspecs setup' '
echo e >submodule/subsub/e.txt &&
git -C submodule/subsub add e.txt &&
diff --git a/t/t3428-rebase-signoff.sh b/t/t3428-rebase-signoff.sh
new file mode 100755
index 0000000..2afb564
--- /dev/null
+++ b/t/t3428-rebase-signoff.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+test_description='git rebase --signoff
+
+This test runs git rebase --signoff and make sure that it works.
+'
+
+. ./test-lib.sh
+
+# A simple file to commit
+cat >file <<EOF
+a
+EOF
+
+# Expected commit message after rebase --signoff
+cat >expected-signed <<EOF
+first
+
+Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
+EOF
+
+# Expected commit message after rebase without --signoff (or with --no-signoff)
+cat >expected-unsigned <<EOF
+first
+EOF
+
+
+# We configure an alias to do the rebase --signoff so that
+# on the next subtest we can show that --no-signoff overrides the alias
+test_expect_success 'rebase --signoff adds a sign-off line' '
+ git commit --allow-empty -m "Initial empty commit" &&
+ git add file && git commit -m first &&
+ git config alias.rbs "rebase --signoff" &&
+ git rbs HEAD^ &&
+ git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
+ test_cmp expected-signed actual
+'
+
+test_expect_success 'rebase --no-signoff does not add a sign-off line' '
+ git commit --amend -m "first" &&
+ git rbs --no-signoff HEAD^ &&
+ git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
+ test_cmp expected-unsigned actual
+'
+
+test_done
diff --git a/t/t3429-rebase-edit-todo.sh b/t/t3429-rebase-edit-todo.sh
new file mode 100755
index 0000000..b9292df
--- /dev/null
+++ b/t/t3429-rebase-edit-todo.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+test_description='rebase should reread the todo file if an exec modifies it'
+
+. ./test-lib.sh
+
+test_expect_success 'rebase exec modifies rebase-todo' '
+ test_commit initial &&
+ todo=.git/rebase-merge/git-rebase-todo &&
+ git rebase HEAD -x "echo exec touch F >>$todo" &&
+ test -e F
+'
+
+test_done
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index f9528fa..2ecb43a 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -436,6 +436,28 @@ test_expect_success 'add -p handles globs' '
test_cmp expect actual
'
+test_expect_success 'add -p handles relative paths' '
+ git reset --hard &&
+
+ echo base >relpath.c &&
+ git add "*.c" &&
+ git commit -m relpath &&
+
+ echo change >relpath.c &&
+ mkdir -p subdir &&
+ git -C subdir add -p .. 2>error <<-\EOF &&
+ y
+ EOF
+
+ test_must_be_empty error &&
+
+ cat >expect <<-\EOF &&
+ relpath.c
+ EOF
+ git diff --cached --name-only >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'add -p does not expand argument lists' '
git reset --hard &&
diff --git a/t/t5533-push-cas.sh b/t/t5533-push-cas.sh
index a2c9e74..d38ecee 100755
--- a/t/t5533-push-cas.sh
+++ b/t/t5533-push-cas.sh
@@ -229,4 +229,33 @@ test_expect_success 'new branch already exists' '
)
'
+test_expect_success 'background updates of REMOTE can be mitigated with a non-updated REMOTE-push' '
+ rm -rf src dst &&
+ git init --bare src.bare &&
+ test_when_finished "rm -rf src.bare" &&
+ git clone --no-local src.bare dst &&
+ test_when_finished "rm -rf dst" &&
+ (
+ cd dst &&
+ test_commit G &&
+ git remote add origin-push ../src.bare &&
+ git push origin-push master:master
+ ) &&
+ git clone --no-local src.bare dst2 &&
+ test_when_finished "rm -rf dst2" &&
+ (
+ cd dst2 &&
+ test_commit H &&
+ git push
+ ) &&
+ (
+ cd dst &&
+ test_commit I &&
+ git fetch origin &&
+ test_must_fail git push --force-with-lease origin-push &&
+ git fetch origin-push &&
+ git push --force-with-lease origin-push
+ )
+'
+
test_done
diff --git a/t/t5547-push-quarantine.sh b/t/t5547-push-quarantine.sh
index af9fcd8..113c870 100755
--- a/t/t5547-push-quarantine.sh
+++ b/t/t5547-push-quarantine.sh
@@ -58,4 +58,15 @@ test_expect_success 'push to repo path with path separator (colon)' '
git push "$(pwd)/xxx${pathsep}yyy.git" HEAD
'
+test_expect_success 'updating a ref from quarantine is forbidden' '
+ git init --bare update.git &&
+ write_script update.git/hooks/pre-receive <<-\EOF &&
+ read old new refname
+ git update-ref refs/heads/unrelated $new
+ exit 1
+ EOF
+ test_must_fail git push update.git HEAD &&
+ git -C update.git fsck
+'
+
test_done
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index cf77a3a..1b8f1db 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -38,6 +38,14 @@ test_expect_success 'submodule update aborts on missing .gitmodules file' '
test_i18ngrep "Submodule path .sub. not initialized" actual
'
+test_expect_success 'submodule update aborts on missing gitmodules url' '
+ test_when_finished "git update-index --remove sub" &&
+ git update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&
+ test_when_finished "rm -f .gitmodules" &&
+ git config -f .gitmodules submodule.s.path sub &&
+ test_must_fail git submodule init
+'
+
test_expect_success 'configuration parsing' '
test_when_finished "rm -f .gitmodules" &&
cat >.gitmodules <<-\EOF &&
@@ -273,6 +281,20 @@ test_expect_success 'submodule add with ./, /.. and // in path' '
test_cmp empty untracked
'
+test_expect_success 'submodule add with \\ in path' '
+ test_when_finished "rm -rf parent sub\\with\\backslash" &&
+
+ # Initialize a repo with a backslash in its name
+ git init sub\\with\\backslash &&
+ touch sub\\with\\backslash/empty.file &&
+ git -C sub\\with\\backslash add empty.file &&
+ git -C sub\\with\\backslash commit -m "Added empty.file" &&
+
+ # Add that repository as a submodule
+ git init parent &&
+ git -C parent submodule add ../sub\\with\\backslash
+'
+
test_expect_success 'submodule add in subdirectory' '
echo "refs/heads/master" >expect &&
>empty &&
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 5ed2813..2cb999e 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -1457,4 +1457,38 @@ test_expect_failure 'complete with tilde expansion' '
test_completion "git add ~/tmp/" "~/tmp/file"
'
+test_expect_success 'setup other remote for remote reference completion' '
+ git remote add other otherrepo &&
+ git fetch other
+'
+
+for flag in -d --delete
+do
+ test_expect_success "__git_complete_remote_or_refspec - push $flag other" '
+ sed -e "s/Z$//" >expected <<-EOF &&
+ master-in-other Z
+ EOF
+ (
+ words=(git push '$flag' other ma) &&
+ cword=${#words[@]} cur=${words[cword-1]} &&
+ __git_complete_remote_or_refspec &&
+ print_comp
+ ) &&
+ test_cmp expected out
+ '
+
+ test_expect_failure "__git_complete_remote_or_refspec - push other $flag" '
+ sed -e "s/Z$//" >expected <<-EOF &&
+ master-in-other Z
+ EOF
+ (
+ words=(git push other '$flag' ma) &&
+ cword=${#words[@]} cur=${words[cword-1]} &&
+ __git_complete_remote_or_refspec &&
+ print_comp
+ ) &&
+ test_cmp expected out
+ '
+done
+
test_done