code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/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 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) 2008 Christian Couder # test_description='Tests replace refs functionality' exec </dev/null . ./test-lib.sh add_and_commit_file() { _file="$1" _msg="$2" git add $_file || return $? test_tick || return $? git commit --quiet -m "$_file: $_msg" } HASH1= HASH2= HASH3= HA...
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 # # Copyright (c) 2005 Amos Waterland # Copyright (c) 2006 Christian Couder # test_description='git pack-refs should not change the branch semantic This test runs git pack-refs and git show-ref and checks that the branch semantic is still the same. ' . ./test-lib.sh echo '[core] logallrefupdates = true' >>...
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='test git rev-parse --parseopt' . ./test-lib.sh cat > expect <<\END_EXPECT cat <<\EOF usage: some-command [options] <args>... some-command does foo and bar! -h, --help show the help --foo some nifty option --foo --bar ... some cool op...
Shell
#!/bin/sh # # Copyright (c) 2005 Johannes Schindelin # test_description='Test diff of symlinks. ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh cat > expected << EOF diff --git a/frotz b/frotz new file mode 120000 index 0000000..7c465af --- /dev/null +++ b/frotz @@ -0,0 +1 @@ +xyzzy \ No newline at end of file EOF...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git apply should handle files with incomplete lines. ' . ./test-lib.sh # setup (echo a; echo b) >frotz.0 (echo a; echo b; echo c) >frotz.1 (echo a; echo b | tr -d '\012') >frotz.2 (echo a; echo c; echo b | tr -d '\012') >frotz.3 for i in 0 1 2 3 d...
Shell
#!/bin/sh test_description='read-tree -m -u checks working tree files' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree.sh # two-tree test test_expect_success 'two-way setup' ' mkdir subdir && echo >file1 file one && echo >file2 file two && echo >subdir/file1 file one in subdirectory && echo >subdir/file2 fi...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='git checkout tests. Creates master, forks renamer and side branches from it. Test switching across them. ! [master] Initial A one, A two * [renamer] Renamer R one->uno, M two ! [side] Side M one, D two, A three ! [simple] Simple D one,...
Shell
#!/bin/sh # # Copyright (c) 2009 Greg Price # test_description='git rebase -p should respect --onto In a rebase with --onto, we should rewrite all the commits that aren'"'"'t on top of $ONTO, even if they are on top of $UPSTREAM. ' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh # Set up branches like this: # A1-...
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) 2010, Will Palmer # test_description='Test pretty formats' . ./test-lib.sh test_expect_success 'set up basic repos' ' >foo && >bar && git add foo && test_tick && git commit -m initial && git add bar && test_tick && git commit -m "add bar" ' test_expect_success 'alias builtin forma...
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='basic clone 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 'clone -o' ' git clone -o foo parent clone-o && (cd clone-o && git rev-parse --verify refs/rem...
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 test_description='test date parsing and printing' . ./test-lib.sh # arbitrary reference time: 2009-08-30 19:20:00 TEST_DATE_NOW=1251660000; export TEST_DATE_NOW check_show() { t=$(($TEST_DATE_NOW - $1)) echo "$t -> $2" >expect test_expect_${3:-success} "relative date ($2)" " test-date show $t >actual &...
Shell
#!/bin/sh # # Portions copyright (c) 2007, 2009 Sam Vilain # Portions copyright (c) 2011 Bryan Jacobs # test_description='git-svn svn mergeinfo propagation' . ./lib-git-svn.sh test_expect_success 'load svn dump' " svnadmin load -q '$rawsvnrepo' \ < '$TEST_DIRECTORY/t9161/branches.dump' && git svn init --minimiz...
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='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
#!/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 && grep "[Uu]sage" err ' test_expect_success 'checkout-index -h in broken repository' ' mkdir broken && ( cd broken && g...
Shell
#!/bin/sh test_description='Various filesystem issues' . ./test-lib.sh auml=$(printf '\303\244') aumlcdiar=$(printf '\141\314\210') case_insensitive= unibad= no_symlinks= test_expect_success 'see what we expect' ' test_case=test_expect_success && test_unicode=test_expect_success && mkdir junk && echo good >jun...
Shell
#!/bin/sh test_description='ls-tree with(out) globs' . ./test-lib.sh test_expect_success NOT_MINGW '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 NOT_MINGW 'ls-tree a* matches literally' ' cat >expected <<EOF && 10...
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 # # Copyright (c) 2009 Christian Couder # test_description='Tests for "git reset" with "--merge" and "--keep" options' . ./test-lib.sh test_expect_success setup ' for i in 1 2 3; do echo line $i; done >file1 && cat file1 >file2 && git add file1 file2 && test_tick && git commit -m "Initi...
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 # # Copyright (c) 2010 Stefan-W. Hahn # test_description='git-am mbox with dos line ending. ' . ./test-lib.sh # Three patches which will be added as files with dos line ending. cat >file1 <<\EOF line 1 EOF cat >file1a <<\EOF line 1 line 4 EOF cat >file2 <<\EOF line 1 line 2 EOF cat >file3 <<\EOF line 1...
Shell
#!/bin/sh test_description='checkout ' . ./test-lib.sh # Arguments: <branch> <sha> [<checkout options>] # # Runs "git checkout" to switch to <branch>, testing that # # 1) we are on the specified branch, <branch>; # 2) HEAD is <sha>; if <sha> is not specified, the old HEAD is used. # # If <checkout options> is no...
Shell
#!/bin/sh test_description='git rev-list --max-count and --skip test' . ./test-lib.sh test_expect_success 'setup' ' for n in 1 2 3 4 5 ; do \ echo $n > a ; \ git add a ; \ git commit -m "$n" ; \ done ' test_expect_success 'no options' ' test $(git rev-list HEAD | wc -l) = 5 ' te...
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='check svn dumpfile importer' . ./test-lib.sh reinit_git () { rm -fr .git && git init } properties () { while test "$#" -ne 0 do property="$1" && value="$2" && printf "%s\n" "K ${#property}" && printf "%s\n" "$property" && printf "%s\n" "V ${#value}" && printf "%s\n" "$val...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='More rename detection tests. The rename detection logic should be able to detect pure rename or copy of symbolic links, but should not produce rename/copy followed by an edit for them. ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh test_expect_su...
Shell
: Included from t1000-read-tree-m-3way.sh and others # Original tree. mkdir Z for a in N D M do for b in N D M do p=$a$b echo This is $p from the original tree. >$p echo This is Z/$p from the original tree. >Z/$p test_expect_success \ "adding test file $p and Z/$p" \ 'git update-index --add...
Shell
#!/bin/sh test_description='git remote group handling' . ./test-lib.sh mark() { echo "$1" >mark } update_repo() { (cd $1 && echo content >>file && git add file && git commit -F ../mark) } update_repos() { update_repo one $1 && update_repo two $1 } repo_fetched() { if test "`git log -1 --pretty=format:%s $1...
Shell
#!/bin/sh test_description='diff -r -t shows directory additions and deletions' . ./test-lib.sh test_expect_success setup ' mkdir dc dr dt && >dc/1 && >dr/2 && >dt/3 && >fc && >fr && >ft && git add . && test_tick && git commit -m initial && rm -fr dt dr ft fr && mkdir da ft && for p in dc/1 da/4 dt ft/...
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='git blame encoding conversion' . ./test-lib.sh . "$TEST_DIRECTORY"/t8005/utf8.txt . "$TEST_DIRECTORY"/t8005/euc-japan.txt . "$TEST_DIRECTORY"/t8005/sjis.txt test_expect_success 'setup the repository' ' # Create the file echo "UTF-8 LINE" > file && git add file && git commit --author "...
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 # # Copyright (c) 2006 Carl D. Worth # test_description='Test of the various options to git rm.' . ./test-lib.sh # Setup some files to be removed, some with funny characters test_expect_success \ 'Initialize test directory' \ "touch -- foo bar baz 'space embedded' -q && git add -- foo bar baz ...
Shell
#!/bin/sh test_description='git checkout --patch' . ./lib-patch-mode.sh test_expect_success PERL 'setup' ' mkdir dir && echo parent > dir/foo && echo dummy > bar && git add bar dir/foo && git commit -m initial && test_tick && test_commit second dir/foo head && echo index > dir/foo && git add dir/foo && set_...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='Merge base and parent list computation. ' . ./test-lib.sh M=1130000000 Z=+0000 GIT_COMMITTER_EMAIL=git@comm.iter.xz GIT_COMMITTER_NAME='C O Mmiter' GIT_AUTHOR_NAME='A U Thor' GIT_AUTHOR_EMAIL=git@au.thor.xz export GIT_COMMITTER_EMAIL GIT_COMMITTER_...
Shell
#!/bin/sh # # Copyright (c) 2009 Robert Zeh test_description='git svn creates empty directories, calls git gc, makes sure they are still empty' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' for i in a b c d d/e d/e/f "weird file name" do svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" done ' test_expec...
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 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) 2007 Shawn Pearce # test_description='test git fast-import utility' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash # Print $1 bytes from stdin to stdout. # # This could be written as "head -c $1", but IRIX "head" does not # support the -c option. head_c () {...
Shell
#!/bin/sh test_description='git pull message generation' . ./test-lib.sh dollar='$Dollar' test_expect_success setup ' test_commit initial afile original && git clone . cloned && ( cd cloned && echo added >bfile && git add bfile && test_tick && git commit -m "add bfile" ) && test_tick && test_tick && ...
Shell
#!/bin/sh # # Copyright (c) 2010 Steven Walter # test_description='git svn mergeinfo propagation' . ./lib-git-svn.sh say 'define NO_SVN_TESTS to skip git svn tests' test_expect_success 'initialize source svn repo' ' svn_cmd mkdir -m x "$svnrepo"/trunk && svn_cmd co "$svnrepo"/trunk "$SVN_TREE" && ( cd "$SVN_TR...
Shell
#!/bin/sh # # test_description='git mktag: tag object verify test' . ./test-lib.sh ########################################################### # check the tag.sig file, expecting verify_tag() to fail, # and checking that the error message matches the pattern # given in the expect.pat file. check_verify_failure () {...
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 # # Copyright (c) 2007 Eric Wong # # Don't run this test by default unless the user really wants it # I don't like the idea of taking a port and possibly leaving a # daemon running on a users system if the test fails. # Not all git users will need to interact with SVN. test_description='git svn dcommit new ...
Shell
#!/bin/sh # # Copyright (c) 2006 Carl D. Worth # test_description='git ls-files test for --error-unmatch option This test runs git ls-files --error-unmatch to ensure it correctly returns an error when a non-existent path is provided on the command line. ' . ./test-lib.sh test_expect_success 'setup' ' touch foo bar ...
Shell
#!/bin/sh # # Copyright (c) 2008 Google Inc. # test_description='git-pack-object with missing base ' . ./test-lib.sh # Create A-B chain # test_expect_success \ 'setup base' \ 'for a in a b c d e f g h i; do echo $a >>text; done && echo side >side && git update-index --add text side && A=$(echo...
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='diff.*.textconv tests' . ./test-lib.sh find_diff() { sed '1,/^index /d' | sed '/^-- $/,$d' } cat >expect.binary <<'EOF' Binary files a/file and b/file differ EOF cat >expect.text <<'EOF' --- a/file +++ b/file @@ -1 +1,2 @@ 0 +1 EOF cat >hexdump <<'EOF' #!/bin/sh perl -e '$/ = undef; $...
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
# This file isn't used as a test script directly, instead it is # sourced from t8001-annotate.sh and t8002-blame.sh. check_count () { head= case "$1" in -h) head="$2"; shift; shift ;; esac echo "$PROG file $head" >&4 $PROG file $head >.result || return 1 cat .result | perl -e ' my %expect = (@ARGV); my %count...
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='--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='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) 2007 Johannes E. Schindelin # test_description='git fast-export' . ./test-lib.sh test_expect_success 'setup' ' echo break it > file0 && git add file0 && test_tick && echo Wohlauf > file && git add file && test_tick && git commit -m initial && echo die Luft > file && echo geht fri...
Shell
#!/bin/sh # # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin # test_description='Support for verbose submodule differences in git diff This test tries to verify the sanity of the --submodule option of git diff. ' . ./test-lib.sh add_file () { sm=$1 shift owd=$(pwd) cd "$sm" for name; do echo "$n...
Shell
#!/bin/sh # # Copyright (c) 2006 Shawn Pearce # test_description='Test git update-ref and basic ref logging' . ./test-lib.sh Z=$_z40 test_expect_success setup ' for name in A B C D E F do test_tick && T=$(git write-tree) && sha1=$(echo $name | git commit-tree $T) && eval $name=$sha1 done ' m=refs/heads...
Shell
#!/bin/sh test_description=clone . ./test-lib.sh test_expect_success setup ' rm -fr .git && test_create_repo src && ( cd src >file git add file git commit -m initial ) ' test_expect_success 'clone with excess parameters (1)' ' rm -fr dst && test_must_fail git clone -n src dst junk ' test_expect_s...
Shell
#!/bin/sh # # Copyright (c) 2006 Johannes E. Schindelin # test_description='Test special whitespace in diff engine. ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh # Ray Lehtiniemi's example cat << EOF > x do { nothing; } while (0); EOF git update-index --add x cat << EOF > x do { nothing; } while (0); EO...
Shell
#!/bin/sh # # Copyright (c) 2008 Johannes E. Schindelin # test_description='prune' . ./test-lib.sh day=$((60*60*24)) week=$(($day*7)) add_blob() { before=$(git count-objects | sed "s/ .*//") && BLOB=$(echo aleph_0 | git hash-object -w --stdin) && BLOB_FILE=.git/objects/$(echo $BLOB | sed "s/^../&\//") && test $(...
Shell
#!/bin/sh # # Copyright (c) 2008 Johannes Schindelin # test_description='Test rebasing and stashing with dirty 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 comm...
Shell
#!/bin/sh # # this script sets up a Subversion repository for Makefile in the # first ever git merge, as if it were done with svk. # set -e svk depotmap foo ~/.svk/foo svk co /foo/ foo cd foo mkdir trunk mkdir branches svk add trunk branches svk commit -m "Setup trunk and branches" cd trunk git cat-file blob 6683463...
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; } sed 's/^bin: /converted: /' "$1" EOF chmod +x helper test_expect_success 'setup ' ' echo "bin: t...
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='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 test_description='difference in submodules' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh test_expect_success setup ' test_tick && test_create_repo sub && ( cd sub && echo hello >world && git add world && git commit -m submodule ) && test_tick && echo frotz >nitfol && git add nitfol sub &...
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='--reverse combines with --parents' . ./test-lib.sh commit () { test_tick && echo $1 > foo && git add foo && git commit -m "$1" } test_expect_success 'set up --reverse example' ' commit one && git tag root && commit two && git checkout -b side HEAD^ && commit three && git check...
Shell
#!/bin/sh test_description=clone . ./test-lib.sh test_expect_success setup ' echo "#!/bin/sh" > not_ssh && echo "echo \"\$*\" > not_ssh_output" >> not_ssh && echo "exit 1" >> not_ssh && chmod +x not_ssh ' test_expect_success 'clone calls git upload-pack unqualified with no -u option' ' ( GIT_SSH=./not_ssh &&...
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 # # 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 Jon Seymour # test_description='Tests git rev-list --topo-order functionality' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions list_duplicates() { "$@" | sort | uniq -d } date >path0 git update-index --add path0 save_tag tree git write-tree on_committ...
Shell
#!/bin/sh test_description='git patch-id' . ./test-lib.sh test_expect_success 'setup' ' test_commit initial foo a && test_commit first foo b && git checkout -b same HEAD^ && test_commit same-msg foo b && git checkout -b notsame HEAD^ && test_commit notsame-msg foo c ' test_expect_success 'patch-id output is w...
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 && grep "[Uu]sage: git gc" err ' test_expect_success 'gc -h with invalid configuration' ' mkdir broken && ...
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 # # Copyright (c) 2005 Junio C Hamano # test_description='Same rename detection as t4003 but testing diff-raw. ' . ./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 fr...
Shell
#!/bin/sh test_description='test textconv caching' . ./test-lib.sh cat >helper <<'EOF' #!/bin/sh sed 's/^/converted: /' "$@" >helper.out cat helper.out EOF chmod +x helper test_expect_success 'setup' ' echo foo content 1 >foo.bin && echo bar content 1 >bar.bin && git add . && git commit -m one && echo foo conte...
Shell
#!/bin/sh # # Copyright (c) 2007 Carl D. Worth # test_description='git ls-files test (--with-tree). This test runs git ls-files --with-tree and in particular in a scenario known to trigger a crash with some versions of git. ' . ./test-lib.sh test_expect_success setup ' # The bug we are exercising requires a fair n...
Shell
#!/bin/sh # # Copyright (c) 2005 Johannes Schindelin # test_description='Test git config in different settings' . ./test-lib.sh test -f .git/config && rm .git/config git config core.penguin "little blue" cat > expect << EOF [core] penguin = little blue EOF test_expect_success 'initial' 'cmp .git/config expect' ...
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 # # 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 # # Copyright (c) 2008 Nguyễn Thái Ngọc Duy # test_description='test worktree writing operations when skip-worktree is used' . ./test-lib.sh test_expect_success 'setup' ' test_commit init && echo modified >> init.t && touch added && git add init.t added && git commit -m "modified and added" && git ta...
Shell
#!/bin/sh test_description='git ls-remote' . ./test-lib.sh test_expect_success setup ' >file && git add file && test_tick && git commit -m initial && git tag mark && git show-ref --tags -d | sed -e "s/ / /" >expected.tag && ( echo "$(git rev-parse HEAD) HEAD" git show-ref -d | sed -e "s/ / /" ) >expecte...
Shell
#!/bin/sh test_description='test aborting in-progress merges Set up repo with conflicting and non-conflicting branches: There are three files foo/bar/baz, and the following graph illustrates the content of these files in each commit: # foo/bar/baz --- foo/bar/bazz <-- master # \ # --- f...
Shell
#!/bin/sh test_description='respect crlf in git archive' . ./test-lib.sh UNZIP=${UNZIP:-unzip} test_expect_success setup ' git config core.autocrlf true && printf "CRLF line ending\r\nAnd another\r\n" > sample && git add sample && test_tick && git commit -m Initial ' test_expect_success 'tar archive' ' g...
Shell
#!/bin/sh # # Copyright (c) 2007 Junio C Hamano test_description='git checkout to switch between branches with symlink<->dir' . ./test-lib.sh test_expect_success SYMLINKS setup ' mkdir frotz && echo hello >frotz/filfre && git add frotz/filfre && test_tick && git commit -m "master has file frotz/filfre" && gi...
Shell
: included from 6002 and others [ -d .git/refs/tags ] || mkdir -p .git/refs/tags :> sed.script # Answer the sha1 has associated with the tag. The tag must exist in .git or .git/refs/tags tag() { _tag=$1 [ -f .git/refs/tags/$_tag ] || error "tag: \"$_tag\" does not exist" cat .git/refs/tags/$_tag } # Generate a c...
Shell
#!/bin/sh test_description='git merge Testing octopus merge with more than 25 refs.' . ./test-lib.sh test_expect_success 'setup' ' echo c0 > c0.c && git add c0.c && git commit -m c0 && git tag c0 && i=1 && while test $i -le 30 do git reset --hard c0 && echo c$i > c$i.c && git add c$i.c && git commit ...
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 test_description='refspec parsing' . ./test-lib.sh test_refspec () { kind=$1 refspec=$2 expect=$3 git config remote.frotz.url "." && git config --remove-section remote.frotz && git config remote.frotz.url "." && git config "remote.frotz.$kind" "$refspec" && if test "$expect" != invalid then title...
Shell
#!/bin/sh test_description='rebase should not insist on git message convention' . ./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 test_expect_success...
Shell
#!/bin/sh # # Copyright (c) 2005 Amos Waterland # test_description='git branch --foo should not create bogus branch This test runs git branch --help and checks that the argument is properly handled. Specifically, that a bogus branch is not created. ' . ./test-lib.sh test_expect_success \ 'prepare a trivial repo...
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
#!/bin/sh test_description='apply empty' . ./test-lib.sh test_expect_success setup ' >empty && git add empty && test_tick && git commit -m initial && for i in a b c d e do echo $i done >empty && cat empty >expect && git diff | sed -e "/^diff --git/d" \ -e "/^index /d" \ -e "s|a/empty|empty.orig...
Shell