code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/bin/sh test_description='test cherry-picking an empty commit' . ./test-lib.sh test_expect_success setup ' echo first > file1 && git add file1 && test_tick && git commit -m "first" && git checkout -b empty-branch && test_tick && git commit --allow-empty -m "empty" && echo third >> file1 && git add file...
Shell
#!/bin/sh test_description='test that git handles an svn repository with empty symlinks' . ./lib-git-svn.sh test_expect_success 'load svn dumpfile' ' svnadmin load "$rawsvnrepo" <<EOF SVN-fs-dump-format-version: 2 UUID: 60780f9a-7df5-43b4-83ab-60e2c0673ef7 Revision-number: 0 Prop-content-length: 56 Content-length:...
Shell
#!/bin/sh test_description='basic checkout-index tests ' . ./test-lib.sh test_expect_success 'checkout-index --gobbledegook' ' test_expect_code 129 git checkout-index --gobbledegook 2>err && test_i18ngrep "[Uu]sage" err ' test_expect_success 'checkout-index -h in broken repository' ' mkdir broken && ( cd brok...
Shell
#!/bin/sh test_description='git p4 filetype tests' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' # # This series of tests checks newline handling Both p4 and # git store newlines as \n, and have options to choose how # newlines appear in checked-out files. # test_expect_success 'p4 client newlin...
Shell
#!/bin/sh test_description='credential-cache tests' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-credential.sh test -z "$NO_UNIX_SOCKETS" || { skip_all='skipping credential-cache tests, unix sockets not available' test_done } # don't leave a stale daemon running trap 'code=$?; git credential-cache exit; (exit $code); d...
Shell
#!/bin/sh test_description='wildmatch tests' . ./test-lib.sh match() { if [ $1 = 1 ]; then test_expect_success "wildmatch: match '$3' '$4'" " test-wildmatch wildmatch '$3' '$4' " else test_expect_success "wildmatch: no match '$3' '$4'" " ! test-wildmatch wildmatch '$3' '$4' " fi if [...
Shell
#!/bin/sh test_description='Intent to add' . ./test-lib.sh test_expect_success 'intent to add' ' echo hello >file && echo hello >elif && git add -N file && git add elif ' test_expect_success 'check result of "add -N"' ' git ls-files -s file >actual && empty=$(git hash-object --stdin </dev/null) && echo "1006...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git apply should not get confused with rename/copy. ' . ./test-lib.sh # setup mkdir -p klibc/arch/x86_64/include/klibc cat >klibc/arch/x86_64/include/klibc/archsetjmp.h <<\EOF /* * arch/x86_64/include/klibc/archsetjmp.h */ #ifndef _KLIBC_ARCHS...
Shell
#!/bin/sh # Copyright (c) 2007 Eric Wong test_description='git svn globbing refspecs' . ./lib-git-svn.sh cat > expect.end <<EOF the end hi start a new branch initial EOF test_expect_success 'test refspec globbing' ' mkdir -p trunk/src/a trunk/src/b trunk/doc && echo "hello world" > trunk/src/a/readme && echo "good...
Shell
#!/bin/sh test_description='test corner cases of git-archive' . ./test-lib.sh test_expect_success 'create commit with empty tree' ' git commit --allow-empty -m foo ' # Make a dir and clean it up afterwards make_dir() { mkdir "$1" && test_when_finished "rm -rf '$1'" } # Check that the dir given in "$1" contains e...
Shell
#!/bin/sh test_description='--all includes detached HEADs' . ./test-lib.sh commit () { test_tick && echo $1 > foo && git add foo && git commit -m "$1" } test_expect_success 'setup' ' commit one && commit two && git checkout HEAD^ && commit detached ' test_expect_success 'rev-list --all lists detached HE...
Shell
#!/bin/sh test_description='rebasing a commit with multi-line first paragraph.' . ./test-lib.sh test_expect_success setup ' >file && git add file && test_tick && git commit -m initial && echo hello >file && test_tick && git commit -a -m "A sample commit log message that has a long summary that spills over m...
Shell
#!/bin/sh # # Copyright (C) 2006 Martin Waitz <tali@admingilde.org> # test_description='test transitive info/alternate entries' . ./test-lib.sh # test that a file is not reachable in the current repository # but that it is after creating a info/alternate entry reachable_via() { alternate="$1" file="$2" if git cat-...
Shell
#!/bin/sh test_description='git-merge Do not overwrite changes.' . ./test-lib.sh test_expect_success 'setup' ' test_commit c0 c0.c && test_commit c1 c1.c && test_commit c1a c1.c "c1 a" && git reset --hard c0 && test_commit c2 c2.c && git reset --hard c0 && mkdir sub && echo "sub/f" > sub/f && mkdir sub2 &&...
Shell
#!/bin/sh test_description='clone --branch option' . ./test-lib.sh check_HEAD() { echo refs/heads/"$1" >expect && git symbolic-ref HEAD >actual && test_cmp expect actual } check_file() { echo "$1" >expect && test_cmp expect file } test_expect_success 'setup' ' mkdir parent && (cd parent && git init && echo...
Shell
#!/bin/sh test_description='Basic subproject functionality' . ./test-lib.sh test_expect_success 'setup: create superproject' ' : >Makefile && git add Makefile && git commit -m "Superproject created" ' test_expect_success 'setup: create subprojects' ' mkdir sub1 && ( cd sub1 && git init && : >Makefile && git add...
Shell
#!/bin/sh # # Copyright (c) 2009 Stephen Boyd # test_description='git apply --build-fake-ancestor handling.' . ./test-lib.sh test_expect_success 'setup' ' test_commit 1 && test_commit 2 && mkdir sub && test_commit 3 sub/3.t && test_commit 4 ' test_expect_success 'apply --build-fake-ancestor' ' git checkout 2 ...
Shell
#!/bin/sh test_description='git p4 rename' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' # We rely on this behavior to detect for p4 move availability. test_expect_success 'p4 help unknown returns 1' ' ( cd "$cli" && ( p4 help client >errs 2>&1 echo $? >retval ) echo 0 >expected &&...
Shell
#!/bin/sh # # Copyright (c) 2006 Shawn Pearce # test_description='git reset should cull empty subdirs' . ./test-lib.sh test_expect_success \ 'creating initial files' \ 'mkdir path0 && cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && git add path0/COPYING && git commit -m add -a' test_expect_su...
Shell
#!/bin/sh test_description='pull options' . ./test-lib.sh test_expect_success 'setup' ' mkdir parent && (cd parent && git init && echo one >file && git add file && git commit -m one) ' test_expect_success 'git pull -q' ' mkdir clonedq && (cd clonedq && git init && git pull -q "../parent" >out 2>err && tes...
Shell
#!/bin/sh test_description='test @{-N} syntax' . ./test-lib.sh make_commit () { echo "$1" > "$1" && git add "$1" && git commit -m "$1" } test_expect_success 'setup' ' make_commit 1 && git branch side && make_commit 2 && make_commit 3 && git checkout side && make_commit 4 && git merge master && git che...
Shell
#!/bin/sh test_description='git rebase --continue tests' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh set_fake_editor test_expect_success 'setup' ' test_commit "commit-new-file-F1" F1 1 && test_commit "commit-new-file-F2" F2 2 && git checkout -b topic HEAD^ && test_commit "commit-new-file-F2-on-topic-bra...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='Try various core-level commands in subdirectory. ' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree.sh test_expect_success setup ' long="a b c d e f g h i j k l m n o p q r s t u v w x y z" && for c in $long; do echo $c; done >one && mkdir dir &...
Shell
#!/bin/sh test_description='core.whitespace rules and git apply' . ./test-lib.sh prepare_test_file () { # A line that has character X is touched iff RULE is in effect: # X RULE # ! trailing-space # @ space-before-tab # # indent-with-non-tab (default tab width 8) # = indent-with-non-tab,tab...
Shell
#!/bin/sh # # Copyright (C) 2006 Martin Waitz <tali@admingilde.org> # test_description='test clone --reference' . ./test-lib.sh base_dir=`pwd` U=$base_dir/UPLOAD_LOG test_expect_success 'preparing first repository' \ 'test_create_repo A && cd A && echo first > file1 && git add file1 && git commit -m initial' cd "$...
Shell
#!/bin/sh # # Copyright (c) 2009 Johan Herland # test_description='Test "git submodule foreach" This test verifies that "git submodule foreach" correctly visits all submodules that are currently checked out. ' . ./test-lib.sh test_expect_success 'setup a submodule tree' ' echo file > file && git add file && tes...
Shell
#!/bin/sh failed_tests= fixed=0 success=0 failed=0 broken=0 total=0 while read file do while read type value do case $type in '') continue ;; fixed) fixed=$(($fixed + $value)) ;; success) success=$(($success + $value)) ;; failed) failed=$(($failed + $value)) if test $value != 0 then ...
Shell
#!/bin/sh # # Copyright (c) 2009 Eric Wong # test_description='git svn shallow clone' . ./lib-git-svn.sh test_expect_success 'setup test repository' ' svn_cmd mkdir -m "create standard layout" \ "$svnrepo"/trunk "$svnrepo"/branches "$svnrepo"/tags && svn_cmd cp -m "branch off trunk" \ "$svnrepo"/trunk "$svnre...
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='word diff colors' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh cat >pre.simple <<-\EOF h(4) a = b + c EOF cat >post.simple <<-\EOF h(4),hh[44] a = b + c aa = a aeff = aeff * ( aaa ) EOF cat >expect.letter-runs-are-words <<-\EOF <BOLD>diff --git a/pre b/post<RESET> <BOLD>ind...
Shell
#!/bin/sh # # Copyright (c) 2009 Eric Wong # test_description='git svn initial master branch is "trunk" if possible' . ./lib-git-svn.sh test_expect_success 'setup test repository' ' mkdir i && > i/a && svn_cmd import -m trunk i "$svnrepo/trunk" && svn_cmd import -m b/a i "$svnrepo/branches/a" && svn_cmd import -m...
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 test_description='test git rev-parse' . ./test-lib.sh test_rev_parse() { name=$1 shift test_expect_success "$name: is-bare-repository" \ "test '$1' = \"\$(git rev-parse --is-bare-repository)\"" shift [ $# -eq 0 ] && return test_expect_success "$name: is-inside-git-dir" \ "test '$1' = \"\$(git rev-...
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 # # Copyright (c) 2007 Lars Hjemli # test_description='git merge Testing basic merge operations/option parsing. ! [c0] commit 0 ! [c1] commit 1 ! [c2] commit 2 ! [c3] commit 3 ! [c4] c4 ! [c5] c5 ! [c6] c6 * [master] Merge commit 'c1' -------- - [master] Merge commit 'c1'...
Shell
#!/bin/sh # # Copyright (c) 2007, 2009 Sam Vilain # test_description='git-svn svn mergeinfo properties' . ./lib-git-svn.sh test_expect_success 'load svn dump' " svnadmin load -q '$rawsvnrepo' \ < '$TEST_DIRECTORY/t9151/svn-mergeinfo.dump' && git svn init --minimize-url -R svnmerge \ --rewrite-root=http://svn...
Shell
#!/bin/sh # # Copyright (c) 2006 Brian C Gernhardt # test_description='Format-patch numbering options' . ./test-lib.sh test_expect_success setup ' echo A > file && git add file && git commit -m First && echo B >> file && git commit -a -m Second && echo C >> file && git commit -a -m Third ' # Each of thes...
Shell
#!/bin/sh test_description='git blame textconv support' . ./test-lib.sh find_blame() { sed -e 's/^[^(]*//' } cat >helper <<'EOF' #!/bin/sh grep -q '^bin: ' "$1" || { echo "E: $1 is not \"binary\" file" 1>&2; exit 1; } "$PERL_PATH" -p -e 's/^bin: /converted: /' "$1" EOF chmod +x helper test_expect_success 'setup ' ...
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='errors in upload-pack' . ./test-lib.sh D=`pwd` corrupt_repo () { object_sha1=$(git rev-parse "$1") && ob=$(expr "$object_sha1" : "\(..\)") && ject=$(expr "$object_sha1" : "..\(..*\)") && rm -f ".git/objects/$ob/$ject" } test_expect_success 'setup and corrupt repository' ' echo fil...
Shell
#!/bin/sh test_description='test automatic tag following' . ./test-lib.sh # End state of the repository: # # T - tag1 S - tag2 # / / # L - A ------ O ------ B # \ \ \ # \ C - origin/cat \ # origin/master master test_expect_success ...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='Pathspec restrictions Prepare: file0 path1/file1 ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success \ setup \ 'echo frotz >file0 && mkdir path1 && echo rezrov >path1...
Shell
#!/bin/sh test_description='ls-tree with(out) globs' . ./test-lib.sh test_expect_success 'setup' ' mkdir a aa "a[a]" && touch a/one aa/two "a[a]/three" && git add a/one aa/two "a[a]/three" && git commit -m test ' test_expect_success 'ls-tree a[a] matches literally' ' cat >expected <<EOF && 100644 blob e69de29b...
Shell
#!/bin/sh # # Copyright (c) 2010 Ævar Arnfjörð Bjarmason # test_description="Gettext reencoding of our *.po/*.mo files works" . ./lib-gettext.sh # The constants used in a tricky observation for undefined behaviour RUNES="TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ" PUNTS="TILRAUN: ?? ???? ??? ?...
Shell
#!/bin/sh test_description='git cvsimport timestamps' . ./lib-cvs.sh setup_cvs_test_repository t9604 test_expect_success 'check timestamps are UTC (TZ=CST6CDT)' ' TZ=CST6CDT git cvsimport -p"-x" -C module-1 module && git cvsimport -p"-x" -C module-1 module && ( cd module-1 && git log --format="%s %ai" ) >ac...
Shell
#!/bin/sh # # Copyright (c) 2006 Catalin Marinas # test_description='git apply trying to add an ending line. ' . ./test-lib.sh # setup cat >test-patch <<\EOF diff --git a/file b/file --- a/file +++ b/file @@ -1,2 +1,3 @@ a b +c EOF echo 'a' >file echo 'b' >>file echo 'c' >>file test_expect_success setup \ '...
Shell
#!/bin/sh # # Copyright (c) 2007 Eric Wong test_description='git svn dcommit can commit renames of files with ugly names' . ./lib-git-svn.sh test_expect_success 'load repository with strange names' ' svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9115/funky-names.dump && start_httpd gtk+ ' test_expect_succ...
Shell
#!/bin/sh test_description='pushing to a mirror repository' . ./test-lib.sh D=`pwd` invert () { if "$@"; then return 1 else return 0 fi } mk_repo_pair () { rm -rf master mirror && mkdir mirror && ( cd mirror && git init && git config receive.denyCurrentBranch warn ) && mkdir master && ( cd mas...
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 test_description='git annotate' . ./test-lib.sh PROG='git annotate' . "$TEST_DIRECTORY"/annotate-tests.sh test_expect_success 'Annotating an old revision works' ' git annotate file master >result && awk "{ print \$3; }" <result >authors && test 2 = $(grep A <authors | wc -l) && test 2 = $(grep B <autho...
Shell
#!/bin/sh # # Copyright (c) 2005 Johannes Schindelin # test_description='Test git rev-parse with different parent options' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions date >path0 git update-index --add path0 save_tag tree git write-tree hide_error save_tag start unique_commit "start" ...
Shell
#!/bin/sh # After setting the fake editor with this function, you can # # - override the commit message with $FAKE_COMMIT_MESSAGE # - amend the commit message with $FAKE_COMMIT_AMEND # - check that non-commit messages have a certain line count with $EXPECT_COUNT # - check the commit count in the commit message header ...
Shell
#!/bin/sh test_description='git rebase --root Tests if git rebase --root --onto <newparent> can rebase the root commit. ' . ./test-lib.sh log_with_names () { git rev-list --topo-order --parents --pretty="tformat:%s" HEAD | git name-rev --stdin --name-only --refs=refs/heads/$1 } test_expect_success 'prepare repos...
Shell
#!/bin/sh # # Copyright (c) 2012 Michael Haggerty # test_description='Test string list functionality' . ./test-lib.sh test_split () { cat >expected && test_expect_success "split $1 at $2, max $3" " test-string-list split '$1' '$2' '$3' >actual && test_cmp expected actual && test-string-list split_in_place '$...
Shell
#!/bin/sh # # Copyright (c) 2010 Ævar Arnfjörð Bjarmason # test_description='Gettext support for Git' . ./lib-gettext.sh test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" ' test -n "$GIT_INTERNAL_GETTEXT_SH_SCHEME" ' test_expect_success 'sanity: $TEXTDOMA...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='git read-tree --prefix test. ' . ./test-lib.sh test_expect_success setup ' echo hello >one && git update-index --add one && tree=`git write-tree` && echo tree is $tree ' echo 'one two/one' >expect test_expect_success 'read-tree --prefix' ' gi...
Shell
#!/bin/sh test_description='checkout handling of ambiguous (branch/tag) refs' . ./test-lib.sh test_expect_success 'setup ambiguous refs' ' test_commit branch file && git branch ambiguity && git branch vagueness && test_commit tag file && git tag ambiguity && git tag vagueness HEAD:file && test_commit other fil...
Shell
#!/bin/sh test_description='.mailmap configurations' . ./test-lib.sh fuzz_blame () { sed " s/$_x05[0-9a-f][0-9a-f][0-9a-f]/OBJID/g s/$_x05[0-9a-f][0-9a-f]/OBJI/g s/[-0-9]\{10\} [:0-9]\{8\} [-+][0-9]\{4\}/DATE/g " "$@" } test_expect_success setup ' echo one >one && git add one && test_tick && git commit ...
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) 2006 Junio C Hamano # test_description='Binary diff and apply ' . ./test-lib.sh cat >expect.binary-numstat <<\EOF 1 1 a - - b 1 1 c - - d EOF test_expect_success 'prepare repository' ' echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d && git update-index --add a b c d && echo g...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git pack-object ' . ./test-lib.sh TRASH=`pwd` test_expect_success \ 'setup' \ 'rm -f .git/index* && "$PERL_PATH" -e "print \"a\" x 4096;" > a && "$PERL_PATH" -e "print \"b\" x 4096;" > b && "$PERL_PATH" -e "print \"c\" x 4096...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes Schindelin # test_description='our own option parser' . ./test-lib.sh cat > expect << EOF usage: test-parse-options <options> --yes get a boolean -D, --no-doubt begins with 'no-' -B, --no-fear be brave -b, --boolean inc...
Shell
#!/bin/sh # # Copyright (c) 2010 Jay Soffian # test_description='git svn --rewrite-uuid test' . ./lib-git-svn.sh uuid=6cc8ada4-5932-4b4a-8242-3534ed8a3232 test_expect_success 'load svn repo' " svnadmin load -q '$rawsvnrepo' < '$TEST_DIRECTORY/t9153/svn.dump' && git svn init --minimize-url --rewrite-uuid='$uuid' '...
Shell
#!/bin/sh test_description='git pack-object --include-tag' . ./test-lib.sh TRASH=`pwd` test_expect_success setup ' echo c >d && git update-index --add d && tree=`git write-tree` && commit=`git commit-tree $tree </dev/null` && echo "object $commit" >sig && echo "type commit" >>sig && echo "tag mytag" >>sig && ...
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='external diff interface test' . ./test-lib.sh test_expect_success setup ' test_tick && echo initial >file && git add file && git commit -m initial && test_tick && echo second >file && git add file && git commit -m second && test_tick && echo third >file ' test_expect_success...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes Sixt # test_description='git checkout-index on filesystem w/o symlinks test. This tests that git checkout-index creates a symbolic link as a plain file if core.symlinks is false.' . ./test-lib.sh test_expect_success \ 'preparation' ' git config core.symlinks false && l=$(pr...
Shell
#!/bin/sh test_description='rebase should handle arbitrary git message' . ./test-lib.sh cat >F <<\EOF This is an example of a commit log message that does not conform to git commit convention. It has two paragraphs, but its first paragraph is not friendly to oneline summary format. EOF cat >G <<\EOF commit log me...
Shell
#!/bin/sh test_expect_success PERL 'set up terminal for tests' ' # Reading from the pty master seems to get stuck _sometimes_ # on Mac OS X 10.5.0, using Perl 5.10.0 or 5.8.9. # # Reproduction recipe: run # # i=0 # while ./test-terminal.perl echo hi $i # do # : $((i = $i + 1)) # done # # After 2000 iterat...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes Sixt # test_description='merging symlinks on filesystem w/o symlink support. This tests that git merge-recursive writes merge results as plain files if core.symlinks is false.' . ./test-lib.sh test_expect_success \ 'setup' ' git config core.symlinks false && > file && git a...
Shell
#!/bin/sh test_description='diff with unmerged index entries' . ./test-lib.sh test_expect_success setup ' for i in 0 1 2 3 do blob=$(echo $i | git hash-object --stdin) && eval "blob$i=$blob" && eval "m$i=\"100644 \$blob$i $i\"" || break done && paths= && for b in o x do for o in o x do for t in o x...
Shell
#!/bin/sh # # Copyright (c) 2008 Deskin Miller # test_description='git svn partial-rebuild tests' . ./lib-git-svn.sh test_expect_success 'initialize svnrepo' ' mkdir import && ( (cd import && mkdir trunk branches tags && (cd trunk && echo foo > foo ) && svn_cmd import -m "import for git-svn" . "$svnrepo...
Shell
#!/bin/sh # # Copyright (c) 2005 Amos Waterland # test_description='git branch assorted tests' . ./test-lib.sh test_expect_success 'prepare a trivial repository' ' echo Hello >A && git update-index --add A && git commit -m "Initial commit." && echo World >>A && git update-index --add A && git commit -m "Second...
Shell
#!/bin/sh test_description='RCS merge replacement: merge-file' . ./test-lib.sh cat > orig.txt << EOF Dominus regit me, et nihil mihi deerit. In loco pascuae ibi me collocavit, super aquam refectionis educavit me; animam meam convertit, deduxit me super semitas jusitiae, propter nomen suum. EOF cat > new1.txt << EOF ...
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 test_description='git p4 client view' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' # # Verify these files exist, exactly. Caller creates # a list of files in file "files". # check_files_exist() { ok=0 && num=$# && for arg ; do test_path_is_file "$arg" && ok=$(($ok + 1)) done &...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='Three way merge with read-tree -m This test tries three-way merge with read-tree -m There is one ancestor (called O for Original) and two branches A and B derived from it. We want to do a 3-way merge between A and B, using O as the common ancestor....
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 test_description='tracking branch update checks for git push' . ./test-lib.sh test_expect_success 'setup' ' echo 1 >file && git add file && git commit -m 1 && git branch b1 && git branch b2 && git branch b3 && git clone . aa && git checkout b1 && echo b1 >>file && git commit -a -m b1 && git chec...
Shell
#!/bin/sh echo "commit message" >> "$1" echo "# comment" >> "$1" exit 0
Shell
#!/bin/sh sed -e "s/intermediate/edited/g" <"$1" >"$1-" mv "$1-" "$1" exit 0
Shell
#!/bin/sh sed -e 's/|$//' >>"$1" <<\EOF | commit message | EOF exit 0
Shell
#!/bin/sh echo "commit message" >> "$1" exit 0
Shell
#!/bin/sh echo "Signed-off-by: foo <bar@frotz>" >> "$1" exit 0
Shell
#!/bin/sh echo "# this is a new comment" >> "$1" echo "# and so is this" >> "$1" exit 0
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 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 test_description='git branch display tests' . ./test-lib.sh test_expect_success 'make commits' ' echo content >file && git add file && git commit -m one && echo content >>file && git commit -a -m two ' test_expect_success 'make branches' ' git branch branch-one && git branch branch-two HEAD^ ' test...
Shell
#!/bin/sh test_description='checkout can handle submodules' . ./test-lib.sh test_expect_success 'setup' ' mkdir submodule && (cd submodule && git init && test_commit first) && git add submodule && test_tick && git commit -m superproject && (cd submodule && test_commit second) && git add submodule && te...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git apply --stat --summary test, with --recount ' . ./test-lib.sh UNC='s/^\(@@ -[1-9][0-9]*\),[0-9]* \(+[1-9][0-9]*\),[0-9]* @@/\1,999 \2,999 @@/' num=0 while read title do num=$(( $num + 1 )) test_expect_success "$title" ' git apply --stat --s...
Shell
#!/bin/sh # # Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland # test_description='git rebase should detect patches integrated upstream This test cherry-picks one local change of two into master branch, and checks that git rebase succeeds with only the second patch in the local branch. ' . ./test-lib....
Shell
#!/bin/sh # # Copyright (c) 2013 Paul Walmsley - based on t9134 by Vitaly Shukela # test_description='git svn property tests' . ./lib-git-svn.sh test_expect_success 'setup test repository' ' svn_cmd co "$svnrepo" s && ( cd s && mkdir qqq www xxx && echo test_qqq > qqq/test_qqq.txt && echo test_www > www/tes...
Shell
#!/bin/sh test_description='git apply for contextually independent diffs' . ./test-lib.sh echo '1 2 3 4 5 6 7 8' >file test_expect_success 'setup' \ 'git add file && git commit -q -m 1 && git checkout -b test && mv file file.tmp && echo 0 >file && cat file.tmp >>file && rm file.tmp && git commit -a -q -m 2 &...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # Copyright (c) 2005 Robert Fitzsimons # test_description='git apply test for patches which require scanning forwards and backwards. ' . ./test-lib.sh test_expect_success 'git apply scan' ' git apply \ "$TEST_DIRECTORY/t4110/patch1.patch" \ "$TEST_DIRECTORY/t4110/...
Shell
#!/bin/sh test_description='git p4 submit' . ./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" ) ' test_expect_failure 'is_cli_file_writeable function' ' ( cd "$cli" && echo a ...
Shell
#!/bin/sh . ./test-lib.sh unset CVS_SERVER if ! type cvs >/dev/null 2>&1 then skip_all='skipping cvsimport tests, cvs not found' test_done fi CVS="cvs -f" export CVS cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'` case "$cvsps_version" in 2.1 | 2.2*) ;; '') skip_all='skipping cvsimport tests, cvs...
Shell
#!/bin/sh # # Copyright (c) 2007 Junio C Hamano # test_description='Test prune and reflog expiration' . ./test-lib.sh check_have () { gaah= && for N in "$@" do eval "o=\$$N" && git cat-file -t $o || { echo Gaah $N gaah=$N break } done && test -z "$gaah" } check_fsck () { output=$(git fsck --full) ...
Shell
#!/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_c...
Shell
#!/bin/sh test_description='subtree merge strategy' . ./test-lib.sh test_expect_success setup ' s="1 2 3 4 5 6 7 8" && for i in $s; do echo $i; done >hello && git add hello && git commit -m initial && git checkout -b side && echo >>hello world && git add hello && git commit -m second && git checkout master...
Shell
#!/bin/sh test_description='git repack works correctly' . ./test-lib.sh test_expect_success 'objects in packs marked .keep are not repacked' ' echo content1 > file1 && echo content2 > file2 && git add . && test_tick && git commit -m initial_commit && # Create two packs # The first pack will contain all of the...
Shell