diff options
Diffstat (limited to 't')
32 files changed, 1599 insertions, 168 deletions
diff --git a/t/lib-patch-mode.sh b/t/lib-patch-mode.sh index 75a3ee283d..ce36f34d03 100755..100644 --- a/t/lib-patch-mode.sh +++ b/t/lib-patch-mode.sh @@ -1,3 +1,5 @@ +: included from t2016 and others + . ./test-lib.sh if ! test_have_prereq PERL; then diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh index fd98e445bf..dd32432d62 100755 --- a/t/t1007-hash-object.sh +++ b/t/t1007-hash-object.sh @@ -65,10 +65,6 @@ test_expect_success "Can't use --path with --stdin-paths" ' echo example | test_must_fail git hash-object --stdin-paths --path=foo ' -test_expect_success "Can't use --stdin-paths with --no-filters" ' - echo example | test_must_fail git hash-object --stdin-paths --no-filters -' - test_expect_success "Can't use --path with --no-filters" ' test_must_fail git hash-object --no-filters --path=foo ' @@ -141,6 +137,20 @@ test_expect_success 'check that --no-filters option works' ' git config --unset core.autocrlf ' +test_expect_success 'check that --no-filters option works with --stdin-paths' ' + echo fooQ | tr Q "\\015" >file0 && + cp file0 file1 && + echo "file0 -crlf" >.gitattributes && + echo "file1 crlf" >>.gitattributes && + git config core.autocrlf true && + file0_sha=$(git hash-object file0) && + file1_sha=$(git hash-object file1) && + test "$file0_sha" != "$file1_sha" && + nofilters_file1=$(echo "file1" | git hash-object --stdin-paths --no-filters) && + test "$file0_sha" = "$nofilters_file1" && + git config --unset core.autocrlf +' + pop_repo for args in "-w --stdin" "--stdin -w"; do diff --git a/t/t1304-default-acl.sh b/t/t1304-default-acl.sh new file mode 100755 index 0000000000..cc30be4a65 --- /dev/null +++ b/t/t1304-default-acl.sh @@ -0,0 +1,67 @@ +#!/bin/sh +# +# Copyright (c) 2010 Matthieu Moy +# + +test_description='Test repository with default ACL' + +# Create the test repo with restrictive umask +# => this must come before . ./test-lib.sh +umask 077 + +. ./test-lib.sh + +# We need an arbitrary other user give permission to using ACLs. root +# is a good candidate: exists on all unices, and it has permission +# anyway, so we don't create a security hole running the testsuite. + +if ! setfacl -m u:root:rwx .; then + say "Skipping ACL tests: unable to use setfacl" + test_done +fi + +modebits () { + ls -l "$1" | sed -e 's|^\(..........\).*|\1|' +} + +check_perms_and_acl () { + actual=$(modebits "$1") && + case "$actual" in + -r--r-----*) + : happy + ;; + *) + echo "Got permission '$actual', expected '-r--r-----'" + false + ;; + esac && + getfacl "$1" > actual && + grep -q "user:root:rwx" actual && + grep -q "user:${LOGNAME}:rwx" actual && + grep -q "mask::r--" actual && + grep -q "group::---" actual || false +} + +dirs_to_set="./ .git/ .git/objects/ .git/objects/pack/" + +test_expect_success 'Setup test repo' ' + setfacl -m u:root:rwx $dirs_to_set && + setfacl -d -m u:"$LOGNAME":rwx $dirs_to_set && + setfacl -d -m u:root:rwx $dirs_to_set && + + touch file.txt && + git add file.txt && + git commit -m "init" +' + +test_expect_success 'Objects creation does not break ACLs with restrictive umask' ' + # SHA1 for empty blob + check_perms_and_acl .git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +' + +test_expect_success 'git gc does not break ACLs with restrictive umask' ' + git gc && + check_perms_and_acl .git/objects/pack/*.pack +' + +test_done diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index a22632f483..49cae3ed52 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -66,12 +66,12 @@ tagger T A Gger <tagger@example.com> 1234567890 -0000 This is an invalid tag. EOF -test_expect_failure 'tag pointing to nonexistent' ' - tag=$(git hash-object -w --stdin < invalid-tag) && +test_expect_success 'tag pointing to nonexistent' ' + tag=$(git hash-object -t tag -w --stdin < invalid-tag) && echo $tag > .git/refs/tags/invalid && - git fsck --tags 2>out && + test_must_fail git fsck --tags >out && cat out && - grep "could not load tagged object" out && + grep "broken link" out && rm .git/refs/tags/invalid ' @@ -84,12 +84,12 @@ tagger T A Gger <tagger@example.com> 1234567890 -0000 This is an invalid tag. EOF -test_expect_failure 'tag pointing to something else than its type' ' - tag=$(git hash-object -w --stdin < wrong-tag) && +test_expect_success 'tag pointing to something else than its type' ' + tag=$(git hash-object -t tag -w --stdin < wrong-tag) && echo $tag > .git/refs/tags/wrong && - git fsck --tags 2>out && + test_must_fail git fsck --tags 2>out && cat out && - grep "some sane error message" out && + grep "error in tag.*broken links" out && rm .git/refs/tags/wrong ' diff --git a/t/t1509-root-worktree.sh b/t/t1509-root-worktree.sh new file mode 100755 index 0000000000..5322a3bf97 --- /dev/null +++ b/t/t1509-root-worktree.sh @@ -0,0 +1,249 @@ +#!/bin/sh + +test_description='Test Git when git repository is located at root + +This test requires write access in root. Do not bother if you do not +have a throwaway chroot or VM. + +Script t1509/prepare-chroot.sh may help you setup chroot, then you +can chroot in and execute this test from there. +' + +. ./test-lib.sh + +test_cmp_val() { + echo "$1" > expected + echo "$2" > result + test_cmp expected result +} + +test_vars() { + test_expect_success "$1: gitdir" ' + test_cmp_val "'"$2"'" "$(git rev-parse --git-dir)" + ' + + test_expect_success "$1: worktree" ' + test_cmp_val "'"$3"'" "$(git rev-parse --show-toplevel)" + ' + + test_expect_success "$1: prefix" ' + test_cmp_val "'"$4"'" "$(git rev-parse --show-prefix)" + ' +} + +test_foobar_root() { + test_expect_success 'add relative' ' + test -z "$(cd / && git ls-files)" && + git add foo/foome && + git add foo/bar/barme && + git add me && + ( cd / && git ls-files --stage ) > result && + test_cmp /ls.expected result && + rm "$(git rev-parse --git-dir)/index" + ' + + test_expect_success 'add absolute' ' + test -z "$(cd / && git ls-files)" && + git add /foo/foome && + git add /foo/bar/barme && + git add /me && + ( cd / && git ls-files --stage ) > result && + test_cmp /ls.expected result && + rm "$(git rev-parse --git-dir)/index" + ' + +} + +test_foobar_foo() { + test_expect_success 'add relative' ' + test -z "$(cd / && git ls-files)" && + git add foome && + git add bar/barme && + git add ../me && + ( cd / && git ls-files --stage ) > result && + test_cmp /ls.expected result && + rm "$(git rev-parse --git-dir)/index" + ' + + test_expect_success 'add absolute' ' + test -z "$(cd / && git ls-files)" && + git add /foo/foome && + git add /foo/bar/barme && + git add /me && + ( cd / && git ls-files --stage ) > result && + test_cmp /ls.expected result && + rm "$(git rev-parse --git-dir)/index" + ' +} + +test_foobar_foobar() { + test_expect_success 'add relative' ' + test -z "$(cd / && git ls-files)" && + git add ../foome && + git add barme && + git add ../../me && + ( cd / && git ls-files --stage ) > result && + test_cmp /ls.expected result && + rm "$(git rev-parse --git-dir)/index" + ' + + test_expect_success 'add absolute' ' + test -z "$(cd / && git ls-files)" && + git add /foo/foome && + git add /foo/bar/barme && + git add /me && + ( cd / && git ls-files --stage ) > result && + test_cmp /ls.expected result && + rm "$(git rev-parse --git-dir)/index" + ' +} + +if ! test_have_prereq POSIXPERM || ! [ -w / ]; then + say "Dangerous test skipped. Read this test if you want to execute it" + test_done +fi + +if [ "$IKNOWWHATIAMDOING" != "YES" ]; then + say "You must set env var IKNOWWHATIAMDOING=YES in order to run this test" + test_done +fi + +if [ "$UID" = 0 ]; then + say "No you can't run this with root" + test_done +fi + +ONE_SHA1=d00491fd7e5bb6fa28c517a0bb32b8b506539d4d + +test_expect_success 'setup' ' + rm -rf /foo + mkdir /foo && + mkdir /foo/bar && + echo 1 > /foo/foome && + echo 1 > /foo/bar/barme && + echo 1 > /me +' + +say "GIT_DIR absolute, GIT_WORK_TREE set" + +test_expect_success 'go to /' 'cd /' + +cat >ls.expected <<EOF +100644 $ONE_SHA1 0 foo/bar/barme +100644 $ONE_SHA1 0 foo/foome +100644 $ONE_SHA1 0 me +EOF + +export GIT_DIR="$TRASH_DIRECTORY/.git" +export GIT_WORK_TREE=/ + +test_vars 'abs gitdir, root' "$GIT_DIR" "/" "" +test_foobar_root + +test_expect_success 'go to /foo' 'cd /foo' + +test_vars 'abs gitdir, foo' "$GIT_DIR" "/" "foo/" +test_foobar_foo + +test_expect_success 'go to /foo/bar' 'cd /foo/bar' + +test_vars 'abs gitdir, foo/bar' "$GIT_DIR" "/" "foo/bar/" +test_foobar_foobar + +say "GIT_DIR relative, GIT_WORK_TREE set" + +test_expect_success 'go to /' 'cd /' + +export GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" +export GIT_WORK_TREE=/ + +test_vars 'rel gitdir, root' "$GIT_DIR" "/" "" +test_foobar_root + +test_expect_success 'go to /foo' 'cd /foo' + +export GIT_DIR="../$TRASH_DIRECTORY/.git" +export GIT_WORK_TREE=/ + +test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/" +test_foobar_foo + +test_expect_success 'go to /foo/bar' 'cd /foo/bar' + +export GIT_DIR="../../$TRASH_DIRECTORY/.git" +export GIT_WORK_TREE=/ + +test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/" +test_foobar_foobar + +say "GIT_DIR relative, GIT_WORK_TREE relative" + +test_expect_success 'go to /' 'cd /' + +export GIT_DIR="$(echo $TRASH_DIRECTORY|sed 's,^/,,')/.git" +export GIT_WORK_TREE=. + +test_vars 'rel gitdir, root' "$GIT_DIR" "/" "" +test_foobar_root + +test_expect_success 'go to /' 'cd /foo' + +export GIT_DIR="../$TRASH_DIRECTORY/.git" +export GIT_WORK_TREE=.. + +test_vars 'rel gitdir, foo' "$TRASH_DIRECTORY/.git" "/" "foo/" +test_foobar_foo + +test_expect_success 'go to /foo/bar' 'cd /foo/bar' + +export GIT_DIR="../../$TRASH_DIRECTORY/.git" +export GIT_WORK_TREE=../.. + +test_vars 'rel gitdir, foo/bar' "$TRASH_DIRECTORY/.git" "/" "foo/bar/" +test_foobar_foobar + +say ".git at root" + +unset GIT_DIR +unset GIT_WORK_TREE + +test_expect_success 'go to /' 'cd /' +test_expect_success 'setup' ' + rm -rf /.git + echo "Initialized empty Git repository in /.git/" > expected && + git init > result && + test_cmp expected result +' + +test_vars 'auto gitdir, root' ".git" "/" "" +test_foobar_root + +test_expect_success 'go to /foo' 'cd /foo' +test_vars 'auto gitdir, foo' "/.git" "/" "foo/" +test_foobar_foo + +test_expect_success 'go to /foo/bar' 'cd /foo/bar' +test_vars 'auto gitdir, foo/bar' "/.git" "/" "foo/bar/" +test_foobar_foobar + +test_expect_success 'cleanup' 'rm -rf /.git' + +say "auto bare gitdir" + +# DESTROYYYYY!!!!! +test_expect_success 'setup' ' + rm -rf /refs /objects /info /hooks + rm /* + cd / && + echo "Initialized empty Git repository in /" > expected && + git init --bare > result && + test_cmp expected result +' + +test_vars 'auto gitdir, root' "." "" "" + +test_expect_success 'go to /foo' 'cd /foo' + +test_vars 'auto gitdir, root' "/" "" "" + +test_done diff --git a/t/t1509/excludes b/t/t1509/excludes new file mode 100644 index 0000000000..d4d21d31a9 --- /dev/null +++ b/t/t1509/excludes @@ -0,0 +1,14 @@ +*.o +*~ +*.bak +*.c +*.h +.git +contrib +Documentation +git-gui +gitk-git +gitweb +t/t4013 +t/t5100 +t/t5515 diff --git a/t/t1509/prepare-chroot.sh b/t/t1509/prepare-chroot.sh new file mode 100755 index 0000000000..c5334a8fa4 --- /dev/null +++ b/t/t1509/prepare-chroot.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +die() { + echo >&2 "$@" + exit 1 +} + +xmkdir() { + while [ -n "$1" ]; do + [ -d "$1" ] || mkdir "$1" || die "Unable to mkdir $1" + shift + done +} + +R="$1" + +[ -n "$R" ] || die "Usage: prepare-chroot.sh <root>" +[ -x git ] || die "This script needs to be executed at git source code's top directory" +[ -x /bin/busybox ] || die "You need busybox" + +xmkdir "$R" "$R/bin" "$R/etc" "$R/lib" "$R/dev" +[ -c "$R/dev/null" ] || die "/dev/null is missing. Do mknod $R/dev/null c 1 3 && chmod 666 $R/dev/null" +echo "root:x:0:0:root:/:/bin/sh" > "$R/etc/passwd" +echo "$(id -nu):x:$(id -u):$(id -g)::$(pwd)/t:/bin/sh" >> "$R/etc/passwd" +echo "root::0:root" > "$R/etc/group" +echo "$(id -ng)::$(id -g):$(id -nu)" >> "$R/etc/group" + +[ -x "$R/bin/busybox" ] || cp /bin/busybox "$R/bin/busybox" +[ -x "$R/bin/sh" ] || ln -s /bin/busybox "$R/bin/sh" +[ -x "$R/bin/su" ] || ln -s /bin/busybox "$R/bin/su" + +mkdir -p "$R$(pwd)" +rsync --exclude-from t/t1509/excludes -Ha . "$R$(pwd)" +ldd git | grep '/' | sed 's,.*\s\(/[^ ]*\).*,\1,' | while read i; do + mkdir -p "$R$(dirname $i)" + cp "$i" "$R/$i" +done +echo "Execute this in root: 'chroot $R /bin/su - $(id -nu)'" diff --git a/t/t2016-checkout-patch.sh b/t/t2016-checkout-patch.sh index 4d1c2e9e09..2144184d79 100755 --- a/t/t2016-checkout-patch.sh +++ b/t/t2016-checkout-patch.sh @@ -66,6 +66,14 @@ test_expect_success 'git checkout -p HEAD^' ' verify_state dir/foo parent parent ' +test_expect_success 'git checkout -p handles deletion' ' + set_state dir/foo work index && + rm dir/foo && + (echo n; echo y) | git checkout -p && + verify_saved_state bar && + verify_state dir/foo index index +' + # The idea in the rest is that bar sorts first, so we always say 'y' # first and if the path limiter fails it'll apply to bar instead of # dir/foo. There's always an extra 'n' to reject edits to dir/foo in diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index 5d9604b815..714626d2d6 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -8,6 +8,7 @@ test_description='Test commit notes' . ./test-lib.sh cat > fake_editor.sh << \EOF +#!/bin/sh echo "$MSG" > "$1" echo "$MSG" >& 2 EOF diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index 76b1bb4545..0aaf0ad84b 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -271,4 +271,12 @@ test_expect_success 'choking "git rm" should not let it die with cruft' ' test "$status" != 0 ' +test_expect_success 'rm removes subdirectories recursively' ' + mkdir -p dir/subdir/subsubdir && + echo content >dir/subdir/subsubdir/file && + git add dir/subdir/subsubdir/file && + git rm -f dir/subdir/subsubdir/file && + ! test -d dir +' + test_done diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 5514f74b30..476e5ec038 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -194,6 +194,15 @@ test_expect_success 'pop -q is quiet' ' test ! -s output.out ' +test_expect_success 'pop -q --index works and is quiet' ' + echo foo > file && + git add file && + git stash save --quiet && + git stash pop -q --index > output.out 2>&1 && + test foo = "$(git show :file)" && + test ! -s output.out +' + test_expect_success 'drop -q is quiet' ' git stash && git stash drop -q > output.out 2>&1 && diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh index 60dd2014d5..0391a5827e 100755 --- a/t/t4017-diff-retval.sh +++ b/t/t4017-diff-retval.sh @@ -5,6 +5,9 @@ test_description='Return value of diffs' . ./test-lib.sh test_expect_success 'setup' ' + echo "1 " >a && + git add . && + git commit -m zeroth && echo 1 >a && git add . && git commit -m first && @@ -13,6 +16,18 @@ test_expect_success 'setup' ' git commit -a -m second ' +test_expect_success 'git diff --quiet -w HEAD^^ HEAD^' ' + git diff --quiet -w HEAD^^ HEAD^ +' + +test_expect_success 'git diff --quiet HEAD^^ HEAD^' ' + test_must_fail git diff --quiet HEAD^^ HEAD^ +' + +test_expect_success 'git diff --quiet -w HEAD^ HEAD' ' + test_must_fail git diff --quiet -w HEAD^ HEAD +' + test_expect_success 'git diff-tree HEAD^ HEAD' ' git diff-tree --exit-code HEAD^ HEAD test $? = 1 diff --git a/t/t5100/msg0015 b/t/t5100/msg0015 index 9577238685..4abb3d5c6c 100644 --- a/t/t5100/msg0015 +++ b/t/t5100/msg0015 @@ -1,2 +1,2 @@ -- a list + - a list - of stuff diff --git a/t/t5401-update-hooks.sh b/t/t5401-update-hooks.sh index 325714e529..17bcb0b040 100755 --- a/t/t5401-update-hooks.sh +++ b/t/t5401-update-hooks.sh @@ -17,23 +17,22 @@ test_expect_success setup ' commit1=$(echo modify | git commit-tree $tree1 -p $commit0) && git update-ref refs/heads/master $commit0 && git update-ref refs/heads/tofail $commit1 && - git clone ./. victim && - GIT_DIR=victim/.git git config receive.denyCurrentBranch warn && - GIT_DIR=victim/.git git update-ref refs/heads/tofail $commit1 && + git clone --bare ./. victim.git && + GIT_DIR=victim.git git update-ref refs/heads/tofail $commit1 && git update-ref refs/heads/master $commit1 && git update-ref refs/heads/tofail $commit0 ' -cat >victim/.git/hooks/pre-receive <<'EOF' +cat >victim.git/hooks/pre-receive <<'EOF' #!/bin/sh printf %s "$@" >>$GIT_DIR/pre-receive.args cat - >$GIT_DIR/pre-receive.stdin echo STDOUT pre-receive echo STDERR pre-receive >&2 EOF -chmod u+x victim/.git/hooks/pre-receive +chmod u+x victim.git/hooks/pre-receive -cat >victim/.git/hooks/update <<'EOF' +cat >victim.git/hooks/update <<'EOF' #!/bin/sh echo "$@" >>$GIT_DIR/update.args read x; printf %s "$x" >$GIT_DIR/update.stdin @@ -41,77 +40,77 @@ echo STDOUT update $1 echo STDERR update $1 >&2 test "$1" = refs/heads/master || exit EOF -chmod u+x victim/.git/hooks/update +chmod u+x victim.git/hooks/update -cat >victim/.git/hooks/post-receive <<'EOF' +cat >victim.git/hooks/post-receive <<'EOF' #!/bin/sh printf %s "$@" >>$GIT_DIR/post-receive.args cat - >$GIT_DIR/post-receive.stdin echo STDOUT post-receive echo STDERR post-receive >&2 EOF -chmod u+x victim/.git/hooks/post-receive +chmod u+x victim.git/hooks/post-receive -cat >victim/.git/hooks/post-update <<'EOF' +cat >victim.git/hooks/post-update <<'EOF' #!/bin/sh echo "$@" >>$GIT_DIR/post-update.args read x; printf %s "$x" >$GIT_DIR/post-update.stdin echo STDOUT post-update echo STDERR post-update >&2 EOF -chmod u+x victim/.git/hooks/post-update +chmod u+x victim.git/hooks/post-update test_expect_success push ' - test_must_fail git send-pack --force ./victim/.git \ + test_must_fail git send-pack --force ./victim.git \ master tofail >send.out 2>send.err ' test_expect_success 'updated as expected' ' - test $(GIT_DIR=victim/.git git rev-parse master) = $commit1 && - test $(GIT_DIR=victim/.git git rev-parse tofail) = $commit1 + test $(GIT_DIR=victim.git git rev-parse master) = $commit1 && + test $(GIT_DIR=victim.git git rev-parse tofail) = $commit1 ' test_expect_success 'hooks ran' ' - test -f victim/.git/pre-receive.args && - test -f victim/.git/pre-receive.stdin && - test -f victim/.git/update.args && - test -f victim/.git/update.stdin && - test -f victim/.git/post-receive.args && - test -f victim/.git/post-receive.stdin && - test -f victim/.git/post-update.args && - test -f victim/.git/post-update.stdin + test -f victim.git/pre-receive.args && + test -f victim.git/pre-receive.stdin && + test -f victim.git/update.args && + test -f victim.git/update.stdin && + test -f victim.git/post-receive.args && + test -f victim.git/post-receive.stdin && + test -f victim.git/post-update.args && + test -f victim.git/post-update.stdin ' test_expect_success 'pre-receive hook input' ' (echo $commit0 $commit1 refs/heads/master; echo $commit1 $commit0 refs/heads/tofail - ) | test_cmp - victim/.git/pre-receive.stdin + ) | test_cmp - victim.git/pre-receive.stdin ' test_expect_success 'update hook arguments' ' (echo refs/heads/master $commit0 $commit1; echo refs/heads/tofail $commit1 $commit0 - ) | test_cmp - victim/.git/update.args + ) | test_cmp - victim.git/update.args ' test_expect_success 'post-receive hook input' ' echo $commit0 $commit1 refs/heads/master | - test_cmp - victim/.git/post-receive.stdin + test_cmp - victim.git/post-receive.stdin ' test_expect_success 'post-update hook arguments' ' echo refs/heads/master | - test_cmp - victim/.git/post-update.args + test_cmp - victim.git/post-update.args ' test_expect_success 'all hook stdin is /dev/null' ' - ! test -s victim/.git/update.stdin && - ! test -s victim/.git/post-update.stdin + ! test -s victim.git/update.stdin && + ! test -s victim.git/post-update.stdin ' test_expect_success 'all *-receive hook args are empty' ' - ! test -s victim/.git/pre-receive.args && - ! test -s victim/.git/post-receive.args + ! test -s victim.git/pre-receive.args && + ! test -s victim.git/post-receive.args ' test_expect_success 'send-pack produced no output' ' @@ -119,20 +118,21 @@ test_expect_success 'send-pack produced no output' ' ' cat <<EOF >expect -STDOUT pre-receive -STDERR pre-receive -STDOUT update refs/heads/master -STDERR update refs/heads/master -STDOUT update refs/heads/tofail -STDERR update refs/heads/tofail -STDOUT post-receive -STDERR post-receive -STDOUT post-update -STDERR post-update +remote: STDOUT pre-receive +remote: STDERR pre-receive +remote: STDOUT update refs/heads/master +remote: STDERR update refs/heads/master +remote: STDOUT update refs/heads/tofail +remote: STDERR update refs/heads/tofail +remote: error: hook declined to update refs/heads/tofail +remote: STDOUT post-receive +remote: STDERR post-receive +remote: STDOUT post-update +remote: STDERR post-update EOF test_expect_success 'send-pack stderr contains hook messages' ' - grep ^STD send.err >actual && - test_cmp - actual <expect + grep ^remote: send.err | sed "s/ *\$//" >actual && + test_cmp expect actual ' test_done diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 169af1edde..721821ec92 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -341,6 +341,13 @@ test_expect_success 'fetch into the current branch with --update-head-ok' ' ' +test_expect_success 'fetch --dry-run' ' + + rm -f .git/FETCH_HEAD && + git fetch --dry-run . && + ! test -f .git/FETCH_HEAD +' + test_expect_success "should be able to fetch with duplicate refspecs" ' mkdir dups && cd dups && diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh index 83e2e8ab80..1b06691bb4 100755 --- a/t/t5521-pull-options.sh +++ b/t/t5521-pull-options.sh @@ -4,8 +4,6 @@ test_description='pull options' . ./test-lib.sh -D=`pwd` - test_expect_success 'setup' ' mkdir parent && (cd parent && git init && @@ -13,48 +11,83 @@ test_expect_success 'setup' ' git commit -m one) ' -cd "$D" - test_expect_success 'git pull -q' ' mkdir clonedq && - cd clonedq && - git pull -q "$D/parent" >out 2>err && - test ! -s out + (cd clonedq && git init && + git pull -q "../parent" >out 2>err && + test ! -s err && + test ! -s out) ' -cd "$D" - test_expect_success 'git pull' ' mkdir cloned && - cd cloned && - git pull "$D/parent" >out 2>err && - test -s out + (cd cloned && git init && + git pull "../parent" >out 2>err && + test -s err && + test ! -s out) ' -cd "$D" test_expect_success 'git pull -v' ' mkdir clonedv && - cd clonedv && - git pull -v "$D/parent" >out 2>err && - test -s out + (cd clonedv && git init && + git pull -v "../parent" >out 2>err && + test -s err && + test ! -s out) ' -cd "$D" - test_expect_success 'git pull -v -q' ' mkdir clonedvq && - cd clonedvq && - git pull -v -q "$D/parent" >out 2>err && - test ! -s out + (cd clonedvq && git init && + git pull -v -q "../parent" >out 2>err && + test ! -s out && + test ! -s err) ' -cd "$D" - test_expect_success 'git pull -q -v' ' mkdir clonedqv && - cd clonedqv && - git pull -q -v "$D/parent" >out 2>err && - test -s out + (cd clonedqv && git init && + git pull -q -v "../parent" >out 2>err && + test ! -s out && + test -s err) +' + +test_expect_success 'git pull --force' ' + mkdir clonedoldstyle && + (cd clonedoldstyle && git init && + cat >>.git/config <<-\EOF && + [remote "one"] + url = ../parent + fetch = refs/heads/master:refs/heads/mirror + [remote "two"] + url = ../parent + fetch = refs/heads/master:refs/heads/origin + [branch "master"] + remote = two + merge = refs/heads/master + EOF + git pull two && + test_commit A && + git branch -f origin && + git pull --all --force + ) +' + +test_expect_success 'git pull --all' ' + mkdir clonedmulti && + (cd clonedmulti && git init && + cat >>.git/config <<-\EOF && + [remote "one"] + url = ../parent + fetch = refs/heads/*:refs/remotes/one/* + [remote "two"] + url = ../parent + fetch = refs/heads/*:refs/remotes/two/* + [branch "master"] + remote = one + merge = refs/heads/master + EOF + git pull --all + ) ' test_done diff --git a/t/t6000lib.sh b/t/t6000lib.sh index f55627b641..985d517a1c 100755..100644 --- a/t/t6000lib.sh +++ b/t/t6000lib.sh @@ -1,3 +1,5 @@ +: included from 6002 and others + [ -d .git/refs/tags ] || mkdir -p .git/refs/tags :> sed.script diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index 6291307cd0..d605024cf8 100755 --- a/t/t6023-merge-file.sh +++ b/t/t6023-merge-file.sh @@ -64,6 +64,10 @@ cp new1.txt test.txt test_expect_success "merge without conflict" \ "git merge-file test.txt orig.txt new2.txt" +cp new1.txt test.txt +test_expect_success "merge without conflict (--quiet)" \ + "git merge-file --quiet test.txt orig.txt new2.txt" + cp new1.txt test2.txt test_expect_success "merge without conflict (missing LF at EOF)" \ "git merge-file test2.txt orig.txt new2.txt" diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index c51865fdbc..3b042aacd6 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -567,6 +567,11 @@ test_expect_success 'skipping away from skipped commit' ' test "$para3" = "$PARA_HASH3" ' +test_expect_success 'erroring out when using bad path parameters' ' + test_must_fail git bisect start $PARA_HASH7 $HASH1 -- foobar 2> error.txt && + grep "bad path parameters" error.txt +' + # # test_done diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index 7144f815c0..e249c3ed41 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -353,7 +353,7 @@ test_expect_success 'log grep (4)' ' ' test_expect_success 'log grep (5)' ' - git log --author=Thor -F --grep=Thu --pretty=tformat:%s >actual && + git log --author=Thor -F --pretty=tformat:%s >actual && ( echo third ; echo initial ) >expect && test_cmp expect actual ' @@ -364,6 +364,14 @@ test_expect_success 'log grep (6)' ' test_cmp expect actual ' +test_expect_success 'log --grep --author implicitly uses all-match' ' + # grep matches initial and second but not third + # author matches only initial and third + git log --author="A U Thor" --grep=s --grep=l --format=%s >actual && + echo initial >expect && + test_cmp expect actual +' + test_expect_success 'grep with CE_VALID file' ' git update-index --assume-unchanged t/t && rm t/t && @@ -434,4 +442,89 @@ test_expect_success 'grep -Fi' ' test_cmp expected actual ' +test_expect_success 'outside of git repository' ' + rm -fr non && + mkdir -p non/git/sub && + echo hello >non/git/file1 && + echo world >non/git/sub/file2 && + echo ".*o*" >non/git/.gitignore && + { + echo file1:hello && + echo sub/file2:world + } >non/expect.full && + echo file2:world >non/expect.sub + ( + GIT_CEILING_DIRECTORIES="$(pwd)/non/git" && + export GIT_CEILING_DIRECTORIES && + cd non/git && + test_must_fail git grep o && + git grep --no-index o >../actual.full && + test_cmp ../expect.full ../actual.full + cd sub && + test_must_fail git grep o && + git grep --no-index o >../../actual.sub && + test_cmp ../../expect.sub ../../actual.sub + ) +' + +test_expect_success 'inside git repository but with --no-index' ' + rm -fr is && + mkdir -p is/git/sub && + echo hello >is/git/file1 && + echo world >is/git/sub/file2 && + echo ".*o*" >is/git/.gitignore && + { + echo file1:hello && + echo sub/file2:world + } >is/expect.full && + : >is/expect.empty && + echo file2:world >is/expect.sub + ( + cd is/git && + git init && + test_must_fail git grep o >../actual.full && + test_cmp ../expect.empty ../actual.full && + git grep --no-index o >../actual.full && + test_cmp ../expect.full ../actual.full && + cd sub && + test_must_fail git grep o >../../actual.sub && + test_cmp ../../expect.empty ../../actual.sub && + git grep --no-index o >../../actual.sub && + test_cmp ../../expect.sub ../../actual.sub + ) +' + +test_expect_success 'setup double-dash tests' ' +cat >double-dash <<EOF && +-- +-> +other +EOF +git add double-dash +' + +cat >expected <<EOF +double-dash:-> +EOF +test_expect_success 'grep -- pattern' ' + git grep -- "->" >actual && + test_cmp expected actual +' +test_expect_success 'grep -- pattern -- pathspec' ' + git grep -- "->" -- double-dash >actual && + test_cmp expected actual +' +test_expect_success 'grep -e pattern -- path' ' + git grep -e "->" -- double-dash >actual && + test_cmp expected actual +' + +cat >expected <<EOF +double-dash:-- +EOF +test_expect_success 'grep -e -- -- path' ' + git grep -e -- -- double-dash >actual && + test_cmp expected actual +' + test_done diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh new file mode 100755 index 0000000000..d9202d5af5 --- /dev/null +++ b/t/t7006-pager.sh @@ -0,0 +1,176 @@ +#!/bin/sh + +test_description='Test automatic use of a pager.' + +. ./test-lib.sh + +rm -f stdout_is_tty +test_expect_success 'set up terminal for tests' ' + if test -t 1 + then + : > stdout_is_tty + elif + test_have_prereq PERL && + "$PERL_PATH" "$TEST_DIRECTORY"/t7006/test-terminal.perl \ + sh -c "test -t 1" + then + : > test_terminal_works + fi +' + +if test -e stdout_is_tty +then + test_terminal() { "$@"; } + test_set_prereq TTY +elif test -e test_terminal_works +then + test_terminal() { + "$PERL_PATH" "$TEST_DIRECTORY"/t7006/test-terminal.perl "$@" + } + test_set_prereq TTY +else + say no usable terminal, so skipping some tests +fi + +unset GIT_PAGER GIT_PAGER_IN_USE +git config --unset core.pager +PAGER='cat > paginated.out' +export PAGER + +test_expect_success 'setup' ' + test_commit initial +' + +rm -f paginated.out +test_expect_success TTY 'some commands use a pager' ' + test_terminal git log && + test -e paginated.out +' + +rm -f paginated.out +test_expect_success TTY 'some commands do not use a pager' ' + test_terminal git rev-list HEAD && + ! test -e paginated.out +' + +rm -f paginated.out +test_expect_success 'no pager when stdout is a pipe' ' + git log | cat && + ! test -e paginated.out +' + +rm -f paginated.out +test_expect_success 'no pager when stdout is a regular file' ' + git log > file && + ! test -e paginated.out +' + +rm -f paginated.out +test_expect_success TTY 'git --paginate rev-list uses a pager' ' + test_terminal git --paginate rev-list HEAD && + test -e paginated.out +' + +rm -f file paginated.out +test_expect_success 'no pager even with --paginate when stdout is a pipe' ' + git --paginate log | cat && + ! test -e paginated.out +' + +rm -f paginated.out +test_expect_success TTY 'no pager with --no-pager' ' + test_terminal git --no-pager log && + ! test -e paginated.out +' + +# A colored commit log will begin with an appropriate ANSI escape +# for the first color; the text "commit" comes later. +colorful() { + read firstline < $1 + ! expr "$firstline" : "^[a-zA-Z]" >/dev/null +} + +rm -f colorful.log colorless.log +test_expect_success 'tests can detect color' ' + git log --no-color > colorless.log && + git log --color > colorful.log && + ! colorful colorless.log && + colorful colorful.log +' + +rm -f colorless.log +git config color.ui auto +test_expect_success 'no color when stdout is a regular file' ' + git log > colorless.log && + ! colorful colorless.log +' + +rm -f paginated.out +git config color.ui auto +test_expect_success TTY 'color when writing to a pager' ' + TERM=vt100 test_terminal git log && + colorful paginated.out +' + +rm -f colorful.log +git config color.ui auto +test_expect_success 'color when writing to a file intended for a pager' ' + TERM=vt100 GIT_PAGER_IN_USE=true git log > colorful.log && + colorful colorful.log +' + +unset PAGER GIT_PAGER +git config --unset core.pager +test_expect_success 'determine default pager' ' + less=$(git var GIT_PAGER) && + test -n "$less" +' + +if expr "$less" : '^[a-z]*$' > /dev/null && test_have_prereq TTY +then + test_set_prereq SIMPLEPAGER +fi + +unset PAGER GIT_PAGER +git config --unset core.pager +rm -f default_pager_used +test_expect_success SIMPLEPAGER 'default pager is used by default' ' + cat > $less <<-EOF && + #!$SHELL_PATH + wc > default_pager_used + EOF + chmod +x $less && + PATH=.:$PATH test_terminal git log && + test -e default_pager_used +' + +unset GIT_PAGER +git config --unset core.pager +rm -f PAGER_used +test_expect_success TTY 'PAGER overrides default pager' ' + PAGER="wc > PAGER_used" && + export PAGER && + test_terminal git log && + test -e PAGER_used +' + +unset GIT_PAGER +rm -f core.pager_used +test_expect_success TTY 'core.pager overrides PAGER' ' + PAGER=wc && + export PAGER && + git config core.pager "wc > core.pager_used" && + test_terminal git log && + test -e core.pager_used +' + +rm -f GIT_PAGER_used +test_expect_success TTY 'GIT_PAGER overrides core.pager' ' + git config core.pager wc && + GIT_PAGER="wc > GIT_PAGER_used" && + export GIT_PAGER && + test_terminal git log && + test -e GIT_PAGER_used +' + +test_done diff --git a/t/t7006/test-terminal.perl b/t/t7006/test-terminal.perl new file mode 100755 index 0000000000..73ff809371 --- /dev/null +++ b/t/t7006/test-terminal.perl @@ -0,0 +1,58 @@ +#!/usr/bin/perl +use strict; +use warnings; +use IO::Pty; +use File::Copy; + +# Run @$argv in the background with stdout redirected to $out. +sub start_child { + my ($argv, $out) = @_; + my $pid = fork; + if (not defined $pid) { + die "fork failed: $!" + } elsif ($pid == 0) { + open STDOUT, ">&", $out; + close $out; + exec(@$argv) or die "cannot exec '$argv->[0]': $!" + } + return $pid; +} + +# Wait for $pid to finish. +sub finish_child { + # Simplified from wait_or_whine() in run-command.c. + my ($pid) = @_; + + my $waiting = waitpid($pid, 0); + if ($waiting < 0) { + die "waitpid failed: $!"; + } elsif ($? & 127) { + my $code = $? & 127; + warn "died of signal $code"; + return $code - 128; + } else { + return $? >> 8; + } +} + +sub xsendfile { + my ($out, $in) = @_; + + # Note: the real sendfile() cannot read from a terminal. + + # It is unspecified by POSIX whether reads + # from a disconnected terminal will return + # EIO (as in AIX 4.x, IRIX, and Linux) or + # end-of-file. Either is fine. + copy($in, $out, 4096) or $!{EIO} or die "cannot copy from child: $!"; +} + +if ($#ARGV < 1) { + die "usage: test-terminal program args"; +} +my $master = new IO::Pty; +my $slave = $master->slave; +my $pid = start_child(\@ARGV, $slave); +close $slave; +xsendfile(\*STDOUT, $master); +exit(finish_child($pid)); diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 6442f710be..d20ed61b48 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -166,19 +166,31 @@ test_expect_success 'checkout -m with merge conflict' ' ! test -s current ' -test_expect_success 'checkout to detach HEAD' ' +test_expect_success 'checkout to detach HEAD (with advice declined)' ' + git config advice.detachedHead false && git checkout -f renamer && git clean -f && git checkout renamer^ 2>messages && - (cat >messages.expect <<EOF -Note: moving to '\''renamer^'\'' which isn'\''t a local branch -If you want to create a new branch from this checkout, you may do so -(now or later) by using -b with the checkout command again. Example: - git checkout -b <new_branch_name> -HEAD is now at 7329388... Initial A one, A two -EOF -) && - test_cmp messages.expect messages && + grep "HEAD is now at 7329388" messages && + test 1 -eq $(wc -l <messages) && + H=$(git rev-parse --verify HEAD) && + M=$(git show-ref -s --verify refs/heads/master) && + test "z$H" = "z$M" && + if git symbolic-ref HEAD >/dev/null 2>&1 + then + echo "OOPS, HEAD is still symbolic???" + false + else + : happy + fi +' + +test_expect_success 'checkout to detach HEAD' ' + git config advice.detachedHead true && + git checkout -f renamer && git clean -f && + git checkout renamer^ 2>messages && + grep "HEAD is now at 7329388" messages && + test 1 -lt $(wc -l <messages) && H=$(git rev-parse --verify HEAD) && M=$(git show-ref -s --verify refs/heads/master) && test "z$H" = "z$M" && diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh index d3c039f724..cee319da0a 100755 --- a/t/t7401-submodule-summary.sh +++ b/t/t7401-submodule-summary.sh @@ -227,4 +227,11 @@ test_expect_success 'fail when using --files together with --cached' " test_must_fail git submodule summary --files --cached " +test_expect_success 'should not fail in an empty repo' " + git init xyzzy && + cd xyzzy && + git submodule summary >output 2>&1 && + test_cmp output /dev/null +" + test_done diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index 8e2449d244..1382a8e58a 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -28,6 +28,8 @@ test_expect_success 'setup a submodule tree' ' git commit -m upstream git clone . super && git clone super submodule && + git clone super rebasing && + git clone super merging && (cd super && git submodule add ../submodule submodule && test_tick && @@ -45,6 +47,16 @@ test_expect_success 'setup a submodule tree' ' ) && git add submodule && git commit -m "submodule update" + ) && + (cd super && + git submodule add ../rebasing rebasing && + test_tick && + git commit -m "rebasing" + ) && + (cd super && + git submodule add ../merging merging && + test_tick && + git commit -m "rebasing" ) ' @@ -177,21 +189,17 @@ test_expect_success 'submodule update - checkout in .git/config' ' test_expect_success 'submodule init picks up rebase' ' (cd super && - git config submodule.rebasing.url git://non-existing/git && - git config submodule.rebasing.path does-not-matter && - git config submodule.rebasing.update rebase && + git config -f .gitmodules submodule.rebasing.update rebase && git submodule init rebasing && - test "rebase" = $(git config submodule.rebasing.update) + test "rebase" = "$(git config submodule.rebasing.update)" ) ' test_expect_success 'submodule init picks up merge' ' (cd super && - git config submodule.merging.url git://non-existing/git && - git config submodule.merging.path does-not-matter && - git config submodule.merging.update merge && + git config -f .gitmodules submodule.merging.update merge && git submodule init merging && - test "merge" = $(git config submodule.merging.update) + test "merge" = "$(git config submodule.merging.update)" ) ' diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh index 95741cbbac..a9a558d292 100755 --- a/t/t9119-git-svn-info.sh +++ b/t/t9119-git-svn-info.sh @@ -7,9 +7,10 @@ test_description='git svn info' . ./lib-git-svn.sh # Tested with: svn, version 1.4.4 (r25188) +# Tested with: svn, version 1.6.[12345689] v=`svn_cmd --version | sed -n -e 's/^svn, version \(1\.[0-9]*\.[0-9]*\).*$/\1/p'` case $v in -1.[45].*) +1.[456].*) ;; *) say "skipping svn-info test (SVN version: $v not supported)" diff --git a/t/t9151-svn-mergeinfo.sh b/t/t9151-svn-mergeinfo.sh index 3569c62096..16408244d2 100755 --- a/t/t9151-svn-mergeinfo.sh +++ b/t/t9151-svn-mergeinfo.sh @@ -33,6 +33,21 @@ test_expect_success 'svn non-merge merge commits did not become git merge commit [ -z "$bad_non_merges" ] ' +test_expect_success 'commit made to merged branch is reachable from the merge' ' + before_commit=$(git rev-list --all --grep="trunk commit before merging trunk to b2") + merge_commit=$(git rev-list --all --grep="Merge trunk to b2") + not_reachable=$(git rev-list -1 $before_commit --not $merge_commit) + [ -z "$not_reachable" ] + ' + +test_expect_success 'merging two branches in one commit is detected correctly' ' + f1_commit=$(git rev-list --all --grep="make f1 branch from trunk") + f2_commit=$(git rev-list --all --grep="make f2 branch from trunk") + merge_commit=$(git rev-list --all --grep="Merge f1 and f2 to trunk") + not_reachable=$(git rev-list -1 $f1_commit $f2_commit --not $merge_commit) + [ -z "$not_reachable" ] + ' + test_expect_failure 'everything got merged in the end' ' unmerged=$(git rev-list --all --not master) [ -z "$unmerged" ] diff --git a/t/t9151/make-svnmerge-dump b/t/t9151/make-svnmerge-dump index 3d73f140f8..e1e138cb1a 100644 --- a/t/t9151/make-svnmerge-dump +++ b/t/t9151/make-svnmerge-dump @@ -156,6 +156,89 @@ svn merge ../branches/right --accept postpone i=$(commit $i "non-merge right to trunk 2") cd .. +say "Branching b1 from trunk" +svn update +svn cp trunk branches/b1 +i=$(commit $i "make b1 branch from trunk") + +say "Branching b2 from trunk" +svn update +svn cp trunk branches/b2 +i=$(commit $i "make b2 branch from trunk") + +say "Make a commit to b2" +svn update +cd branches/b2 +echo "b2" > b2file +svn add b2file +i=$(commit $i "b2 update 1") +cd ../.. + +say "Make a commit to b1" +svn update +cd branches/b1 +echo "b1" > b1file +svn add b1file +i=$(commit $i "b1 update 1") +cd ../.. + +say "Merge b1 to trunk" +svn update +cd trunk +svn merge ../branches/b1/ --accept postpone +i=$(commit $i "Merge b1 to trunk") +cd .. + +say "Make a commit to trunk before merging trunk to b2" +svn update +cd trunk +echo "trunk" > trunkfile +svn add trunkfile +i=$(commit $i "trunk commit before merging trunk to b2") +cd .. + +say "Merge trunk to b2" +svn update +cd branches/b2 +svn merge ../../trunk/ --accept postpone +i=$(commit $i "Merge trunk to b2") +cd ../.. + +say "Merge b2 to trunk" +svn update +cd trunk +svn merge ../branches/b2/ --accept postpone +svn resolved b1file +svn resolved trunkfile +i=$(commit $i "Merge b2 to trunk") +cd .. + +say "Creating f1 from trunk with a new file" +svn update +svn cp trunk branches/f1 +cd branches/f1 +echo "f1" > f1file +svn add f1file +cd ../.. +i=$(commit $i "make f1 branch from trunk with a new file") + +say "Creating f2 from trunk with a new file" +svn update +svn cp trunk branches/f2 +cd branches/f2 +echo "f2" > f2file +svn add f2file +cd ../.. +i=$(commit $i "make f2 branch from trunk with a new file") + +say "Merge f1 and f2 to trunk in one go" +svn update +cd trunk +svn merge ../branches/f1/ --accept postpone +svn merge ../branches/f2/ --accept postpone +i=$(commit $i "Merge f1 and f2 to trunk") +cd .. + say "Adding subdirectory to LEFT" svn update cd branches/left @@ -174,8 +257,8 @@ cd .. say "Make PARTIAL branch" svn update -i=$(commit $i "make partial branch") svn cp trunk/subdir branches/partial +i=$(commit $i "make partial branch") say "Make a commit to PARTIAL" svn update @@ -194,13 +277,13 @@ cd ../../ say "Tagging trunk" svn update -i=$(commit $i "tagging v1.0") svn cp trunk tags/v1.0 +i=$(commit $i "tagging v1.0") say "Branching BUGFIX from v1.0" svn update -i=$(commit $i "make bugfix branch from tag") svn cp tags/v1.0 branches/bugfix +i=$(commit $i "make bugfix branch from tag") say "Make a commit to BUGFIX" svn update diff --git a/t/t9151/svn-mergeinfo.dump b/t/t9151/svn-mergeinfo.dump index ebf386ebd5..47cafcf528 100644 --- a/t/t9151/svn-mergeinfo.dump +++ b/t/t9151/svn-mergeinfo.dump @@ -1633,13 +1633,427 @@ PROPS-END Revision-number: 25 +Prop-content-length: 129 +Content-length: 129 + +K 7 +svn:log +V 31 +(r25) make b1 branch from trunk +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:18:56.084589Z +PROPS-END + +Node-path: branches/b1 +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 24 +Node-copyfrom-path: trunk + + +Revision-number: 26 +Prop-content-length: 129 +Content-length: 129 + +K 7 +svn:log +V 31 +(r26) make b2 branch from trunk +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:18:59.076940Z +PROPS-END + +Node-path: branches/b2 +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 25 +Node-copyfrom-path: trunk + + +Revision-number: 27 +Prop-content-length: 115 +Content-length: 115 + +K 7 +svn:log +V 17 +(r27) b2 update 1 +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:19:01.095762Z +PROPS-END + +Node-path: branches/b2/b2file +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 3 +Text-content-md5: 5edbdd57cba621eb3c6e601bf563b4dc +Text-content-sha1: 9d4b38049776bd0a2074d67cad23f8eaed35a3b3 +Content-length: 13 + +PROPS-END +b2 + + +Revision-number: 28 +Prop-content-length: 115 +Content-length: 115 + +K 7 +svn:log +V 17 +(r28) b1 update 1 +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:19:03.097465Z +PROPS-END + +Node-path: branches/b1/b1file +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 3 +Text-content-md5: 08778dfd9ac4f603231896aba7aad523 +Text-content-sha1: b551771aa4ad5b14123fc3bd98d89db2bc0edd4f +Content-length: 13 + +PROPS-END +b1 + + +Revision-number: 29 +Prop-content-length: 121 +Content-length: 121 + +K 7 +svn:log +V 23 +(r29) Merge b1 to trunk +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:19:06.073175Z +PROPS-END + +Node-path: trunk +Node-kind: dir +Node-action: change +Prop-content-length: 118 +Content-length: 118 + +K 13 +svn:mergeinfo +V 83 +/branches/b1:25-28 +/branches/left:2-22 +/branches/left-sub:4-19 +/branches/right:2-22 +PROPS-END + + +Node-path: trunk/b1file +Node-kind: file +Node-action: add +Node-copyfrom-rev: 28 +Node-copyfrom-path: branches/b1/b1file +Text-copy-source-md5: 08778dfd9ac4f603231896aba7aad523 +Text-copy-source-sha1: b551771aa4ad5b14123fc3bd98d89db2bc0edd4f + + +Revision-number: 30 +Prop-content-length: 143 +Content-length: 143 + +K 7 +svn:log +V 45 +(r30) trunk commit before merging trunk to b2 +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:19:08.096353Z +PROPS-END + +Node-path: trunk/trunkfile +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 6 +Text-content-md5: edf45fe5c98c5367733b39bbb2bb20d9 +Text-content-sha1: 7361d1685e5c86dfc523620cfaf598f196f86239 +Content-length: 16 + +PROPS-END +trunk + + +Revision-number: 31 +Prop-content-length: 121 +Content-length: 121 + +K 7 +svn:log +V 23 +(r31) Merge trunk to b2 +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:19:11.081541Z +PROPS-END + +Node-path: branches/b2 +Node-kind: dir +Node-action: change +Prop-content-length: 131 +Content-length: 131 + +K 13 +svn:mergeinfo +V 96 +/branches/b1:25-28 +/branches/left:2-22 +/branches/left-sub:4-19 +/branches/right:2-22 +/trunk:26-30 +PROPS-END + + +Node-path: branches/b2/b1file +Node-kind: file +Node-action: add +Node-copyfrom-rev: 30 +Node-copyfrom-path: trunk/b1file +Text-copy-source-md5: 08778dfd9ac4f603231896aba7aad523 +Text-copy-source-sha1: b551771aa4ad5b14123fc3bd98d89db2bc0edd4f + + +Node-path: branches/b2/trunkfile +Node-kind: file +Node-action: add +Node-copyfrom-rev: 30 +Node-copyfrom-path: trunk/trunkfile +Text-copy-source-md5: edf45fe5c98c5367733b39bbb2bb20d9 +Text-copy-source-sha1: 7361d1685e5c86dfc523620cfaf598f196f86239 + + +Revision-number: 32 +Prop-content-length: 121 +Content-length: 121 + +K 7 +svn:log +V 23 +(r32) Merge b2 to trunk +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:19:14.117939Z +PROPS-END + +Node-path: trunk +Node-kind: dir +Node-action: change +Prop-content-length: 138 +Content-length: 138 + +K 13 +svn:mergeinfo +V 102 +/branches/b1:25-28 +/branches/b2:26-31 +/branches/left:2-22 +/branches/left-sub:4-19 +/branches/right:2-22 +PROPS-END + + +Node-path: trunk/b2file +Node-kind: file +Node-action: add +Node-copyfrom-rev: 31 +Node-copyfrom-path: branches/b2/b2file +Text-copy-source-md5: 5edbdd57cba621eb3c6e601bf563b4dc +Text-copy-source-sha1: 9d4b38049776bd0a2074d67cad23f8eaed35a3b3 + + +Revision-number: 33 +Prop-content-length: 145 +Content-length: 145 + +K 7 +svn:log +V 47 +(r33) make f1 branch from trunk with a new file +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:19:17.105832Z +PROPS-END + +Node-path: branches/f1 +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 32 +Node-copyfrom-path: trunk + + +Node-path: branches/f1/f1file +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 3 +Text-content-md5: 2b1abc6b6c5c0018851f9f8e6475563b +Text-content-sha1: aece6dfba588900e00d95601d22b4408d49580af +Content-length: 13 + +PROPS-END +f1 + + +Revision-number: 34 +Prop-content-length: 145 +Content-length: 145 + +K 7 +svn:log +V 47 +(r34) make f2 branch from trunk with a new file +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:19:20.110057Z +PROPS-END + +Node-path: branches/f2 +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 33 +Node-copyfrom-path: trunk + + +Node-path: branches/f2/f2file +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 3 +Text-content-md5: 575c5638d60271457e54ab7d07309502 +Text-content-sha1: 1c49a440c352f3473efa9512255033b94dc7def0 +Content-length: 13 + +PROPS-END +f2 + + +Revision-number: 35 +Prop-content-length: 128 +Content-length: 128 + +K 7 +svn:log +V 30 +(r35) Merge f1 and f2 to trunk +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:19:24.081490Z +PROPS-END + +Node-path: trunk +Node-kind: dir +Node-action: change +Prop-content-length: 173 +Content-length: 173 + +K 13 +svn:mergeinfo +V 137 +/branches/b1:25-28 +/branches/b2:26-31 +/branches/f1:33-34 +/branches/f2:34 +/branches/left:2-22 +/branches/left-sub:4-19 +/branches/right:2-22 +PROPS-END + + +Node-path: trunk/f1file +Node-kind: file +Node-action: add +Node-copyfrom-rev: 34 +Node-copyfrom-path: branches/f1/f1file +Text-copy-source-md5: 2b1abc6b6c5c0018851f9f8e6475563b +Text-copy-source-sha1: aece6dfba588900e00d95601d22b4408d49580af + + +Node-path: trunk/f2file +Node-kind: file +Node-action: add +Node-copyfrom-rev: 34 +Node-copyfrom-path: branches/f2/f2file +Text-copy-source-md5: 575c5638d60271457e54ab7d07309502 +Text-copy-source-sha1: 1c49a440c352f3473efa9512255033b94dc7def0 + + +Revision-number: 36 Prop-content-length: 135 Content-length: 135 K 7 svn:log V 37 -(r25) add subdirectory to left branch +(r36) add subdirectory to left branch K 10 svn:author V 3 @@ -1647,7 +2061,7 @@ adm K 8 svn:date V 27 -2010-01-19T04:14:46.052649Z +2010-02-22T06:19:26.113516Z PROPS-END Node-path: branches/left/subdir @@ -1672,14 +2086,14 @@ PROPS-END Yeehaw -Revision-number: 26 +Revision-number: 37 Prop-content-length: 123 Content-length: 123 K 7 svn:log V 25 -(r26) merge left to trunk +(r37) merge left to trunk K 10 svn:author V 3 @@ -1687,19 +2101,23 @@ adm K 8 svn:date V 27 -2010-01-19T04:14:49.040783Z +2010-02-22T06:19:29.073699Z PROPS-END Node-path: trunk Node-kind: dir Node-action: change -Prop-content-length: 99 -Content-length: 99 +Prop-content-length: 173 +Content-length: 173 K 13 svn:mergeinfo -V 64 -/branches/left:2-25 +V 137 +/branches/b1:25-28 +/branches/b2:26-31 +/branches/f1:33-34 +/branches/f2:34 +/branches/left:2-36 /branches/left-sub:4-19 /branches/right:2-22 PROPS-END @@ -1708,18 +2126,18 @@ PROPS-END Node-path: trunk/subdir Node-kind: dir Node-action: add -Node-copyfrom-rev: 25 +Node-copyfrom-rev: 36 Node-copyfrom-path: branches/left/subdir -Revision-number: 27 -Prop-content-length: 118 -Content-length: 118 +Revision-number: 38 +Prop-content-length: 123 +Content-length: 123 K 7 svn:log -V 20 -(r28) partial update +V 25 +(r38) make partial branch K 10 svn:author V 3 @@ -1727,16 +2145,34 @@ adm K 8 svn:date V 27 -2010-01-19T04:14:53.049037Z +2010-02-22T06:19:32.072243Z PROPS-END Node-path: branches/partial Node-kind: dir Node-action: add -Node-copyfrom-rev: 26 +Node-copyfrom-rev: 37 Node-copyfrom-path: trunk/subdir +Revision-number: 39 +Prop-content-length: 118 +Content-length: 118 + +K 7 +svn:log +V 20 +(r39) partial update +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:19:34.097961Z +PROPS-END + Node-path: branches/partial/palindromes Node-kind: file Node-action: add @@ -1750,14 +2186,14 @@ PROPS-END racecar -Revision-number: 28 +Revision-number: 40 Prop-content-length: 126 Content-length: 126 K 7 svn:log V 28 -(r29) merge partial to trunk +(r40) merge partial to trunk K 10 svn:author V 3 @@ -1765,21 +2201,25 @@ adm K 8 svn:date V 27 -2010-01-19T04:14:56.041526Z +2010-02-22T06:19:37.080211Z PROPS-END Node-path: trunk/subdir Node-kind: dir Node-action: change -Prop-content-length: 142 -Content-length: 142 +Prop-content-length: 246 +Content-length: 246 K 13 svn:mergeinfo -V 106 -/branches/left/subdir:2-25 +V 210 +/branches/b1/subdir:25-28 +/branches/b2/subdir:26-31 +/branches/f1/subdir:33-34 +/branches/f2/subdir:34 +/branches/left/subdir:2-36 /branches/left-sub/subdir:4-19 -/branches/partial:27 +/branches/partial:38-39 /branches/right/subdir:2-22 PROPS-END @@ -1787,20 +2227,20 @@ PROPS-END Node-path: trunk/subdir/palindromes Node-kind: file Node-action: add -Node-copyfrom-rev: 27 +Node-copyfrom-rev: 39 Node-copyfrom-path: branches/partial/palindromes Text-copy-source-md5: 5d1c2024fb5efc4eef812856df1b080c Text-copy-source-sha1: 5f8509ddd14c91a52864dd1447344e706f9bbc69 -Revision-number: 29 -Prop-content-length: 131 -Content-length: 131 +Revision-number: 41 +Prop-content-length: 116 +Content-length: 116 K 7 svn:log -V 33 -(r31) make bugfix branch from tag +V 18 +(r41) tagging v1.0 K 10 svn:author V 3 @@ -1808,24 +2248,24 @@ adm K 8 svn:date V 27 -2010-01-19T04:15:00.039761Z +2010-02-22T06:19:40.083460Z PROPS-END Node-path: tags/v1.0 Node-kind: dir Node-action: add -Node-copyfrom-rev: 28 +Node-copyfrom-rev: 40 Node-copyfrom-path: trunk -Revision-number: 30 -Prop-content-length: 120 -Content-length: 120 +Revision-number: 42 +Prop-content-length: 131 +Content-length: 131 K 7 svn:log -V 22 -(r32) commit to bugfix +V 33 +(r42) make bugfix branch from tag K 10 svn:author V 3 @@ -1833,16 +2273,34 @@ adm K 8 svn:date V 27 -2010-01-19T04:15:03.043218Z +2010-02-22T06:19:43.118075Z PROPS-END Node-path: branches/bugfix Node-kind: dir Node-action: add -Node-copyfrom-rev: 29 +Node-copyfrom-rev: 41 Node-copyfrom-path: tags/v1.0 +Revision-number: 43 +Prop-content-length: 120 +Content-length: 120 + +K 7 +svn:log +V 22 +(r43) commit to bugfix +K 10 +svn:author +V 3 +adm +K 8 +svn:date +V 27 +2010-02-22T06:19:45.079536Z +PROPS-END + Node-path: branches/bugfix/subdir/palindromes Node-kind: file Node-action: change @@ -1855,14 +2313,14 @@ racecar kayak -Revision-number: 31 +Revision-number: 44 Prop-content-length: 125 Content-length: 125 K 7 svn:log V 27 -(r33) Merge BUGFIX to TRUNK +(r44) Merge BUGFIX to TRUNK K 10 svn:author V 3 @@ -1870,41 +2328,49 @@ adm K 8 svn:date V 27 -2010-01-19T04:15:06.043723Z +2010-02-22T06:19:48.078914Z PROPS-END Node-path: trunk Node-kind: dir Node-action: change -Prop-content-length: 133 -Content-length: 133 +Prop-content-length: 210 +Content-length: 210 K 13 svn:mergeinfo -V 98 -/branches/bugfix:30 -/branches/left:2-25 +V 174 +/branches/b1:25-28 +/branches/b2:26-31 +/branches/bugfix:42-43 +/branches/f1:33-34 +/branches/f2:34 +/branches/left:2-36 /branches/left-sub:4-19 /branches/right:2-22 -/tags/v1.0:29 +/tags/v1.0:41 PROPS-END Node-path: trunk/subdir Node-kind: dir Node-action: change -Prop-content-length: 190 -Content-length: 190 +Prop-content-length: 297 +Content-length: 297 K 13 svn:mergeinfo -V 154 -/branches/bugfix/subdir:30 -/branches/left/subdir:2-25 +V 261 +/branches/b1/subdir:25-28 +/branches/b2/subdir:26-31 +/branches/bugfix/subdir:42-43 +/branches/f1/subdir:33-34 +/branches/f2/subdir:34 +/branches/left/subdir:2-36 /branches/left-sub/subdir:4-19 -/branches/partial:27 +/branches/partial:38-39 /branches/right/subdir:2-22 -/tags/v1.0/subdir:29 +/tags/v1.0/subdir:41 PROPS-END diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index 2fc7fdb124..63b6b060e6 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -591,14 +591,22 @@ test_debug 'cat gitweb.log' # ---------------------------------------------------------------------- # gitweb config and repo config -cat >>gitweb_config.perl <<EOF - -\$feature{'blame'}{'override'} = 1; -\$feature{'snapshot'}{'override'} = 1; -\$feature{'avatar'}{'override'} = 1; +cat >>gitweb_config.perl <<\EOF + +# turn on override for each overridable feature +foreach my $key (keys %feature) { + if ($feature{$key}{'sub'}) { + $feature{$key}{'override'} = 1; + } +} EOF test_expect_success \ + 'config override: projects list (implicit)' \ + 'gitweb_run' +test_debug 'cat gitweb.log' + +test_expect_success \ 'config override: tree view, features not overridden in repo config' \ 'gitweb_run "p=.git;a=tree"' test_debug 'cat gitweb.log' diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh index 363345faef..b572ce3ab7 100755 --- a/t/t9600-cvsimport.sh +++ b/t/t9600-cvsimport.sh @@ -47,13 +47,20 @@ EOF test_expect_success 'import a trivial module' ' - git cvsimport -a -z 0 -C module-git module && + git cvsimport -a -R -z 0 -C module-git module && test_cmp module-cvs/o_fortuna module-git/o_fortuna ' test_expect_success 'pack refs' 'cd module-git && git gc && cd ..' +test_expect_success 'initial import has correct .git/cvs-revisions' ' + + (cd module-git && + git log --format="o_fortuna 1.1 %H" -1) > expected && + test_cmp expected module-git/.git/cvs-revisions +' + test_expect_success 'update cvs module' ' cd module-cvs && @@ -86,13 +93,21 @@ EOF test_expect_success 'update git module' ' cd module-git && - git cvsimport -a -z 0 module && + git cvsimport -a -R -z 0 module && git merge origin && cd .. && test_cmp module-cvs/o_fortuna module-git/o_fortuna ' +test_expect_success 'update has correct .git/cvs-revisions' ' + + (cd module-git && + git log --format="o_fortuna 1.1 %H" -1 HEAD^ && + git log --format="o_fortuna 1.2 %H" -1 HEAD) > expected && + test_cmp expected module-git/.git/cvs-revisions +' + test_expect_success 'update cvs module' ' cd module-cvs && @@ -107,13 +122,22 @@ test_expect_success 'cvsimport.module config works' ' cd module-git && git config cvsimport.module module && - git cvsimport -a -z0 && + git cvsimport -a -R -z0 && git merge origin && cd .. && test_cmp module-cvs/tick module-git/tick ' +test_expect_success 'second update has correct .git/cvs-revisions' ' + + (cd module-git && + git log --format="o_fortuna 1.1 %H" -1 HEAD^^ && + git log --format="o_fortuna 1.2 %H" -1 HEAD^ + git log --format="tick 1.1 %H" -1 HEAD) > expected && + test_cmp expected module-git/.git/cvs-revisions +' + test_expect_success 'import from a CVS working tree' ' $CVS co -d import-from-wt module && @@ -126,6 +150,12 @@ test_expect_success 'import from a CVS working tree' ' ' +test_expect_success 'no .git/cvs-revisions created by default' ' + + ! test -e import-from-wt/.git/cvs-revisions + +' + test_expect_success 'test entire HEAD' 'test_cmp_branch_tree master' test_done diff --git a/t/test-lib.sh b/t/test-lib.sh index afd3053f96..a0e396a952 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -65,6 +65,8 @@ GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u} # CDPATH into the environment unset CDPATH +unset GREP_OPTIONS + case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in 1|2|true) echo "* warning: Some tests will not work if GIT_TRACE" \ |