code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/bin/sh test_description='basic credential helper tests' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-credential.sh test_expect_success 'setup helper scripts' ' cat >dump <<-\EOF && whoami=`echo $0 | sed s/.*git-credential-//` echo >&2 "$whoami: $*" OIFS=$IFS IFS== while read key value; do echo >&2 "$whoami: $ke...
Shell
#!/bin/sh # # Copyright (c) 2007 Eric Wong # test_description='git svn tracking removed top-level path' . ./lib-git-svn.sh test_expect_success 'make history for tracking' ' mkdir import && mkdir import/trunk && echo hello >> import/trunk/README && svn_cmd import -m initial import "$svnrepo" && rm -rf import && ...
Shell
#!/bin/sh # # Copyright (c) 2006 Josh England # test_description='Test the post-checkout hook.' . ./test-lib.sh test_expect_success setup ' echo Data for commit0. >a && echo Data for commit0. >b && git update-index --add a && git update-index --add b && tree0=$(git write-tree) && commit0=$(echo setup | git comm...
Shell
#!/bin/sh test_description='reflog walk shows repeated commits again' . ./test-lib.sh test_expect_success 'setup commits' ' test_tick && echo content >file && git add file && git commit -m one && git tag one && echo content >>file && git add file && git commit -m two && git tag two ' test_expect_success 'setup ...
Shell
#!/bin/sh # Based on a test case submitted by Björn Steinbrink. test_description='git blame on conflicted files' . ./test-lib.sh test_expect_success 'setup first case' ' # Create the old file echo "Old line" > file1 && git add file1 && git commit --author "Old Line <ol@localhost>" -m file1.a && # Branch git c...
Shell
#!/bin/sh test_description='CRLF conversion' . ./test-lib.sh has_cr() { tr '\015' Q <"$1" | grep Q >/dev/null } test_expect_success setup ' git config core.autocrlf false && for w in Hello world how are you; do echo $w; done >one && for w in I am very very fine thank you; do echo ${w}Q; done | q_to_cr >two &&...
Shell
#!/bin/sh test_description='git reset should work on unborn branch' . ./test-lib.sh test_expect_success 'setup' ' echo a >a && echo b >b ' test_expect_success 'reset' ' git add a b && git reset && test "$(git ls-files)" = "" ' test_expect_success 'reset HEAD' ' rm .git/index && git add a b && test_must_fail...
Shell
#!/bin/sh test_description='git cvsimport basic tests' . ./lib-cvs.sh test_expect_success PERL 'setup cvsroot environment' ' CVSROOT=$(pwd)/cvsroot && export CVSROOT ' test_expect_success PERL 'setup cvsroot' '$CVS init' test_expect_success PERL 'setup a cvs module' ' mkdir "$CVSROOT/module" && $CVS co -d modu...
Shell
#!/bin/sh test_description='git grep in binary files' . ./test-lib.sh test_expect_success 'setup' " echo 'binaryQfile' | q_to_nul >a && git add a && git commit -m. " test_expect_success 'git grep ina a' ' echo Binary file a matches >expect && git grep ina a >actual && test_cmp expect actual ' test_expect_suc...
Shell
#!/bin/sh test_description='push with --set-upstream' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-terminal.sh ensure_fresh_upstream() { rm -rf parent && git init --bare parent } test_expect_success 'setup bare parent' ' ensure_fresh_upstream && git remote add upstream parent ' test_expect_success 'setup local commit...
Shell
#!/bin/sh # # Copyright (c) 2007 Kristian Høgsberg <krh@redhat.com> # # FIXME: Test the various index usages, -i and -o, test reflog, # signoff test_description='git commit' . ./test-lib.sh . "$TEST_DIRECTORY/diff-lib.sh" author='The Real Author <someguy@his.email.org>' test_tick test_expect_success 'initial statu...
Shell
#!/bin/sh test_description='test describe B .--------------o----o----o----x / / / o----o----o----o----o----. / \ A c / .------------o---o---o D,R e ' . ./test-lib.sh check_describe () { expect="$1" s...
Shell
#!/bin/sh test_description='fetch/push involving alternates' . ./test-lib.sh count_objects () { loose=0 inpack=0 eval "$( git count-objects -v | sed -n -e 's/^count: \(.*\)/loose=\1/p' \ -e 's/^in-pack: \(.*\)/inpack=\1/p' )" && echo $(( $loose + $inpack )) } test_expect_success setup ' ( git init ...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='quoted output' . ./test-lib.sh FN='濱野' GN='純' HT=' ' DQ='"' echo foo 2>/dev/null > "Name and an${HT}HT" if ! test -f "Name and an${HT}HT" then # FAT/NTFS does not allow tabs in filenames skip_all='Your filesystem does not allow tabs in filenames'...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes E Schindelin # test_description='Test git stash' . ./test-lib.sh test_expect_success 'stash some dirty working directory' ' echo 1 > file && git add file && test_tick && git commit -m initial && echo 2 > file && git add file && echo 3 > file && test_tick && git stas...
Shell
#!/bin/sh # # Copyright (c) 2007 Sam Vilain # test_description='git-svn svk merge tickets' . ./lib-git-svn.sh test_expect_success 'load svk depot' " svnadmin load -q '$rawsvnrepo' \ < '$TEST_DIRECTORY/t9150/svk-merge.dump' && git svn init --minimize-url -R svkmerge \ --rewrite-root=http://svn.example.org \ ...
Shell
#!/bin/sh test_description='test various @{X} syntax combinations together' . ./test-lib.sh check() { test_expect_${3:-success} "$1 = $2" " echo '$2' >expect && git log -1 --format=%s '$1' >actual && test_cmp expect actual " } nonsense() { test_expect_${2:-success} "$1 is nonsensical" " test_must_fail git log -1 ...
Shell
#!/bin/sh # # Copyright (c) 2010 Sverre Rabbelier # test_description='Test python remote-helper framework' . ./test-lib.sh if ! test_have_prereq PYTHON ; then skip_all='skipping python remote-helper tests, python not available' test_done fi "$PYTHON_PATH" -c ' import sys if sys.hexversion < 0x02040000: sys.ex...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git apply with rejects ' . ./test-lib.sh test_expect_success setup ' for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 do echo $i done >file1 && cat file1 >saved.file1 && git update-index --add file1 && git commit -m initial &&...
Shell
#!/bin/sh test_description='pulling into void' . ./test-lib.sh modify () { sed -e "$1" <"$2" >"$2.x" && mv "$2.x" "$2" } D=`pwd` test_expect_success setup ' echo file >file && git add file && git commit -a -m original ' test_expect_success 'pulling into void' ' mkdir cloned && cd cloned && git init && ...
Shell
#!/bin/sh test_description='apply a patch that is larger than the preimage' . ./test-lib.sh cat >F <<\EOF 1 2 3 4 5 6 7 8 999999 A B C D E F G H I J EOF test_expect_success setup ' git add F && mv F G && sed -e "s/1/11/" -e "s/999999/9/" -e "s/H/HH/" <G >F && git diff >patch && sed -e "/^\$/d" <G >F && git...
Shell
#!/bin/sh test_description='git p4 skipSubmitEdit config variables' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' test_expect_success 'init depot' ' ( cd "$cli" && echo file1 >file1 && p4 add file1 && p4 submit -d "change 1" ) ' # this works because EDITOR is set to : test_expect_succe...
Shell
#!/bin/sh # Copyright (c) 2008 Marcus Griep test_description='git svn multi-glob branch names' . ./lib-git-svn.sh test_expect_success 'setup svnrepo' ' mkdir project project/trunk project/branches \ project/branches/v14.1 project/tags && echo foo > project/trunk/foo && svn_cmd import -m "$test_description" proj...
Shell
#!/bin/sh # # Copyright (c) 2008 Charles Bailey # test_description='git mergetool Testing basic merge tool invocation' . ./test-lib.sh # All the mergetool test work by checking out a temporary branch based # off 'branch1' and then merging in master and checking the results of # running mergetool test_expect_succes...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git update-index nonsense-path test. This test creates the following structure in the cache: path0 - a file path1 - a symlink path2/file2 - a file in a directory path3/file3 - a file in a directory and tries to git updat...
Shell
#!/bin/sh # # Copyright (c) 2005 Amos Waterland # test_description='git rebase assorted tests This test runs git rebase and checks that the author information is not lost among other things. ' . ./test-lib.sh GIT_AUTHOR_NAME=author@name GIT_AUTHOR_EMAIL=bogus@email@address export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL te...
Shell
# # Library code for git p4 tests # # p4 tests never use the top-level repo; always build/clone into # a subdirectory called "$git" TEST_NO_CREATE_REPO=NoThanks . ./test-lib.sh if ! test_have_prereq PYTHON then skip_all='skipping git p4 tests; python not available' test_done fi ( p4 -h && p4d -h ) >/dev/null 2>&1 ...
Shell
#!/bin/sh # # Copyright (c) 2008 Nguyễn Thái Ngọc Duy # test_description='skip-worktree bit test' . ./test-lib.sh cat >expect.full <<EOF H 1 H 2 H sub/1 H sub/2 EOF cat >expect.skip <<EOF S 1 H 2 S sub/1 H sub/2 EOF test_expect_success 'setup' ' mkdir sub && touch ./1 ./2 sub/1 sub/2 && git add 1 2 sub/1 sub/2 ...
Shell
#!/bin/sh # # Copyright (c) 2008 Johannes Schindelin # test_description='Test rebasing, stashing, etc. with submodules' . ./test-lib.sh test_expect_success setup ' echo file > file && git add file && test_tick && git commit -m initial && git clone . submodule && git add submodule && test_tick && git commit ...
Shell
#!/bin/sh # # Copyright (c) 2006 Josh England # test_description='Test the post-merge hook.' . ./test-lib.sh test_expect_success setup ' echo Data for commit0. >a && git update-index --add a && tree0=$(git write-tree) && commit0=$(echo setup | git commit-tree $tree0) && echo Changed data for commit1. >a && git ...
Shell
#!/bin/sh test_description='merging with submodules' . ./test-lib.sh # # history # # a --- c # / \ / # root X # \ / \ # b --- d # test_expect_success setup ' mkdir sub && (cd sub && git init && echo original > file && git add file && test_tick && git commit -m sub-root)...
Shell
#!/bin/sh test_description="recursive merge corner cases w/ renames but not criss-crosses" # t6036 has corner cases that involve both criss-cross merges and renames . ./test-lib.sh test_expect_success 'setup rename/delete + untracked file' ' echo "A pretty inscription" >ring && git add ring && test_tick && git c...
Shell
#!/bin/sh # # Copyright (c) 2008 Matthew Ogilvie # Parts adapted from other tests. # test_description='git-cvsserver -kb modes tests -kb mode for binary files when accessing a git repository using cvs CLI client via git-cvsserver server' . ./test-lib.sh marked_as () { foundEntry="$(grep "^/$2/" "$1/CVS/Entries"...
Shell
#!/bin/sh test_description='apply same filename' . ./test-lib.sh test_expect_success 'setup' ' mkdir -p some/sub/dir && echo Hello > some/sub/dir/file && git add some/sub/dir/file && git commit -m initial && git tag initial ' cat > patch << EOF diff a/bla/blub/dir/file b/bla/blub/dir/file --- a/bla/blub/dir/...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='Test diff raw-output. ' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh cat >.test-plain-OA <<\EOF :000000 100644 0000000000000000000000000000000000000000 ccba72ad3888a3520b39efcf780b9ee64167535d A AA :000000 100644 000000000000000000000...
Shell
#!/bin/sh test_description='applying patch with mode bits' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh test_expect_success setup ' echo original >file && git add file && test_tick && git commit -m initial && git tag initial && echo modified >file && git diff --stat -p >patch-0.txt && chmod +x ...
Shell
#!/bin/sh test_description='check svn dumpfile importer' . ./test-lib.sh reinit_git () { if ! test_declared_prereq PIPE then echo >&4 "reinit_git: need to declare PIPE prerequisite" return 127 fi rm -fr .git && rm -f stream backflow && git init && mkfifo stream backflow } try_dump () { input=$1 && mayb...
Shell
#!/bin/sh # # Copyright (c) 2007 Eric Wong # test_description='git svn log tests' . ./lib-git-svn.sh test_expect_success 'setup repository and import' ' mkdir import && ( cd import && for i in trunk branches/a branches/b tags/0.1 tags/0.2 tags/0.3 do mkdir -p $i && echo hello >>$i/README || exit 1 ...
Shell
#!/bin/sh test_description='Test am with auto.crlf' . ./test-lib.sh cat >patchfile <<\EOF From 38be10072e45dd6b08ce40851e3fca60a31a340b Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen <x@y.com> Date: Thu, 23 Aug 2007 13:00:00 +0200 Subject: test1 --- foo | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) c...
Shell
#!/bin/sh # # Copyright (c) 2010 Will Palmer # test_description='git merge-tree' . ./test-lib.sh test_expect_success setup ' test_commit "initial" "initial-file" "initial" ' test_expect_success 'file add A, !B' ' cat >expected <<\EXPECTED && added in remote their 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ...
Shell
#!/bin/sh test_description="git hash-object" . ./test-lib.sh echo_without_newline() { printf '%s' "$*" } test_blob_does_not_exist() { test_expect_success 'blob does not exist in database' " test_must_fail git cat-file blob $1 " } test_blob_exists() { test_expect_success 'blob exists in database' " git cat-...
Shell
#!/bin/sh # # Copyright (c) 2011 David Caldwell # test_description='Test git stash --include-untracked' . ./test-lib.sh test_expect_success 'stash save --include-untracked some dirty working directory' ' echo 1 > file && git add file && test_tick && git commit -m initial && echo 2 > file && git add file && ec...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git apply in reverse ' . ./test-lib.sh test_expect_success setup ' for i in a b c d e f g h i j k l m n; do echo $i; done >file1 && "$PERL_PATH" -pe "y/ijk/\\000\\001\\002/" <file1 >file2 && git add file1 file2 && git commit -m initial && gi...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes E. Schindelin # test_description='Test commit notes index (expensive!)' . ./test-lib.sh test_set_prereq NOT_EXPENSIVE test -n "$GIT_NOTES_TIMING_TESTS" && test_set_prereq EXPENSIVE test -x /usr/bin/time && test_set_prereq USR_BIN_TIME create_repo () { number_of_commits=$1 ...
Shell
#!/bin/sh test_description='Test commit notes organized in subtrees' . ./test-lib.sh number_of_commits=100 start_note_commit () { test_tick && cat <<INPUT_END commit refs/notes/commits committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE data <<COMMIT notes COMMIT from refs/notes/commits^0 de...
Shell
#!/bin/sh test_description='signed commit tests' . ./test-lib.sh . "$TEST_DIRECTORY/lib-gpg.sh" test_expect_success GPG 'create signed commits' ' echo 1 >file && git add file && test_tick && git commit -S -m initial && git tag initial && git branch side && echo 2 >file && test_tick && git commit -a -S -m second...
Shell
#!/bin/sh # # Copyright (c) 2012 Steven Walter # test_description='git svn merge detection' . ./lib-git-svn.sh svn_ver="$(svn --version --quiet)" case $svn_ver in 0.* | 1.[0-4].*) skip_all="skipping git-svn test - SVN too old ($svn_ver)" test_done ;; esac test_expect_success 'initialize source svn repo' ' svn_cm...
Shell
#!/bin/sh test_description='checkout should leave clean stat info' . ./test-lib.sh test_expect_success 'setup' ' echo hello >world && git update-index --add world && git commit -m initial && git branch side && echo goodbye >world && git update-index --add world && git commit -m second ' test_expect_success...
Shell
#!/bin/sh test_description='test fetching over git protocol' . ./test-lib.sh LIB_GIT_DAEMON_PORT=${LIB_GIT_DAEMON_PORT-5570} . "$TEST_DIRECTORY"/lib-git-daemon.sh start_git_daemon test_expect_success 'setup repository' ' echo content >file && git add file && git commit -m one ' test_expect_success 'create git-ac...
Shell
#!/bin/sh # # Copyright (c) 2006 Shawn Pearce # test_description='git checkout-index --temp test. With --temp flag, git checkout-index writes to temporary merge files rather than the tracked path.' . ./test-lib.sh test_expect_success \ 'preparation' ' mkdir asubdir && echo tree1path0 >path0 && echo tree1path1 >path...
Shell
#!/bin/sh test_description='patching from inconvenient places' . ./test-lib.sh test_expect_success 'setup' ' cat >patch <<-\EOF && diff file.orig file --- a/file.orig +++ b/file @@ -1 +1,2 @@ 1 +2 EOF patch="$(pwd)/patch" && echo 1 >preimage && printf "%s\n" 1 2 >postimage && echo 3 >other && test_ti...
Shell
#!/bin/sh test_description='Test wacky input to git config' . ./test-lib.sh setup() { (printf "[section]\n" && printf " key = foo") >.git/config } check() { echo "$2" >expected git config --get "$1" >actual 2>&1 test_cmp actual expected } test_expect_success 'modify same key' ' setup && git config section.k...
Shell
#!/bin/sh # # Copyright (c) 2007 Eric Wong # test_description='git svn init/clone tests' . ./lib-git-svn.sh # setup, run inside tmp so we don't have any conflicts with $svnrepo set -e rm -r .git mkdir tmp cd tmp test_expect_success 'setup svnrepo' ' mkdir project project/trunk project/branches project/tags && ech...
Shell
#!/bin/sh test_description='test refspec written by clone-command' . ./test-lib.sh test_expect_success 'setup' ' # Make two branches, "master" and "side" echo one >file && git add file && git commit -m one && echo two >file && git commit -a -m two && git tag two && echo three >file && git commit -a -m three ...
Shell
#!/bin/sh test_description='reset --hard unmerged' . ./test-lib.sh test_expect_success setup ' mkdir before later && >before/1 && >before/2 && >hello && >later/3 && git add before hello later && git commit -m world && H=$(git rev-parse :hello) && git rm --cached hello && echo "100644 $H 2 hello" | git up...
Shell
#!/bin/sh # Try a set of credential helpers; the expected stdin, # stdout and stderr should be provided on stdin, # separated by "--". check() { credential_opts= credential_cmd=$1 shift for arg in "$@"; do credential_opts="$credential_opts -c credential.helper='$arg'" done read_chunk >stdin && read_chunk >exp...
Shell
#!/bin/sh test_description='test that git handles an svn repository with missing md5sums' . ./lib-git-svn.sh # Loading a node from a svn dumpfile without a Text-Content-Length # field causes svn to neglect to store or report an md5sum. (it will # calculate one if you had put Text-Content-Length: 0). This showed # ...
Shell
#!/bin/sh test_description='git grep --open-files-in-pager ' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-pager.sh unset PAGER GIT_PAGER test_expect_success 'setup' ' test_commit initial grep.h " enum grep_pat_token { GREP_PATTERN, GREP_PATTERN_HEAD, GREP_PATTERN_BODY, GREP_AND, GREP_OPEN_PAREN, GREP_CLOSE_PAREN, ...
Shell
#!/bin/sh test_description='git p4 tests' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' test_expect_success 'add p4 files' ' ( cd "$cli" && echo file1 >file1 && p4 add file1 && p4 submit -d "file1" && echo file2 >file2 && p4 add file2 && p4 submit -d "file2" ) ' test_expect_succe...
Shell
#!/bin/sh # # Copyright (c) 2012 SZEDER Gábor # test_description='test git-specific bash prompt functions' . ./lib-bash.sh . "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh" actual="$TRASH_DIRECTORY/actual" test_expect_success 'setup for prompt tests' ' mkdir -p subdir/subsubdir && git init otherrepo && echo 1...
Shell
#!/bin/sh test_description='git svn authorship' . ./lib-git-svn.sh test_expect_success 'setup svn repository' ' svn_cmd checkout "$svnrepo" work.svn && ( cd work.svn && echo >file svn_cmd add file svn_cmd commit -m "first commit" file ) ' test_expect_success 'interact with it via git svn' ' mkdir work.gi...
Shell
#!/bin/sh test_description='CRLF conversion' . ./test-lib.sh has_cr() { tr '\015' Q <"$1" | grep Q >/dev/null } test_expect_success setup ' git config core.autocrlf false && for w in Hello world how are you; do echo $w; done >one && mkdir dir && for w in I am very very fine thank you; do echo $w; done >dir/t...
Shell
#!/bin/sh test_description='git send-email' . ./test-lib.sh # May be altered later in the test PREREQ="PERL" test_expect_success $PREREQ \ 'prepare reference tree' \ 'echo "1A quick brown fox jumps over the" >file && echo "lazy dog" >>file && git add file && GIT_AUTHOR_NAME="A" git commit -a -...
Shell
#!/bin/sh test_description='fetch --all works correctly' . ./test-lib.sh setup_repository () { mkdir "$1" && ( cd "$1" && git init && >file && git add file && test_tick && git commit -m "Initial" && git checkout -b side && >elif && git add elif && test_tick && git commit -m "Second" && git checkout mast...
Shell
#!/bin/sh test_description='unpack-objects' . ./test-lib.sh test_expect_success setup ' mkdir pub.git && GIT_DIR=pub.git git init --bare && GIT_DIR=pub.git git config receive.fsckobjects true && mkdir work && ( cd work && git init && mkdir -p gar/bage && ( cd gar/bage && git init && >junk && ...
Shell
#!/bin/sh test_description='test unique sha1 abbreviation on "index from..to" line' . ./test-lib.sh cat >expect_initial <<EOF 100644 blob 51d2738463ea4ca66f8691c91e33ce64b7d41bb1 foo EOF cat >expect_update <<EOF 100644 blob 51d2738efb4ad8a1e40bed839ab8e116f0a15e47 foo EOF test_expect_success 'setup' ' echo 4827 > ...
Shell
#!/bin/sh # # Copyright (c) 2007 Carlos Rica # test_description='git reset Documented tests for git reset' . ./test-lib.sh test_expect_success 'creating initial files and commits' ' test_tick && echo "1st file" >first && git add first && git commit -m "create 1st file" && echo "2nd file" >second && git add s...
Shell
#!/bin/sh # # Copyright (c) 2005 Jon Seymour # test_description='Tests git rev-list --bisect functionality' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions # usage: test_bisection max-diff bisect-option head ^prune... # # e.g. test_bisection 1 --bisect l1 ^l0 # test_bisection_diff() { _ma...
Shell
#!/bin/sh test_description='previous branch syntax @{-n}' . ./test-lib.sh test_expect_success 'branch -d @{-1}' ' test_commit A && git checkout -b junk && git checkout - && test "$(git symbolic-ref HEAD)" = refs/heads/master && git branch -d @{-1} && test_must_fail git rev-parse --verify refs/heads/junk ' tes...
Shell
#!/bin/sh # # Ensures that tests are run under Bash; primarily intended for running tests # of the completion script. if test -n "$BASH" && test -z "$POSIXLY_CORRECT"; then # we are in full-on bash mode true elif type bash >/dev/null 2>&1; then # execute in full-on bash mode unset POSIXLY_CORRECT exec bash "$0" "...
Shell
#!/bin/sh test_description='read-tree -u --reset' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree.sh # two-tree test test_expect_success 'setup' ' git init && mkdir df && echo content >df/file && git add df/file && git commit -m one && git ls-files >expect && rm -rf df && echo content >df && git...
Shell
#!/bin/sh test_description='git rebase --whitespace=fix This test runs git rebase --whitespace=fix and make sure that it works. ' . ./test-lib.sh # prepare initial revision of "file" with a blank line at the end cat >file <<EOF a b c EOF # expected contents in "file" after rebase cat >expect-first <<EOF a b c EOF...
Shell
#!/bin/sh test_description='test quickfetch from local' . ./test-lib.sh test_expect_success setup ' test_tick && echo ichi >file && git add file && git commit -m initial && cnt=$( ( git count-objects | sed -e "s/ *objects,.*//" ) ) && test $cnt -eq 3 ' test_expect_success 'clone without alternate' ' ( ...
Shell
#!/bin/sh test_description='git cat-file textconv support' . ./test-lib.sh cat >helper <<'EOF' #!/bin/sh grep -q '^bin: ' "$1" || { echo "E: $1 is not \"binary\" file" 1>&2; exit 1; } sed 's/^bin: /converted: /' "$1" EOF chmod +x helper test_expect_success 'setup ' ' echo "bin: test" >one.bin && if test_have_prere...
Shell
#!/bin/sh test_description='various @{whatever} syntax tests' . ./test-lib.sh test_expect_success 'setup' ' test_commit one && test_commit two ' check_at() { echo "$2" >expect && git log -1 --format=%s "$1" >actual && test_cmp expect actual } test_expect_success '@{0} shows current' ' check_at @{0} two ' tes...
Shell
#!/bin/sh test_description='blame output in various formats on a simple case' . ./test-lib.sh test_expect_success 'setup' ' echo a >file && git add file test_tick && git commit -m one && echo b >>file && echo c >>file && echo d >>file && test_tick && git commit -a -m two ' cat >expect <<'EOF' ^baf5e0b (A U ...
Shell
#!/bin/sh test_expect_success 'determine default pager' ' test_might_fail git config --unset core.pager && less=$( unset PAGER GIT_PAGER; git var GIT_PAGER ) && test -n "$less" ' if expr "$less" : '[a-z][a-z]*$' >/dev/null then test_set_prereq SIMPLEPAGER fi
Shell
#!/bin/sh test_description='diff --exit-code with whitespace' . ./test-lib.sh test_expect_success setup ' mkdir a b && echo >c && echo >a/d && echo >b/e && git add . && test_tick && git commit -m initial && echo " " >a/d && test_tick && git commit -a -m second && echo " " >a/d && echo " " >b/e && git ad...
Shell
#!/bin/sh # # Copyright (c) 2009, 2010 David Aguilar # test_description='git-difftool Testing basic diff tool invocation ' . ./test-lib.sh remove_config_vars() { # Unset all config variables used by git-difftool git config --unset diff.tool git config --unset diff.guitool git config --unset difftool.test-tool.c...
Shell
#!/bin/sh test_description='basic git gc tests ' . ./test-lib.sh test_expect_success 'gc empty repository' ' git gc ' test_expect_success 'gc --gobbledegook' ' test_expect_code 129 git gc --nonsense 2>err && test_i18ngrep "[Uu]sage: git gc" err ' test_expect_success 'gc -h with invalid configuration' ' mkdir b...
Shell
#!/bin/sh test_description='git rebase with its hook(s)' . ./test-lib.sh test_expect_success setup ' echo hello >file && git add file && test_tick && git commit -m initial && echo goodbye >file && git add file && test_tick && git commit -m second && git checkout -b side HEAD^ && echo world >git && git add...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git ls-files test (-- to terminate the path list). This test runs git ls-files --others with the following on the filesystem. path0 - a file -foo - a file with a funny name. -- - another file with a funny name. ' . ./test-lib.sh ...
Shell
#!/bin/sh # # Copyright (c) 2006 Eric Wong # test_description='git svn basic tests' GIT_SVN_LC_ALL=${LC_ALL:-$LANG} . ./lib-git-svn.sh say 'define NO_SVN_TESTS to skip git svn tests' case "$GIT_SVN_LC_ALL" in *.UTF-8) test_set_prereq UTF8 ;; *) say "# UTF-8 locale not set, some tests skipped ($GIT_SVN_LC_ALL)" ...
Shell
#!/bin/sh test_description='git rev-list trivial path optimization test d/z1 b0 b1 o------------------------*----o master / / o---------o----o----o----o side a0 c0 c1 a1 c2 d/f0 d/f1 d/z0 ' . ./test-lib.sh test_expect_success setup...
Shell
#!/bin/sh # There's more than one "correct" way to represent the history graphically. # These tests depend on the current behavior of the graphing code. If the # graphing code is ever changed to draw the output differently, these tests # cases will need to be updated to know about the new layout. test_description='-...
Shell
#!/bin/sh # # Copyright (c) 2007 Steven Grimm # test_description='git commit Tests for selected commit options.' . ./test-lib.sh commit_msg_is () { expect=commit_msg_is.expect actual=commit_msg_is.actual printf "%s" "$(git log --pretty=format:%s%b -1)" >$expect && printf "%s" "$1" >$actual && test_i18ncmp $ex...
Shell
#!/bin/sh test_description='git blame' . ./test-lib.sh PROG='git blame -c' . "$TEST_DIRECTORY"/annotate-tests.sh PROG='git blame -c -e' test_expect_success 'Blame --show-email works' ' check_count "<A@test.git>" 1 "<B@test.git>" 1 "<B1@test.git>" 1 "<B2@test.git>" 1 "<author@example.com>" 1 "<C@test.git>" 1 "<D@...
Shell
#!/bin/sh test_description='git init' . ./test-lib.sh check_config () { if test -d "$1" && test -f "$1/config" && test -d "$1/refs" then : happy else echo "expected a directory $1, a file $1/config and $1/refs" return 1 fi bare=$(GIT_CONFIG="$1/config" git config --bool core.bare) worktree=$(GIT_CONFIG="...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git apply symlinks and partial files ' . ./test-lib.sh test_expect_success SYMLINKS setup ' ln -s path1/path2/path3/path4/path5 link1 && git add link? && git commit -m initial && git branch side && rm -f link? && ln -s htap6 link1 && git...
Shell
#!/bin/sh test_description='rewrite diff on binary file' . ./test-lib.sh # We must be large enough to meet the MINIMUM_BREAK_SIZE # requirement. make_file() { # common first line to help identify rewrite versus regular diff printf "=\n" >file for i in 1 2 3 4 5 6 7 8 9 10 do for j in 1 2 3 4 5 6 7 8 9 do ...
Shell
#!/bin/sh test_description='Test merge without common ancestors' . ./test-lib.sh # This scenario is based on a real-world repository of Shawn Pearce. # 1 - A - D - F # \ X / # B X # X \ # 2 - C - E - G GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100" export GIT_COMMITTER_DATE test_expect_success ...
Shell
#!/bin/sh test_description='sparse checkout tests * (tag: removed, master) removed | D sub/added * (HEAD, tag: top) modified and added | M init.t | A sub/added * (tag: init) init A init.t ' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree.sh test_expect_success 'setup' ' cat >expected <<-\EOF && 100644 77f0ba1...
Shell
#!/bin/sh # # Copyright (c) 2010 Erick Mattos # test_description='git checkout --orphan Main Tests for --orphan functionality.' . ./test-lib.sh TEST_FILE=foo test_expect_success 'Setup' ' echo "Initial" >"$TEST_FILE" && git add "$TEST_FILE" && git commit -m "First Commit" && test_tick && echo "State 1" >>"$TE...
Shell
#!/bin/sh do_filename() { desc=$1 postimage=$2 rm -fr file-creation && git init file-creation && ( cd file-creation && git commit --allow-empty -m init && echo postimage >"$postimage" && git add -N "$postimage" && git diff HEAD >"../git-$desc.diff" ) && rm -fr trad-modification && mkdir trad-modifi...
Shell
#!/bin/sh test_description='signals work as we expect' . ./test-lib.sh cat >expect <<EOF three two one EOF test_expect_success 'sigchain works' ' test-sigchain >actual case "$?" in 143) true ;; # POSIX w/ SIGTERM=15 271) true ;; # ksh w/ SIGTERM=15 3) true ;; # Windows *) false ;; esac && test_cmp expect...
Shell
#!/bin/sh # # Copyright (c) 2010 Sverre Rabbelier # test_description='Test remote-helper import and export commands' . ./test-lib.sh if ! type "${BASH-bash}" >/dev/null 2>&1; then skip_all='skipping remote-testgit tests, bash not available' test_done fi compare_refs() { git --git-dir="$1/.git" rev-parse --verify...
Shell
#!/bin/sh test_description='cd_to_toplevel' . ./test-lib.sh test_cd_to_toplevel () { test_expect_success $3 "$2" ' ( cd '"'$1'"' && . "$(git --exec-path)"/git-sh-setup && cd_to_toplevel && [ "$(pwd -P)" = "$TOPLEVEL" ] ) ' } TOPLEVEL="$(pwd -P)/repo" mkdir -p repo/sub/dir mv .git repo/ SUBDIRECTOR...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='More rename detection ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success \ 'prepare reference tree' \ 'cat "$TEST_DIRECTORY"/../COPYING >COPYING && echo frotz >rezrov && git update-i...
Shell
#!/bin/sh test_description='Peter MacMillan' . ./test-lib.sh test_expect_success setup ' echo Hello >file && git add file && test_tick && git commit -m V1 && echo Hello world >file && git add file && git checkout -b other ' test_expect_success 'check all changes are staged' ' git diff --exit-code ' test_exp...
Shell
#!/bin/sh test_description="Test the svn importer's input handling routines. These tests provide some simple checks that the line_buffer API behaves as advertised. While at it, check that input of newlines and null bytes are handled correctly. " . ./test-lib.sh test_expect_success 'hello world' ' echo ">HELLO" >ex...
Shell