code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/bin/sh test_description='tests remote-svn' . ./test-lib.sh MARKSPATH=.git/info/fast-import/remote-svn if ! test_have_prereq PYTHON then skip_all='skipping remote-svn tests, python not available' test_done fi # Override svnrdump with our simulator PATH="$HOME:$PATH" export PATH PYTHON_PATH GIT_BUILD_DIR write...
Shell
#!/bin/sh # # Copyright (c) 2005 Johannes Schindelin # test_description='A simple turial in the form of a test case' . ./test-lib.sh test_expect_success 'blob' ' echo "Hello World" > hello && echo "Silly example" > example && git update-index --add hello example && test blob = "$(git cat-file -t 557db03)" ' ...
Shell
#!/bin/sh # # Copyright (c) 2007 Carlos Rica # test_description='git stripspace' . ./test-lib.sh t40='A quick brown fox jumps over the lazy do' s40=' ' sss="$s40$s40$s40$s40$s40$s40$s40$s40$s40$s40" # 400 ttt="$t40$t40$t40$t40$t40$t40$t40$t40$t40$t40" # 400 test_expect_success...
Shell
#!/bin/sh test_description='detect unwritable repository and fail correctly' . ./test-lib.sh test_expect_success setup ' >file && git add file && test_tick && git commit -m initial && echo >file && git add file ' test_expect_success POSIXPERM,SANITY 'write-tree should notice unwritable repository' ' test_w...
Shell
#!/bin/sh test_description=' Miscellaneous tests for git ls-tree. 1. git ls-tree fails in presence of tree damage. ' . ./test-lib.sh test_expect_success 'setup' ' mkdir a && touch a/one && git add a/one && git commit -m test ' test_expect_success 'ls-tree fails with non-zero exit code on broken tree' '...
Shell
#!/bin/sh # # Copyright (c) 2010 Johan Herland # test_description='Test notes merging with manual conflict resolution' . ./test-lib.sh # Set up a notes merge scenario with different kinds of conflicts test_expect_success 'setup commits' ' test_commit 1st && test_commit 2nd && test_commit 3rd && test_commit 4th &...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='git rebase --merge test' . ./test-lib.sh T="A quick brown fox jumps over the lazy dog." for i in 1 2 3 4 5 6 7 8 9 10 do echo "$i $T" done >original test_expect_success setup ' git add original && git commit -m"initial" && git branch side && e...
Shell
#!/bin/sh test_description='basic ls-files tests This test runs git ls-files with various unusual or malformed command-line arguments. ' . ./test-lib.sh >empty test_expect_success 'ls-files in empty repository' ' git ls-files >actual && test_cmp empty actual ' test_expect_success 'ls-files with nonexistent path...
Shell
#!/bin/sh # # Copyright (c) 2009 Robert Allan Zeh test_description='git svn gc basic tests' . ./lib-git-svn.sh test_expect_success 'setup directories and test repo' ' mkdir import && mkdir tmp && echo "Sample text for Subversion repository." > import/test.txt && svn_cmd import -m "import for git svn" import "$sv...
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 && echo "one text" > .gitattributes && for w in Hello world how are you; do echo $w; done >one && for w in I am very very fine thank you;...
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 # # Copyright (c) 2005 Junio C Hamano # test_description='Rename interaction with pathspec. ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success 'prepare reference tree' ' mkdir path0 path1 && cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && git update-ind...
Shell
#!/bin/sh # # Copyright (c) 2008 Stephen Haberman # test_description='git rebase preserve merges This test runs git rebase with preserve merges and ensures commits dropped by the --cherry-pick flag have their childrens parents rewritten. ' . ./test-lib.sh # set up two branches like this: # # A - B - C - D - E # \ ...
Shell
#!/bin/sh test_description='merge simplification' . ./test-lib.sh note () { git tag "$1" } unnote () { git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g" } test_expect_success setup ' echo "Hi there" >file && git add file && test_tick && git commit -m "Initial file" && note A && git bra...
Shell
#!/bin/sh test_description='git reset in a bare repository' . ./test-lib.sh test_expect_success 'setup non-bare' ' echo one >file && git add file && git commit -m one && echo two >file && git commit -a -m two ' test_expect_success '"hard" reset requires a worktree' ' (cd .git && test_must_fail git reset --ha...
Shell
#!/bin/sh test_description='remote push rejects are reported by client' . ./test-lib.sh test_expect_success 'setup' ' mkdir .git/hooks && (echo "#!/bin/sh" ; echo "exit 1") >.git/hooks/update && chmod +x .git/hooks/update && echo 1 >file && git add file && git commit -m 1 && git clone . child && cd child && ...
Shell
#!/bin/sh # Copyright (c) 2006 Eric Wong test_description='git svn metadata migrations from previous versions' . ./lib-git-svn.sh test_expect_success 'setup old-looking metadata' ' cp "$GIT_DIR"/config "$GIT_DIR"/config-old-git-svn && mkdir import && ( cd import && for i in trunk branches/a branches/b tags/0.1 ...
Shell
#!/bin/sh test_description='checkout and pathspecs/refspecs ambiguities' . ./test-lib.sh test_expect_success 'setup' ' echo hello >world && echo hello >all && git add all world && git commit -m initial && git branch world ' test_expect_success 'reference must be a tree' ' test_must_fail git checkout $(git has...
Shell
#!/bin/sh test_description='merging when a directory was replaced with a symlink' . ./test-lib.sh test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink' ' mkdir -p a/b/c a/b-2/c && > a/b/c/d && > a/b-2/c/d && > a/x && git add -A && git commit -m base && git tag start && rm -rf a/b && ...
Shell
#!/bin/sh test_description='rewrite diff' . ./test-lib.sh test_expect_success setup ' cat "$TEST_DIRECTORY"/../COPYING >test && git add test && tr \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \ "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \ <"$TEST_DIRECTORY"/../COPYING >test && e...
Shell
#!/bin/sh # # Copyright (c) 2007 Christian Couder # test_description='Tests git bisect functionality' exec </dev/null . ./test-lib.sh add_line_into_file() { _line=$1 _file=$2 if [ -f "$_file" ]; then echo "$_line" >> $_file || return $? MSG="Add <$_line> into <$_file>." else ...
Shell
: included from t2016 and others . ./test-lib.sh set_state () { echo "$3" > "$1" && git add "$1" && echo "$2" > "$1" } save_state () { noslash="$(echo "$1" | tr / _)" && cat "$1" > _worktree_"$noslash" && git show :"$1" > _index_"$noslash" } set_and_save_state () { set_state "$@" && save_state "$1" } verif...
Shell
#!/bin/sh test_description='diff hunk fusing' . ./test-lib.sh f() { echo $1 i=1 while test $i -le $2 do echo $i i=$(expr $i + 1) done echo $3 } t() { case $# in 4) hunks=$4; cmd="diff -U$3";; 5) hunks=$5; cmd="diff -U$3 --inter-hunk-context=$4";; esac label="$cmd, $1 common $2" file=f$1 expected=ex...
Shell
#!/bin/sh test_description='Revision traversal vs grafts and path limiter' . ./test-lib.sh test_expect_success setup ' mkdir subdir && echo >fileA fileA && echo >subdir/fileB fileB && git add fileA subdir/fileB && git commit -a -m "Initial in one history." && A0=`git rev-parse --verify HEAD` && echo >fileA f...
Shell
#!/bin/sh test_description='test conversion filters on large files' . ./test-lib.sh set_attr() { test_when_finished 'rm -f .gitattributes' && echo "* $*" >.gitattributes } check_input() { git read-tree --empty && git add small large && git cat-file blob :small >small.index && git cat-file blob :large | head -n...
Shell
#!/bin/sh # # Copyright (c) 2006 Eric Wong test_description='git svn commit-diff clobber' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' mkdir import && ( cd import && echo initial >file && svn_cmd import -m "initial" . "$svnrepo" ) && echo initial > file && git update-index --add file && git c...
Shell
#!/bin/sh test_description='git apply --3way' . ./test-lib.sh create_file () { for i do echo "$i" done } sanitize_conflicted_diff () { sed -e ' /^index /d s/^\(+[<>][<>][<>][<>]*\) .*/\1/ ' } test_expect_success setup ' test_tick && create_file >one 1 2 3 4 5 6 7 && cat one >two && git add one two &...
Shell
#!/bin/sh test_description='git rev-list --pretty=format test' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-terminal.sh test_tick test_expect_success 'setup' ' touch foo && git add foo && git commit -m "added foo" && echo changed >foo && git commit -a -m "changed foo" ' # usage: test_format name format_string <expecte...
Shell
#!/bin/sh test_description='fetching and pushing project with subproject' . ./test-lib.sh test_expect_success setup ' test_tick && mkdir -p sub && ( cd sub && git init && >subfile && git add subfile && git commit -m "subproject commit #1" ) && >mainfile && git add sub mainfile && test_tick && git co...
Shell
#!/bin/sh test_description='basic work tree status reporting' . ./test-lib.sh test_expect_success setup ' test_commit A && test_commit B oneside added && git checkout A^0 && test_commit C oneside created ' test_expect_success 'A/A conflict' ' git checkout B^0 && test_must_fail git merge C ' test_expect_succe...
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 test_description='combined and merge diff handle binary files and textconv' . ./test-lib.sh test_expect_success 'setup binary merge conflict' ' echo oneQ1 | q_to_nul >binary && git add binary && git commit -m one && echo twoQ2 | q_to_nul >binary && git commit -a -m two && git checkout -b branch-binary...
Shell
#!/bin/sh test_description='git reset --patch' . ./lib-patch-mode.sh test_expect_success PERL 'setup' ' mkdir dir && echo parent > dir/foo && echo dummy > bar && git add dir && git commit -m initial && test_tick && test_commit second dir/foo head && set_and_save_state bar bar_work bar_index && save_head ' #...
Shell
#!/bin/sh test_description='test git rev-parse diagnosis for invalid argument' exec </dev/null . ./test-lib.sh test_did_you_mean () { sq="'" && cat >expected <<-EOF && fatal: Path '$2$3' $4, but not ${5:-$sq$3$sq}. Did you mean '$1:$2$3'${2:+ aka $sq$1:./$3$sq}? EOF test_cmp expected error } HASH_file= test...
Shell
#!/bin/sh # # Copyright (c) 2009, Red Hat Inc, Author: Michael S. Tsirkin (mst@redhat.com) # 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 co...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='git update-index --again test. ' . ./test-lib.sh cat > expected <<\EOF 100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad 0 file1 100644 9db8893856a8a02eaa73470054b7c1c5a7c82e47 0 file2 EOF test_expect_success 'update-index --add' \ 'echo hello world ...
Shell
#!/bin/sh out_prefix=$(dirname "$0")/../test-results/valgrind.out output= count=0 total_count=0 missing_message= new_line=' ' # start outputting the current valgrind error in $out_prefix.++$count, # and the test case which failed in the corresponding .message file start_output () { test -z "$output" || return # pr...
Shell
#!/bin/sh base=$(basename "$0") TRACK_ORIGINS= VALGRIND_VERSION=$(valgrind --version) VALGRIND_MAJOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*\([0-9]*\)') VALGRIND_MINOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*[0-9]*\.\([0-9]*\)') test 3 -gt "$VALGRIND_MAJOR" || test 3 -eq "$VALGRIND_MAJOR" -a 4 -gt "$VALGRIND_MINOR" || TR...
Shell
#!/bin/sh test_description='git p4 preserve users' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' test_expect_success 'create files' ' ( cd "$cli" && p4 client -o | sed "/LineEnd/s/:.*/:unix/" | p4 client -i && echo file1 >file1 && echo file2 >file2 && p4 add file1 file2 && p4 submit ...
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='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 # # Copyright (c) 2010 Ævar Arnfjörð Bjarmason # test_description='Gettext Shell poison' . ./lib-gettext.sh test_expect_success GETTEXT_POISON "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" ' test -n "$GIT_INTERNAL_GETTEXT_SH_SCHEME" ' test_expect_success GETTEX...
Shell
#!/bin/sh # # Copyright (c) 2012 Zbigniew Jędrzejewski-Szmek # test_description='test --stat output of various commands' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-terminal.sh # 120 character name name=aaaaaaaaaa name=$name$name$name$name$name$name$name$name$name$name$name$name test_expect_success 'preparation' ' >"$n...
Shell
#!/bin/sh test_description='merging with large rename matrix' . ./test-lib.sh count() { i=1 while test $i -le $1; do echo $i i=$(($i + 1)) done } test_expect_success 'setup (initial)' ' touch file && git add . && git commit -m initial && git tag initial ' make_text() { echo $1: $2 for i in `count 20`; ...
Shell
#!/bin/sh test_description='blob conversion via gitattributes' . ./test-lib.sh cat <<EOF >rot13.sh #!$SHELL_PATH tr \ 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \ 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM' EOF chmod +x rot13.sh test_expect_success setup ' git config filter.rot13.smudge ...
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 # # Copyright (c) 2008 Eric Wong test_description='git svn honors i18n.commitEncoding in config' . ./lib-git-svn.sh compare_git_head_with () { nr=`wc -l < "$1"` a=7 b=$(($a + $nr - 1)) git cat-file commit HEAD | sed -ne "$a,${b}p" >current && test_cmp current "$1" } a_utf8_locale=$(locale -a | sed -n...
Shell
#!/bin/sh # # Copyright (c) 2009 Johan Herland # test_description='test git fast-import of notes objects' . ./test-lib.sh test_tick cat >input <<INPUT_END commit refs/heads/master committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE data <<COMMIT first commit COMMIT M 644 inline foo data <<EOF f...
Shell
#!/bin/sh test_description='prepare-commit-msg hook' . ./test-lib.sh test_expect_success 'with no hook' ' echo "foo" > file && git add file && git commit -m "first" ' # set up fake editor for interactive editing cat > fake-editor <<'EOF' #!/bin/sh exit 0 EOF chmod +x fake-editor ## Not using test_set_editor h...
Shell
#!/bin/sh test_description="Test whether cache-tree is properly updated Tests whether various commands properly update and/or rewrite the cache-tree extension. " . ./test-lib.sh cmp_cache_tree () { test-dump-cache-tree >actual && sed "s/$_x40/SHA/" <actual >filtered && test_cmp "$1" filtered } # We don't bother...
Shell
#!/bin/sh test_description='git fsck random collection of tests * (HEAD) B * (master) A ' . ./test-lib.sh test_expect_success setup ' git config gc.auto 0 && git config i18n.commitencoding ISO-8859-1 && test_commit A fileA one && git config --unset i18n.commitencoding && git checkout HEAD^0 && test_commit B f...
Shell
#!/bin/sh test_description='format-patch -s should force MIME encoding as needed' . ./test-lib.sh test_expect_success setup ' >F && git add F && git commit -m initial && echo new line >F && test_tick && git commit -m "This adds some lines to F" F ' test_expect_success 'format normally' ' git format-patch...
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) 2005 Junio C Hamano # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This program is di...
Shell
#!/bin/sh test_description='fetching and pushing, with or without wildcard' . ./test-lib.sh D=`pwd` mk_empty () { rm -fr testrepo && mkdir testrepo && ( cd testrepo && git init && git config receive.denyCurrentBranch warn && mv .git/hooks .git/hooks-disabled ) } mk_test () { mk_empty && ( for ref i...
Shell
#!/bin/sh 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 && echo 2 >b && git add . && git commit -a -m second ' test_expect_success 'git diff --quiet -w HEAD^^ HEAD^' ...
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='test GIT_CEILING_DIRECTORIES' . ./test-lib.sh test_prefix() { test_expect_success "$1" \ "test '$2' = \"\$(git rev-parse --show-prefix)\"" } test_fail() { test_expect_success "$1: prefix" ' test_expect_code 128 git rev-parse --show-prefix ' } TRASH_ROOT="$PWD" ROOT_PARENT=$(dirname...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This program is di...
Shell
#!/bin/sh # # Copyright (c) 2012 Felipe Contreras # test_description='test bash completion' . ./lib-bash.sh complete () { # do nothing return 0 } # Be careful when updating this list: # # (1) The build tree may have build artifact from different branch, or # the user's $PATH may have a random executable that ...
Shell
#!/bin/sh test_description='basic update-index tests Tests for command-line parsing and basic operation. ' . ./test-lib.sh test_expect_success 'update-index --nonsense fails' ' test_must_fail git update-index --nonsense 2>msg && cat msg && test -s msg ' test_expect_success 'update-index --nonsense dumps usage' ...
Shell
#!/bin/sh # # Copyright (c) 2006, Junio C Hamano # test_description='fmt-merge-msg test' . ./test-lib.sh test_expect_success setup ' echo one >one && git add one && test_tick && git commit -m "Initial" && git clone . remote && echo uno >one && echo dos >two && git add two && test_tick && git commit -a -m...
Shell
#!/bin/sh test_description='checkout can switch to last branch and merge base' . ./test-lib.sh test_expect_success 'setup' ' echo hello >world && git add world && git commit -m initial && git branch other && echo "hello again" >>world && git add world && git commit -m second ' test_expect_success '"checkout ...
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...
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) 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 test_description='verbose commit template' . ./test-lib.sh cat >check-for-diff <<EOF #!$SHELL_PATH exec grep '^diff --git' "\$1" EOF chmod +x check-for-diff test_set_editor "$PWD/check-for-diff" cat >message <<'EOF' subject body EOF test_expect_success 'setup' ' echo content >file && git add file && g...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='git grep various. ' . ./test-lib.sh cat >hello.c <<EOF #include <stdio.h> int main(int argc, const char **argv) { printf("Hello world.\n"); return 0; /* char ?? */ } EOF test_expect_success setup ' { echo foo mmap bar echo foo_mmap bar ec...
Shell
#!/bin/sh test_description='cherry picking and reverting a merge b---c / / initial---a ' . ./test-lib.sh test_expect_success setup ' >A && >B && git add A B && git commit -m "Initial" && git tag initial && git branch side && echo new line >A && git commit -m "add line to A" A && git tag a &&...
Shell
#!/bin/sh test_description="git merge Testing a custom strategy. * (HEAD, master) Merge commit 'c3' |\ | * (tag: c3) c3 * | (tag: c1) c1 |/ | * tag: c2) c2 |/ * (tag: c0) c0 " . ./test-lib.sh test_expect_success 'set up custom strategy' ' cat >git-merge-theirs <<-EOF && #!$SHELL_PATH eval git read-tree --rese...
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 # # Copyright (c) 2006 Eric Wong # test_description='git svn fetching' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' mkdir import && ( cd import && mkdir -p trunk && echo hello >trunk/readme && svn_cmd import -m "initial" . "$svnrepo" ) && svn_cmd co "$svnrepo" wc && ( cd wc && ...
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='diff --relative tests' . ./test-lib.sh test_expect_success 'setup' ' git commit --allow-empty -m empty && echo content >file1 && mkdir subdir && echo other content >subdir/file2 && git add . && git commit -m one ' check_diff() { expect=$1; shift cat >expected <<EOF diff --git a/$exp...
Shell
#!/bin/sh # # Copyright (c) 2006 Eric Wong # test_description='git svn property tests' . ./lib-git-svn.sh mkdir import a_crlf= a_lf= a_cr= a_ne_crlf= a_ne_lf= a_ne_cr= a_empty= a_empty_lf= a_empty_cr= a_empty_crlf= cd import cat >> kw.c <<\EOF /* Somebody prematurely put a keyword into this file */ /* $Id$ */ EOF ...
Shell
#!/bin/sh test_description='git mktree' . ./test-lib.sh test_expect_success setup ' for d in a a. a0 do mkdir "$d" && echo "$d/one" >"$d/one" && git add "$d" done && echo zero >one && git update-index --add --info-only one && git write-tree --missing-ok >tree.missing && git ls-tree $(cat tree.missing) >to...
Shell
#!/bin/sh # # Copyright (c) 2007 Frank Lichtenheld # test_description='git-cvsserver access tests read access to a git repository with the cvs CLI client via git-cvsserver server' . ./test-lib.sh if ! test_have_prereq PERL; then skip_all='skipping git cvsserver tests, perl not available' test_done fi cvs >/dev/nu...
Shell
#!/bin/sh test_description='git cat-file' . ./test-lib.sh echo_without_newline () { printf '%s' "$*" } strlen () { echo_without_newline "$1" | wc -c | sed -e 's/^ *//' } maybe_remove_timestamp () { if test -z "$2"; then echo_without_newline "$1" else echo_without_newline "$(printf '%s\n' "...
Shell
#!/bin/sh test_description='git column' . ./test-lib.sh test_expect_success 'setup' ' cat >lista <<\EOF one two three four five six seven eight nine ten eleven EOF ' test_expect_success 'never' ' git column --indent=Z --mode=never <lista >actual && test_cmp lista actual ' test_expect_success 'always' ' cat >exp...
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 test_description='check pre-push hooks' . ./test-lib.sh # Setup hook that always succeeds HOOKDIR="$(git rev-parse --git-dir)/hooks" HOOK="$HOOKDIR/pre-push" mkdir -p "$HOOKDIR" write_script "$HOOK" <<EOF cat >/dev/null exit 0 EOF test_expect_success 'setup' ' git config push.default upstream && git init...
Shell
#!/bin/sh test_description='diff function context' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh cat <<\EOF >hello.c #include <stdio.h> static int a(void) { /* * Dummy. */ } static int hello_world(void) { /* Classic. */ printf("Hello world.\n"); /* Success! */ return 0; } static int b(void) { /* * ...
Shell
#!/bin/sh test_description='test subject preservation with format-patch | am' . ./test-lib.sh make_patches() { type=$1 subject=$2 test_expect_success "create patches with $type subject" ' git reset --hard baseline && echo $type >file && git commit -a -m "$subject" && git format-patch -1 --stdout >$type.pat...
Shell
#!/bin/sh test_description="Tests of cwd/prefix/worktree/gitdir setup in all cases A few rules for repo setup: 1. GIT_DIR is relative to user's cwd. --git-dir is equivalent to GIT_DIR. 2. .git file is relative to parent directory. .git file is basically symlink in disguise. The directory where .git file point...
Shell
#!/bin/sh test_description='git log' . ./test-lib.sh test_expect_success setup ' echo one >one && git add one && test_tick && git commit -m initial && echo ichi >one && git add one && test_tick && git commit -m second && git mv one ichi && test_tick && git commit -m third && cp ichi ein && git add e...
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 test_description='cherry-pick should rerere for conflicts' . ./test-lib.sh test_expect_success setup ' echo foo >foo && git add foo && test_tick && git commit -q -m 1 && echo foo-master >foo && git add foo && test_tick && git commit -q -m 2 && git checkout -b dev HEAD^ && echo foo-dev >foo && git a...
Shell
#!/bin/sh test_description='git p4 rcs keywords' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' # # Make one file with keyword lines at the top, and # enough plain text to be able to test modifications # far away from the keywords. # test_expect_success 'init depot' ' ( cd "$cli" && cat <<-\E...
Shell
#!/bin/sh # # Copyright (c) 2005 Fredrik Kuivinen # test_description='Test merge with directory/file conflicts' . ./test-lib.sh test_expect_success 'prepare repository' ' echo Hello >init && git add init && git commit -m initial && git branch B && mkdir dir && echo foo >dir/foo && git add dir/foo && git comm...
Shell
#!/bin/sh # # Copyright (c) 2008 David Aguilar # test_description='git submodule sync These tests exercise the "git submodule sync" subcommand. ' . ./test-lib.sh test_expect_success setup ' echo file > file && git add file && test_tick && git commit -m upstream && git clone . super && git clone super submodul...
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 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 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) 2005 Junio C Hamano # test_description='git apply handling binary patches ' . ./test-lib.sh test_expect_success 'setup' ' cat >file1 <<-\EOF && A quick brown fox jumps over the lazy dog. A tiny little penguin runs around in circles. There is a flag with Linux written on it. A slow bl...
Shell
#!/bin/sh test_description='test config file include directives' . ./test-lib.sh test_expect_success 'include file by absolute path' ' echo "[test]one = 1" >one && echo "[include]path = \"$(pwd)/one\"" >.gitconfig && echo 1 >expect && git config test.one >actual && test_cmp expect actual ' test_expect_success '...
Shell
#!/bin/sh test_description='git p4 wildcards' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' test_expect_success 'add p4 files with wildcards in the names' ' ( cd "$cli" && printf "file2\nhas\nsome\nrandom\ntext\n" >file2 && p4 add file2 && echo file-wild-hash >file-wild#hash && if test...
Shell
#!/bin/sh # # Copyright (c) 2007 Carlos Rica # test_description='git tag Tests for operations with tags.' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-gpg.sh # creating and listing lightweight tags: tag_exists () { git show-ref --quiet --verify refs/tags/"$1" } # todo: git tag -l now returns always zero, when fixed, ...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes E. Schindelin # test_description='git rev-list involving submodules that this repo has' . ./test-lib.sh test_expect_success 'setup' ' : > file && git add file && test_tick && git commit -m initial && echo 1 > file && test_tick && git commit -m second file && echo 2 >...
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) 2010 Andreas Gruenbacher # test_description='git apply filename consistency check' . ./test-lib.sh test_expect_success setup ' cat > bad1.patch <<EOF && diff --git a/f b/f new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/f-blah @@ -0,0 +1 @@ +1 EOF cat > bad2.patch <<EOF ...
Shell