From: Junio C Hamano Date: Sun, 11 Mar 2007 07:26:33 +0000 (-0800) Subject: Merge branch 'js/diff-ni' X-Git-Tag: v1.5.1-rc1~62 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cf6981d4932007555689052cbc255b911674b01c;p=git.git Merge branch 'js/diff-ni' * js/diff-ni: Get rid of the dependency to GNU diff in the tests diff --no-index: support /dev/null as filename diff-ni: fix the diff with standard input diff: support reading a file from stdin via "-" --- cf6981d4932007555689052cbc255b911674b01c diff --cc t/t1300-repo-config.sh index ee386cfbf,84a59397b..78c2e0864 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@@ -389,24 -389,8 +389,24 @@@ cat > expect << EO weird EOF - test_expect_success "rename succeeded" "diff -u expect .git/config" + test_expect_success "rename succeeded" "git diff expect .git/config" +cat >> .git/config << EOF + [branch "zwei"] a = 1 [branch "vier"] +EOF + +test_expect_success "remove section" "git config --remove-section branch.zwei" + +cat > expect << EOF +# Hallo + #Bello +[branch "drei"] +weird +EOF + +test_expect_success "section was removed properly" \ - "diff -u expect .git/config" ++ "git diff -u expect .git/config" + test_expect_success numbers ' git-config kilo.gram 1k && diff --cc t/t5400-send-pack.sh index b1c97b0df,fc4a12640..477b26759 --- a/t/t5400-send-pack.sh +++ b/t/t5400-send-pack.sh @@@ -108,9 -108,9 +108,9 @@@ test_expect_success cd victim && git-config receive.denyNonFastforwards true && cd .. && - git-update-ref refs/heads/master master^ && - git-send-pack --force ./victim/.git/ master && + git-update-ref refs/heads/master master^ || return 1 + git-send-pack --force ./victim/.git/ master && return 1 - ! diff .git/refs/heads/master victim/.git/refs/heads/master + ! git diff .git/refs/heads/master victim/.git/refs/heads/master ' test_done diff --cc t/t5401-update-hooks.sh index 0c0034e34,460c9fd7f..cf6306ce9 --- a/t/t5401-update-hooks.sh +++ b/t/t5401-update-hooks.sh @@@ -80,55 -49,33 +80,55 @@@ test_expect_success 'hooks ran' test -f victim/.git/post-update.stdin ' +test_expect_success 'pre-receive hook arguments' ' + echo \ + refs/heads/master $commit0 $commit1 \ + refs/heads/tofail $commit1 $commit0 \ - | diff - victim/.git/pre-receive.args ++ | git diff - victim/.git/pre-receive.args +' + test_expect_success 'update hook arguments' ' + (echo refs/heads/master $commit0 $commit1; + echo refs/heads/tofail $commit1 $commit0 - ) | diff - victim/.git/update.args ++ ) | git diff - victim/.git/update.args +' + +test_expect_success 'post-receive hook arguments' ' echo refs/heads/master $commit0 $commit1 | - diff - victim/.git/post-receive.args - git diff - victim/.git/update.args ++ git diff - victim/.git/post-receive.args ' test_expect_success 'post-update hook arguments' ' echo refs/heads/master | - diff -u - victim/.git/post-update.args + git diff - victim/.git/post-update.args ' -test_expect_failure 'update hook stdin is /dev/null' ' - test -s victim/.git/update.stdin -' - -test_expect_failure 'post-update hook stdin is /dev/null' ' - test -s victim/.git/post-update.stdin +test_expect_success 'all hook stdin is /dev/null' ' + ! test -s victim/.git/pre-receive.stdin && + ! test -s victim/.git/update.stdin && + ! test -s victim/.git/post-receive.stdin && + ! test -s victim/.git/post-update.stdin ' test_expect_failure 'send-pack produced no output' ' test -s send.out ' +cat <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 +EOF test_expect_success 'send-pack stderr contains hook messages' ' - grep "STDOUT update" send.err && - grep "STDERR update" send.err && - grep "STDOUT post-update" send.err && - grep "STDERR post-update" send.err + egrep ^STD send.err >actual && - diff - actual file original && + git add file && + git commit -a -m One && + git tag tag-one && + git tag tag-one-tree HEAD^{tree} && + git branch one && + + echo two >> file && + git commit -a -m Two && + git tag -a -m "Tag Two" tag-two && + git branch two && + + echo three >> file && + git commit -a -m Three && + git tag -a -m "Tag Three" tag-three && + git tag -a -m "Tag Three file" tag-three-file HEAD^{tree}:file && + git branch three && + + echo master >> file && + git commit -a -m Master && + git tag -a -m "Tag Master" tag-master && + + git checkout three && + + git clone . cloned && + cd cloned && + git config remote.origin.url ../.git/ && + + git config remote.config-explicit.url ../.git/ && + git config remote.config-explicit.fetch refs/heads/master:remotes/rem/master && + git config --add remote.config-explicit.fetch refs/heads/one:remotes/rem/one && + git config --add remote.config-explicit.fetch two:remotes/rem/two && + git config --add remote.config-explicit.fetch refs/heads/three:remotes/rem/three && + remotes="config-explicit" && + + git config remote.config-glob.url ../.git/ && + git config remote.config-glob.fetch refs/heads/*:refs/remotes/rem/* && + remotes="$remotes config-glob" && + + mkdir -p .git/remotes && + { + echo "URL: ../.git/" + echo "Pull: refs/heads/master:remotes/rem/master" + echo "Pull: refs/heads/one:remotes/rem/one" + echo "Pull: two:remotes/rem/two" + echo "Pull: refs/heads/three:remotes/rem/three" + } >.git/remotes/remote-explicit && + remotes="$remotes remote-explicit" && + + { + echo "URL: ../.git/" + echo "Pull: refs/heads/*:refs/remotes/rem/*" + } >.git/remotes/remote-glob && + remotes="$remotes remote-glob" && + + mkdir -p .git/branches && + echo "../.git" > .git/branches/branches-default && + remotes="$remotes branches-default" && + + echo "../.git#one" > .git/branches/branches-one && + remotes="$remotes branches-one" && + + for remote in $remotes ; do + git config branch.br-$remote.remote $remote && + git config branch.br-$remote-merge.remote $remote && + git config branch.br-$remote-merge.merge refs/heads/three && + git config branch.br-$remote-octopus.remote $remote && + git config branch.br-$remote-octopus.merge refs/heads/one && + git config --add branch.br-$remote-octopus.merge two && + git config --add branch.br-$remote-octopus.merge remotes/rem/three + done +' + +# Merge logic depends on branch properties and Pull: or .fetch lines +for remote in $remotes ; do + for branch in "" "-merge" "-octopus" ; do +cat < tests + +# Merge logic does not depend on branch properties, +# but does depend on Pull: or fetch lines. +# Use two branches completely unrelated from the arguments, +# the clone default and one without branch properties +for branch in master br-unconfig ; do + echo $branch + for remote in $remotes ; do + echo $branch $remote + done +done >> tests + +# Merge logic does not depend on branch properties +# neither in the Pull: or .fetch config +for branch in master br-unconfig ; do + cat <> tests + +while read cmd +do + case "$cmd" in + '' | '#'*) continue ;; + esac + test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'` + cnt=`expr $test_count + 1` + pfx=`printf "%04d" $cnt` + expect="../../t5515/fetch.$test" + actual="$pfx-fetch.$test" + + test_expect_success "$cmd" ' + { + echo "# $cmd" + set x $cmd; shift + git symbolic-ref HEAD refs/heads/$1 ; shift + rm -f .git/FETCH_HEAD + rm -f .git/refs/heads/* + rm -f .git/refs/remotes/rem/* + rm -f .git/refs/tags/* + git fetch "$@" >/dev/null + cat .git/FETCH_HEAD + } >"$actual" && + if test -f "$expect" + then - diff -u "$expect" "$actual" && ++ git diff -u "$expect" "$actual" && + rm -f "$actual" + else + # this is to help developing new tests. + cp "$actual" "$expect" + false + fi + ' +done < tests + +test_done diff --cc t/t9300-fast-import.sh index 2e1a09ff2,2337d83d3..03f2f8f34 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@@ -109,16 -109,8 +109,16 @@@ cat >expect <