code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/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 test_description='am --abort' . ./test-lib.sh test_expect_success setup ' for i in a b c d e f g do echo $i done >file-1 && cp file-1 file-2 && test_tick && git add file-1 file-2 && git commit -m initial && git tag initial && for i in 2 3 4 5 6 do echo $i >>file-1 && echo $i >otherfile-$i &...
Shell
#!/bin/sh test_description='git blame corner cases' . ./test-lib.sh pick_fc='s/^[0-9a-f^]* *\([^ ]*\) *(\([^ ]*\) .*/\1-\2/' test_expect_success setup ' echo A A A A A >one && echo B B B B B >two && echo C C C C C >tres && echo ABC >mouse && for i in 1 2 3 4 5 6 7 8 9 do echo $i done >nine_lines && for i ...
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='check infrastructure for svn importer' . ./test-lib.sh uint32_max=4294967295 test_expect_success 'obj pool: store data' ' cat <<-\EOF >expected && 0 1 EOF test-obj-pool <<-\EOF >actual && alloc one 16 set one 13 test one 13 reset one EOF test_cmp expected actual ' test_expect...
Shell
#!/bin/sh # # Copyright (c) 2010 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) 2010 Matthieu Moy # test_description='Test repository with default ACL' # Create the test repo with restrictive umask # => this must come before . ./test-lib.sh umask 077 . ./test-lib.sh # We need an arbitrary other user give permission to using ACLs. root # is a good candidate: exists o...
Shell
#!/bin/sh test_description='git am with options and not losing them' . ./test-lib.sh tm="$TEST_DIRECTORY/t4252" test_expect_success setup ' cp "$tm/file-1-0" file-1 && cp "$tm/file-2-0" file-2 && git add file-1 file-2 && test_tick && git commit -m initial && git tag initial ' test_expect_success 'interrupted ...
Shell
#!/bin/sh test_description=gitattributes . ./test-lib.sh attr_check () { path="$1" expect="$2" git check-attr test -- "$path" >actual 2>err && echo "$path: test: $2" >expect && test_cmp expect actual && test_line_count = 0 err } test_expect_success 'setup' ' mkdir -p a/b/d a/c b && ( echo "[attr]notest !...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes E. Schindelin # test_description='Test custom diff function name patterns' . ./test-lib.sh LF=' ' cat >Beer.java <<\EOF public class Beer { int special; public static void main(String args[]) { String s=" "; for(int x = 99; x > 0; x--) { System.out.print(x + " bo...
Shell
#!/bin/sh # # Copyright (c) 2007 Nicolas Pitre # test_description='pack index with 64-bit offsets and object CRC' . ./test-lib.sh test_expect_success \ 'setup' \ 'rm -rf .git && git init && git config pack.threads 1 && i=1 && while test $i -le 100 do iii=`printf '%03i' $i` ...
Shell
#!/bin/sh test_description='test moved svn branch with missing empty files' . ./lib-git-svn.sh test_expect_success 'load svn dumpfile' ' svnadmin load "$rawsvnrepo" < "${TEST_DIRECTORY}/t9135/svn.dump" ' test_expect_success 'clone using git svn' 'git svn clone -s "$svnrepo" x' test_expect_success 'test that b1 e...
Shell
#!/bin/sh test_description='GIT_EDITOR, core.editor, and stuff' . ./test-lib.sh unset EDITOR VISUAL GIT_EDITOR test_expect_success 'determine default editor' ' vi=$(TERM=vt100 git var GIT_EDITOR) && test -n "$vi" ' if ! expr "$vi" : '[a-z]*$' >/dev/null then vi= fi for i in GIT_EDITOR core_editor EDITOR VISU...
Shell
#!/bin/sh test_description='test quickfetch from local' . ./test-lib.sh test_expect_success setup ' test_tick && echo ichi >file && git add file && git commit -m initial && cnt=$( ( git count-objects | sed -e "s/ *objects,.*//" ) ) && test $cnt -eq 3 ' test_expect_success 'clone without alternate' ' ( ...
Shell
#!/bin/sh test_description='test <branch>@{upstream} syntax' . ./test-lib.sh test_expect_success 'setup' ' test_commit 1 && git checkout -b side && test_commit 2 && git checkout master && git clone . clone && test_commit 3 && (cd clone && test_commit 4 && git branch --track my-side origin/side) ' full...
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 Junio C Hamano # test_description='git apply boundary tests ' . ./test-lib.sh L="c d e f g h i j k l m n o p q r s t u v w x" test_expect_success setup ' for i in b '"$L"' y do echo $i done >victim && cat victim >original && git update-index --add victim && : add to the hea...
Shell
#!/bin/sh test_description='git merge Testing the resolve strategy.' . ./test-lib.sh test_expect_success 'setup' ' echo c0 > c0.c && git add c0.c && git commit -m c0 && git tag c0 && echo c1 > c1.c && git add c1.c && git commit -m c1 && git tag c1 && git reset --hard c0 && echo c2 > c2.c && git add c2.c ...
Shell
#!/bin/sh test_description='ignore CR in CRLF sequence while computing similiarity' . ./test-lib.sh test_expect_success setup ' cat "$TEST_DIRECTORY"/t0022-crlf-rename.sh >sample && git add sample && test_tick && git commit -m Initial && append_cr <"$TEST_DIRECTORY"/t0022-crlf-rename.sh >elpmas && git add e...
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 test_description='pre-commit hook' . ./test-lib.sh test_expect_success 'with no hook' ' echo "foo" > file && git add file && git commit -m "first" ' test_expect_success '--no-verify with no hook' ' echo "bar" > file && git add file && git commit --no-verify -m "bar" ' # now install hook that al...
Shell
#!/bin/sh test_description='giving ignored paths to git add' . ./test-lib.sh test_expect_success setup ' mkdir sub dir dir/sub && echo sub >.gitignore && echo ign >>.gitignore && for p in . sub dir dir/sub do >"$p/ign" && >"$p/file" || exit 1 done ' for i in file dir/file dir 'd*' do test_expect_success ...
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) 2010 Jay Soffian # test_description='git svn fancy glob test' . ./lib-git-svn.sh test_expect_success 'load svn repo' " svnadmin load -q '$rawsvnrepo' < '$TEST_DIRECTORY/t9154/svn.dump' && git svn init --minimize-url -T trunk '$svnrepo' && git svn fetch " test_expect_success 'add red ...
Shell
#!/bin/sh test_description='previous branch syntax @{-n}' . ./test-lib.sh test_expect_success 'branch -d @{-1}' ' test_commit A && git checkout -b junk && git checkout - && test "$(git symbolic-ref HEAD)" = refs/heads/master && git branch -d @{-1} && test_must_fail git rev-parse --verify refs/heads/junk ' tes...
Shell
#!/bin/sh test_description='magic pathspec tests using git-log' . ./test-lib.sh test_expect_success 'setup' ' test_commit initial && test_tick && git commit --allow-empty -m empty && mkdir sub ' test_expect_success '"git log :/" should be ambiguous' ' test_must_fail git log :/ 2>error && grep ambiguous error ...
Shell
#!/bin/sh test_description='test recreated svn branch with empty files' . ./lib-git-svn.sh test_expect_success 'load svn dumpfile' ' svnadmin load "$rawsvnrepo" < "${TEST_DIRECTORY}/t9136/svn.dump" ' test_expect_success 'clone using git svn' 'git svn clone -s "$svnrepo" x' test_done
Shell
#!/bin/sh # # Copyright (c) 2010 Christian Couder # test_description='Tests to check that "reset" options follow a known table' . ./test-lib.sh test_expect_success 'creating initial commits' ' test_commit E file1 && test_commit D file1 && test_commit C file1 ' while read W1 I1 H1 T opt W2 I2 H2 do ...
Shell
#!/bin/sh test_description='ask merge-recursive to merge binary files' . ./test-lib.sh test_expect_success setup ' cat "$TEST_DIRECTORY"/test-binary-1.png >m && git add m && git ls-files -s | sed -e "s/ 0 / 1 /" >E1 && test_tick && git commit -m "initial" && git branch side && echo frotz >a && git add a &&...
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
: 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='diff --dirstat tests' . ./test-lib.sh # set up two commits where the second commit has these files # (10 lines in each file): # # unchanged/text (unchanged from 1st commit) # changed/text (changed 1st line) # rearranged/text (swapped 1st and 2nd line) #...
Shell
#!/bin/sh # # Copyright (c) 2005 Johannes Schindelin # test_description='Testing multi_ack pack fetching' . ./test-lib.sh # Test fetch-pack/upload-pack pair. # Some convenience functions add () { name=$1 && text="$@" && branch=`echo $name | sed -e 's/^\(.\).*$/\1/'` && parents="" && shift && while test $1; ...
Shell
#!/bin/sh # # Copyright (c) 2010 Johan Herland # test_description='Test merging of notes trees' . ./test-lib.sh test_expect_success setup ' test_commit 1st && test_commit 2nd && test_commit 3rd && test_commit 4th && test_commit 5th && # Create notes on 4 first commits git config core.notesRef refs/notes/x && ...
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) 2005 Junio C Hamano # test_description='git update-index nonsense-path test. This test creates the following structure in the cache: path0 - a file path1 - a symlink path2/file2 - a file in a directory path3/file3 - a file in a directory and tries to git updat...
Shell
#!/bin/sh 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) 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='Test cloning a repository larger than 2 gigabyte' . ./test-lib.sh if test -z "$GIT_TEST_CLONE_2GB" then say 'Skipping expensive 2GB clone test; enable it with GIT_TEST_CLONE_2GB=t' else test_set_prereq CLONE_2GB fi test_expect_success CLONE_2GB 'setup' ' git config pack.compression 0 ...
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='git rev-list should notice bad commits' . ./test-lib.sh # Note: # - compression level is set to zero to make "corruptions" easier to perform # - reflog is disabled to avoid extra references which would twart the test test_expect_success 'setup' \ ' git init && git config core.co...
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 # # Copyright (c) 2008 Charles Bailey # test_description='git mergetool Testing basic merge tool invocation' . ./test-lib.sh # All the mergetool test work by checking out a temporary branch based # off 'branch1' and then merging in master and checking the results of # running mergetool test_expect_succes...
Shell
#!/bin/sh # # Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at> # test_description='test smart pushing over http via http-backend' . ./test-lib.sh if test -n "$NO_CURL"; then skip_all='skipping test, git built without http support' test_done fi ROOT_PATH="$PWD" LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5541'} . "$TEST_D...
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 # # Copyright (c) 2009 Mark Rada # test_description='gitweb as standalone script (http status tests). This test runs gitweb (git web interface) as a CGI script from the commandline, and checks that it returns the expected HTTP status code and message.' . ./gitweb-lib.sh # --------------------------------...
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) 2010 Johan Herland # test_description='Test notes merging with auto-resolving strategies' . ./test-lib.sh # Set up a notes merge scenario with all kinds of potential conflicts test_expect_success 'setup commits' ' test_commit 1st && test_commit 2nd && test_commit 3rd && test_commit 4t...
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='ls-files tests with relative paths This test runs git ls-files with various relative path arguments. ' . ./test-lib.sh new_line=' ' sq=\' test_expect_success 'prepare' ' : >never-mind-me && git add never-mind-me && mkdir top && ( cd top && mkdir sub && x="x xa xbc xdef xghij x...
Shell
#!/bin/sh # # Copyright (c) 2009 Eric Wong test_description='git svn old rev_map preservd' . ./lib-git-svn.sh test_expect_success 'setup test repository with old layout' ' mkdir i && (cd i && > a) && svn_cmd import -m- i "$svnrepo" && git svn init "$svnrepo" && git svn fetch && test -d .git/svn/refs/remotes/git...
Shell
#!/bin/sh # # Copyright (c) 2007 David D. Kilzer test_description='git svn info' . ./lib-git-svn.sh # Tested with: svn, version 1.4.4 (r25188) # Tested with: svn, version 1.6.[12345689] v=`svn_cmd --version | sed -n -e 's/^svn, version \(1\.[0-9]*\.[0-9]*\).*$/\1/p'` case $v in 1.[456].*) ;; *) skip_all="skipping ...
Shell
#!/bin/sh # # Copyright (c) 2007 Junio C Hamano # test_description='Quoting paths in diff output. ' . ./test-lib.sh P0='pathname' P1='pathname with HT' P2='pathname with SP' P3='pathname with LF' if : 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" then test_set_prereq TABS_IN_FILENAMES else say 'Your filesyste...
Shell
#!/bin/sh test_description='setup taking and sanitizing funny paths' . ./test-lib.sh test_expect_success setup ' mkdir -p a/b/c a/e && D=$(pwd) && >a/b/c/d && >a/e/f ' test_expect_success 'git add (absolute)' ' git add "$D/a/b/c/d" && git ls-files >current && echo a/b/c/d >expect && test_cmp expect curre...
Shell
#!/bin/sh test_description='reset --hard unmerged' . ./test-lib.sh test_expect_success setup ' mkdir before later && >before/1 && >before/2 && >hello && >later/3 && git add before hello later && git commit -m world && H=$(git rev-parse :hello) && git rm --cached hello && echo "100644 $H 2 hello" | git up...
Shell
#!/bin/sh # # 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 Junio C Hamano # test_description='Pathnames with funny characters. This test tries pathnames with funny characters in the working tree, index, and tree objects. ' . ./test-lib.sh p0='no-funny' p1='tabs ," (dq) and spaces' p2='just space' cat >"$p0" <<\EOF 1. A quick brown fox jump...
Shell
#!/bin/sh test_description='git archive attribute tests' . ./test-lib.sh SUBSTFORMAT='%H (%h)%n' test_expect_exists() { test_expect_success " $1 exists" "test -e $1" } test_expect_missing() { test_expect_success " $1 does not exist" "test ! -e $1" } test_expect_success 'setup' ' echo ignored >ignored && echo ...
Shell
#!/bin/sh test_description='Test that adding/removing many notes triggers automatic fanout restructuring' . ./test-lib.sh test_expect_success 'creating many notes with git-notes' ' num_notes=300 && i=0 && while test $i -lt $num_notes do i=$(($i + 1)) && test_tick && echo "file for commit #$i" > file && g...
Shell
#!/bin/sh # # Copyright (c) 2006 Josh England # test_description='Test the post-merge hook.' . ./test-lib.sh test_expect_success setup ' echo Data for commit0. >a && git update-index --add a && tree0=$(git write-tree) && commit0=$(echo setup | git commit-tree $tree0) && echo Changed data for commit1. >a && git ...
Shell
#!/bin/sh # # 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 # # Copyright (c) 2005 Junio C Hamano # Copyright (c) 2005 Robert Fitzsimons # test_description='git apply test patches with multiple fragments.' . ./test-lib.sh cp "$TEST_DIRECTORY/t4109/patch1.patch" . cp "$TEST_DIRECTORY/t4109/patch2.patch" . cp "$TEST_DIRECTORY/t4109/patch3.patch" . cp "$TEST_DIRECTORY...
Shell
#!/bin/sh test_description='git svn handling of root commits in merge ranges' . ./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 'test handling of root commits in merge ranges' ' mk...
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 test_description='merge-recursive: handle file mode' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh test_expect_success 'mode change in one branch: keep changed version' ' : >file1 && git add file1 && git commit -m initial && git checkout -b a1 master && : >dummy && git add dummy && git c...
Shell
#!/bin/sh test_description='diff with assume-unchanged entries' . ./test-lib.sh # external diff has been tested in t4020-diff-external.sh test_expect_success 'setup' ' echo zero > zero && git add zero && git commit -m zero && echo one > one && echo two > two && git add one two && git commit -m onetwo && git...
Shell
#!/bin/sh # # Copyright (c) 2008 Kevin Ballard # test_description='git svn clone with percent escapes' . ./lib-git-svn.sh test_expect_success 'setup svnrepo' ' mkdir project project/trunk project/branches project/tags && echo foo > project/trunk/foo && svn_cmd import -m "$test_description" project "$svnrepo/pr jec...
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='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 cp FAKE_MSG "$1" exit 0 EOF chmod +x fake-editor ## Not using test_set...
Shell
#!/bin/sh test_description='tests for ref^{stuff}' . ./test-lib.sh test_expect_success 'setup' ' echo blob >a-blob && git tag -a -m blob blob-tag `git hash-object -w a-blob` mkdir a-tree && echo moreblobs >a-tree/another-blob && git add . && TREE_SHA1=`git write-tree` && git tag -a -m tree tree-tag "$TREE_SHA...
Shell
#!/bin/sh # # Copyright (c) 2009 Eric Wong test_description='git svn refuses to dcommit non-UTF8 messages' . ./lib-git-svn.sh # ISO-2022-JP can pass for valid UTF-8, so skipping that in this test for H in ISO8859-1 eucJP do test_expect_success "$H setup" ' mkdir $H && svn_cmd import -m "$H test" $H "$svnrepo"/...
Shell
#!/bin/sh test_description='forced push to replace commit we do not have' . ./test-lib.sh test_expect_success setup ' >file1 && git add file1 && test_tick && git commit -m Initial && git config receive.denyCurrentBranch warn && mkdir another && ( cd another && git init && git fetch --update-head-ok .. ma...
Shell
#!/bin/sh # # Copyright (c) 2008 Jan Krüger # test_description='git svn respects rewriteRoot during rebuild' . ./lib-git-svn.sh mkdir import (cd import touch foo svn_cmd import -m 'import for git svn' . "$svnrepo" >/dev/null ) rm -rf import test_expect_success 'init, fetch and checkout repository' ' git svn init...
Shell
#!/bin/sh test_description='git status for submodule' . ./test-lib.sh test_create_repo_with_commit () { test_create_repo "$1" && ( cd "$1" && : >bar && git add bar && git commit -m " Add bar" && : >foo && git add foo && git commit -m " Add foo" ) } test_expect_success 'setup' ' test_create_repo_wi...
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='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='apply with fuzz and offset' . ./test-lib.sh dotest () { name="$1" && shift && test_expect_success "$name" " git checkout-index -f -q -u file && git apply $* && test_cmp expect file " } test_expect_success setup ' for i in 1 2 3 4 5 6 7 8 9 10 11 12 do echo $i done >file &&...
Shell
#!/bin/sh test_description='merge-recursive backend test' . ./test-lib.sh # A <- create some files # / \ # B C <- cause rename/delete conflicts between B and C # / \ # |\ /| # | D E | # | \ / | # | X | # | / \ | # | / \ | # |/ \|...
Shell
#!/bin/sh test_description='test separate work tree' . ./test-lib.sh test_expect_success 'setup' ' EMPTY_TREE=$(git write-tree) && EMPTY_BLOB=$(git hash-object -t blob --stdin </dev/null) && CHANGED_BLOB=$(echo changed | git hash-object -t blob --stdin) && EMPTY_BLOB7=$(echo $EMPTY_BLOB | sed "s/\(.......\).*/\1/...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git mailinfo and git mailsplit test' . ./test-lib.sh test_expect_success 'split sample box' \ 'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last && last=`cat last` && echo total is $last && test `cat last` = 16' check_mailinfo () { m...
Shell
#!/bin/sh test_description='Return value of diffs' . ./test-lib.sh test_expect_success 'setup' ' echo 1 >a && git add . && git commit -m first && echo 2 >b && git add . && git commit -a -m second ' test_expect_success 'git diff-tree HEAD^ HEAD' ' git diff-tree --quiet HEAD^ HEAD >cnt test $? = 1 && test $(w...
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 # # 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='git merge Testing pull.* configuration parsing.' . ./test-lib.sh test_expect_success 'setup' ' echo c0 >c0.c && git add c0.c && git commit -m c0 && git tag c0 && echo c1 >c1.c && git add c1.c && git commit -m c1 && git tag c1 && git reset --hard c0 && echo c2 >c2.c && git add ...
Shell
#!/bin/sh # # Copyright (C) 2005 Rene Scharfe # test_description='git tar-tree and git get-tar-commit-id test This test covers the topics of file contents, commit date handling and commit id embedding: The contents of the repository is compared to the extracted tar archive. The repository contains simple text f...
Shell
#!/bin/sh test_description='git filter-branch' . ./test-lib.sh test_expect_success 'setup' ' test_commit A && test_commit B && git checkout -b branch B && test_commit D && mkdir dir && test_commit dir/D && test_commit E && git checkout master && test_commit C && git checkout branch && git merge C && git t...
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 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
#!/bin/sh test_description='applying patch with mode bits' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh test_expect_success setup ' echo original >file && git add file && test_tick && git commit -m initial && git tag initial && echo modified >file && git diff --stat -p >patch-0.txt && chmod +x ...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes Sixt # test_description='git update-index on filesystem w/o symlinks test. This tests that git update-index keeps the symbolic link property even if a plain file is in the working tree if core.symlinks is false.' . ./test-lib.sh test_expect_success \ 'preparation' ' git con...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes Schindelin # test_description='Test shared repository initialization' . ./test-lib.sh # Remove a default ACL from the test dir if possible. setfacl -k . 2>/dev/null # User must have read permissions to the repo -> failure on --shared=0400 test_expect_success 'shared = 0400 ...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git checkout-index test. This test registers the following filesystem structure in the cache: path0 - a file path1/file1 - a file in a directory And then tries to checkout in a work tree that has the following: path0/file0 - a fi...
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 test_description='Merge-recursive ours and theirs variants' . ./test-lib.sh test_expect_success setup ' for i in 1 2 3 4 5 6 7 8 9 do echo "$i" done >file && git add file && cp file elif && git commit -m initial && sed -e "s/1/one/" -e "s/9/nine/" >file <elif && git commit -a -m ours && git che...
Shell
#!/bin/sh test_description='unpack-objects' . ./test-lib.sh test_expect_success setup ' mkdir pub.git && GIT_DIR=pub.git git init --bare && GIT_DIR=pub.git git config receive.fsckobjects true && mkdir work && ( cd work && git init && mkdir -p gar/bage && ( cd gar/bage && git init && >junk && ...
Shell
#!/bin/sh # # Copyright (c) 2005 Fredrik Kuivinen # # See http://marc.theaimsgroup.com/?l=git&m=111463358500362&w=2 for a # nice description of what this is about. test_description='Test criss-cross merge' . ./test-lib.sh test_expect_success 'prepare repository' \ 'echo "1 2 3 4 5 6 7 8 9" > file && git add file &&...
Shell
#!/bin/sh test_description='Test git check-ref-format' . ./test-lib.sh valid_ref() { if test "$#" = 1 then test_expect_success "ref name '$1' is valid" \ "git check-ref-format '$1'" else test_expect_success "ref name '$1' is valid with options $2" \ "git check-ref-format $2 '$1'" fi } invalid_ref() { ...
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='basic symbolic-ref tests' . ./test-lib.sh # If the tests munging HEAD fail, they can break detection of # the git repo, meaning that further tests will operate on # the surrounding git repo instead of the trash directory. reset_to_sane() { echo ref: refs/heads/foo >.git/HEAD } test_expec...
Shell
#!/bin/sh test_description='operations that cull histories in unusual ways' . ./test-lib.sh test_expect_success setup ' test_commit A && test_commit B && test_commit C && git checkout -b side HEAD^ && test_commit D && test_commit E && git merge master ' test_expect_success 'rev-list --first-parent --boundary'...
Shell