code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/bin/sh # # Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at> # if test -z "$GIT_TEST_HTTPD" then skip_all="Network testing disabled (define GIT_TEST_HTTPD to enable)" test_done fi HTTPD_PARA="" for DEFAULT_HTTPD_PATH in '/usr/sbin/httpd' '/usr/sbin/apache2' do if test -x "$DEFAULT_HTTPD_PATH" then break ...
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) 2010 Sverre Rabbelier # test_description='Test remote-helper import and export commands' . ./test-lib.sh if ! test_have_prereq PYTHON ; then skip_all='skipping git-remote-hg tests, python not available' test_done fi "$PYTHON_PATH" -c ' import sys if sys.hexversion < 0x02040000: sys...
Shell
#!/bin/sh test_description='git svn fetch deleted tag' . ./lib-git-svn.sh test_expect_success 'setup svn repo' ' mkdir -p import/trunk/subdir && mkdir -p import/branches && mkdir -p import/tags && echo "base" >import/trunk/subdir/file && svn_cmd import -m "import for git svn" import "$svnrepo" && rm -rf import...
Shell
. ./test-lib.sh remotes_git_svn=remotes/git""-svn git_svn_id=git""-svn-id if test -n "$NO_SVN_TESTS" then skip_all='skipping git svn tests, NO_SVN_TESTS defined' test_done fi if ! test_have_prereq PERL; then skip_all='skipping git svn tests, perl not available' test_done fi GIT_DIR=$PWD/.git GIT_SVN_DIR=$GIT_DIR...
Shell
#!/bin/sh test_description='Test git notes prune' . ./test-lib.sh test_expect_success 'setup: create a few commits with notes' ' : > file1 && git add file1 && test_tick && git commit -m 1st && git notes add -m "Note #1" && : > file2 && git add file2 && test_tick && git commit -m 2nd && git notes add -m "N...
Shell
#!/bin/sh test_description='rewrite diff on binary file' . ./test-lib.sh # We must be large enough to meet the MINIMUM_BREAK_SIZE # requirement. make_file() { # common first line to help identify rewrite versus regular diff printf "=\n" >file for i in 1 2 3 4 5 6 7 8 9 10 do for j in 1 2 3 4 5 6 7 8 9 do ...
Shell
#!/bin/sh test_description='test 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) 2008 Nguyễn Thái Ngọc Duy # test_description='skip-worktree bit test' . ./test-lib.sh cat >expect.full <<EOF H 1 H 2 H init.t H sub/1 H sub/2 EOF cat >expect.skip <<EOF S 1 H 2 H init.t S sub/1 H sub/2 EOF NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 setup_absent() { test -f 1 &...
Shell
#!/bin/sh test_description='checkout switching away from an invalid branch' . ./test-lib.sh test_expect_success 'setup' ' echo hello >world && git add world && git commit -m initial ' test_expect_success 'checkout should not start branch from a tree' ' test_must_fail git checkout -b newbranch master^{tree} ' t...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes E. Schindelin # test_description='Test fsck --lost-found' . ./test-lib.sh test_expect_success setup ' git config core.logAllRefUpdates 0 && : > file1 && git add file1 && test_tick && git commit -m initial && echo 1 > file1 && echo 2 > file2 && git add file1 file2 && ...
Shell
#!/bin/sh test_description='apply same filename' . ./test-lib.sh modify () { sed -e "$1" < "$2" > "$2".x && mv "$2".x "$2" } test_expect_success setup ' for i in a b c d e f g h i j k l m do echo $i done >same_fn && cp same_fn other_fn && git add same_fn other_fn && git commit -m initial ' test_expect_suc...
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='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 # # Copyright (c) 2010 Bo Yang # test_description='Test --follow should always find copies hard in git log. ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh echo >path0 'Line 1 Line 2 Line 3 ' test_expect_success \ 'add a file path0 and commit.' \ 'git add path0 && git commit -m "Add path0"'...
Shell
#!/bin/sh test_description='git apply handling criss-cross rename patch.' . ./test-lib.sh create_file() { cnt=0 while test $cnt -le 100 do cnt=$(($cnt + 1)) echo "$2" >> "$1" done } test_expect_success 'setup' ' create_file file1 "File1 contents" && create_file file2 "File2 more contents" && create_file 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) 2007 Jakub Narebski # gitweb_init () { safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')" cat >gitweb_config.perl <<EOF #!/usr/bin/perl # gitweb configuration for tests our \$version = 'current'; our \$GIT = 'git'; our \$projectroot = "$safe_pwd"; our \$project_maxdepth = 8;...
Shell
#!/bin/sh test_description='git apply --numstat - <patch' . ./test-lib.sh test_expect_success setup ' echo hello >text && git add text && echo goodbye >text && git diff >patch ' test_expect_success 'git apply --numstat - < patch' ' echo "1 1 text" >expect && git apply --numstat - <patch >actual && test_cmp e...
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 test_description='racy GIT' . ./test-lib.sh # This test can give false success if your machine is sufficiently # slow or your trial happened to happen on second boundary. for trial in 0 1 2 3 4 do rm -f .git/index echo frotz >infocom git update-index --add infocom echo xyzzy >infocom files=`git diff...
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='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 # # Copyright (c) 2009 Ilari Liusvaara # test_description='Test run command' . ./test-lib.sh cat >hello-script <<-EOF #!$SHELL_PATH cat hello-script EOF >empty test_expect_success 'start_command reports ENOENT' ' test-run-command start-command-ENOENT ./does-not-exist ' test_expect_success 'run_command...
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='test cherry-picking with --ff option' . ./test-lib.sh test_expect_success setup ' echo first > file1 && git add file1 && test_tick && git commit -m "first" && git tag first && git checkout -b other && echo second >> file1 && git add file1 && test_tick && git commit -m "second" ...
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 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 # # Copyright (c) 2005 Junio C Hamano # test_description='git ls-files -k and -m flags test. This test prepares the following in the cache: path0 - a file path1 - a symlink path2/file2 - a file in a directory path3/file3 - a file in a directory and the following on the filesyst...
Shell
#!/bin/sh test_description='pulling into void' . ./test-lib.sh modify () { sed -e "$1" <"$2" >"$2.x" && mv "$2.x" "$2" } D=`pwd` test_expect_success setup ' echo file >file && git add file && git commit -a -m original ' test_expect_success 'pulling into void' ' mkdir cloned && cd cloned && git init && ...
Shell
#!/bin/sh test_description='merge-recursive options * [master] Clarify ! [remote] Remove cruft -- + [remote] Remove cruft * [master] Clarify *+ [remote^] Initial revision * ok 1: setup ' . ./test-lib.sh test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b test_have_prereq MINGW && export GREP_OPTIONS=-U test_expe...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git apply in reverse ' . ./test-lib.sh test_expect_success setup ' for i in a b c d e f g h i j k l m n; do echo $i; done >file1 && perl -pe "y/ijk/\\000\\001\\002/" <file1 >file2 && git add file1 file2 && git commit -m initial && git tag in...
Shell
#!/bin/sh test_description="recursive merge corner cases w/ renames but not criss-crosses" # t6036 has corner cases that involve both criss-cross merges and renames . ./test-lib.sh test_expect_success 'setup rename/delete + untracked file' ' echo "A pretty inscription" >ring && git add ring && test_tick && git c...
Shell
#!/bin/sh 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) 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) 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 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='git rev-list trivial path optimization test d/z1 b0 b1 o------------------------*----o master / / o---------o----o----o----o side a0 c0 c1 a1 c2 d/f0 d/f1 d/z0 ' . ./test-lib.sh test_expect_success setup...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='i18n settings and format-patch | am pipe' . ./test-lib.sh check_encoding () { # Make sure characters are not corrupted cnt="$1" header="$2" i=1 j=0 bad=0 while test "$i" -le $cnt do git format-patch --encoding=UTF-8 --stdout HEAD~$i..HEAD~$j |...
Shell
#!/bin/sh test_description='git add -u This test creates a working tree state with three files: top (previously committed, modified) dir/sub (previously committed, modified) dir/other (untracked) and issues a git add -u with path limiting on "dir" to add only the updates to dir/sub. Also tested are "git add ...
Shell
#!/bin/sh # # Copyright (c) 2009 Erick Mattos # test_description='git commit --reset-author' . ./test-lib.sh author_header () { git cat-file commit "$1" | sed -n -e '/^$/q' -e '/^author /p' } message_body () { git cat-file commit "$1" | sed -e '1,/^$/d' } test_expect_success '-C option copies authorship and me...
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='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 Junio C Hamano # test_description='Test built-in diff output engine. ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh echo >path0 'Line 1 Line 2 line 3' cat path0 >path1 chmod +x path1 test_expect_success \ 'update-index --add two files with and without +x.' \ 'git update-i...
Shell
#!/bin/sh # # Copyright (c) 2006 Eric Wong test_description='git svn commit-diff' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' mkdir import && ( cd import && echo hello >readme && svn_cmd import -m "initial" . "$svnrepo" ) && echo hello > readme && git update-index --add readme && git commit ...
Shell
#!/bin/sh # # Copyright (c) 2008 Christian Couder # test_description='test git rev-parse --verify' 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 ech...
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) 2005 Junio C Hamano # test_description='Test the very basics part #1. The rest of the test suite does not check the basic operation of git plumbing commands to work very carefully. Their job is to concentrate on tricky features that caused bugs in the past to detect regression. This test...
Shell
#!/bin/sh test_description='merge fast-forward and up to date' . ./test-lib.sh test_expect_success setup ' >file && git add file && test_tick && git commit -m initial && git tag c0 && echo second >file && git add file && test_tick && git commit -m second && git tag c1 && git branch test ' test_expect_su...
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 # # Helper functions to check if read-tree would succeed/fail as expected with # and without the dry-run option. They also test that the dry-run does not # write the index and that together with -u it doesn't touch the work tree. # read_tree_must_succeed () { git ls-files -s >pre-dry-run && git read-t...
Shell
#!/bin/sh test_description='pulling from symlinked subdir' . ./test-lib.sh # The scenario we are building: # # trash\ directory/ # clone-repo/ # subdir/ # bar # subdir-link -> clone-repo/subdir/ # # The working directory is subdir-link. test_expect_success SYMLINKS setup ' mkdir subdir && ...
Shell
#!/bin/sh test_description='ancestor culling and limiting by parent number' . ./test-lib.sh check_revlist () { rev_list_args="$1" && shift && git rev-parse "$@" >expect && git rev-list $rev_list_args --all >actual && test_cmp expect actual } test_expect_success setup ' touch file && git add file && test_c...
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='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='git commit porcelain-ish' . ./test-lib.sh # Arguments: [<prefix] [<commit message>] [<commit options>] check_summary_oneline() { test_tick && git commit ${3+"$3"} -m "$2" | head -1 > act && # branch name SUMMARY_PREFIX="$(git name-rev --name-only HEAD)" && # append the "special" pr...
Shell
#!/bin/sh test_description='patience diff algorithm' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-diff-alternative.sh test_diff_frobnitz "patience" test_diff_unique "patience" test_done
Shell
#!/bin/sh test_description='ls-files --exclude does not affect index files' . ./test-lib.sh test_expect_success 'create repo with file' ' echo content >file && git add file && git commit -m file && echo modification >file ' check_output() { test_expect_success "ls-files output contains file ($1)" " echo '$2' >e...
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 # Copyright (c) 2011, Google Inc. test_description='adding and checking out large blobs' . ./test-lib.sh test_expect_success setup ' git config core.bigfilethreshold 200k && echo X | dd of=large bs=1k seek=2000 ' test_expect_success 'add a large file' ' git add large && # make sure we got a packfile a...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='various format-patch tests' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-terminal.sh test_expect_success setup ' for i in 1 2 3 4 5 6 7 8 9 10; do echo "$i"; done >file && cat file >elif && git add file elif && test_tick && git commit -m Initial &&...
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='pack should notice missing commit objects' . ./test-lib.sh test_expect_success setup ' for i in 1 2 3 4 5 do echo "$i" >"file$i" && git add "file$i" && test_tick && git commit -m "$i" && git tag "tag$i" done && obj=$(git rev-parse --verify tag3) && fanout=$(expr "$obj" : "\...
Shell
#!/bin/sh test_description='test git-http-backend-noserver' . ./test-lib.sh HTTPD_DOCUMENT_ROOT_PATH="$TRASH_DIRECTORY" test_have_prereq MINGW && export GREP_OPTIONS=-U run_backend() { echo "$2" | QUERY_STRING="${1#*\?}" \ PATH_TRANSLATED="$HTTPD_DOCUMENT_ROOT_PATH/${1%%\?*}" \ git http-backend >act.out 2>act.e...
Shell
#!/bin/sh # # Copyright (c) 2009 Red Hat, Inc. # test_description='Test updating submodules This test verifies that "git submodule update" detaches the HEAD of the submodule and "git submodule update --rebase/--merge" does not detach the HEAD. ' . ./test-lib.sh compare_head() { sha_master=`git rev-list --max-c...
Shell
#!/bin/sh test_description='rerere run in a workdir' . ./test-lib.sh test_expect_success SYMLINKS setup ' git config rerere.enabled true && >world && git add world && test_tick && git commit -m initial && echo hello >world && test_tick && git commit -a -m hello && git checkout -b side HEAD^ && echo goodby...
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 workflows involving pull request.' . ./test-lib.sh test_expect_success 'setup' ' git init --bare upstream.git && git init --bare downstream.git && git clone upstream.git upstream-private && git clone downstream.git local && trash_url="file://$TRASH_DIRECTORY" && downstream_ur...
Shell
#!/bin/sh test_description='basic git merge-index / git-merge-one-file tests' . ./test-lib.sh test_expect_success 'setup diverging branches' ' for i in 1 2 3 4 5 6 7 8 9 10; do echo $i done >file && git add file && git commit -m base && git tag base && sed s/2/two/ <file >tmp && mv tmp file && git commit -a...
Shell
#!/bin/sh test_description='git grep in binary files' . ./test-lib.sh test_expect_success 'setup' " echo 'binaryQfile' | q_to_nul >a && git add a && git commit -m. " test_expect_success 'git grep ina a' ' echo Binary file a matches >expect && git grep ina a >actual && test_cmp expect actual ' test_expect_suc...
Shell
#!/bin/sh test_description='check problems with relative GIT_DIR This test creates a working tree state with a file and subdir: top (committed several times) subdir (a subdirectory) It creates a commit-hook and tests it, then moves .git into the subdir while keeping the worktree location, and tries commits from...
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) 2007 Shawn O. Pearce # test_description='git apply -p handling.' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh test_expect_success setup ' mkdir sub && echo A >sub/file1 && cp sub/file1 file1.saved && git add sub/file1 && echo B >sub/file1 && git diff >patch.file && gi...
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 # # Copyright (c) 2009 Eric Wong # test_description='git svn property tests' . ./lib-git-svn.sh test_expect_success 'setup repo with a git repo inside it' ' svn_cmd co "$svnrepo" s && ( cd s && git init && test -f .git/HEAD && > .git/a && echo a > a && svn_cmd add .git a && svn_cmd commit -m...
Shell
#!/bin/sh test_description='apply a patch that is larger than the preimage' . ./test-lib.sh cat >F <<\EOF 1 2 3 4 5 6 7 8 999999 A B C D E F G H I J EOF test_expect_success setup ' git add F && mv F G && sed -e "s/1/11/" -e "s/999999/9/" -e "s/H/HH/" <G >F && git diff >patch && sed -e "/^\$/d" <G >F && git...
Shell
#!/bin/sh test_description='various @{whatever} syntax tests' . ./test-lib.sh test_expect_success 'setup' ' test_commit one && test_commit two ' check_at() { echo "$2" >expect && git log -1 --format=%s "$1" >actual && test_cmp expect actual } test_expect_success '@{0} shows current' ' check_at @{0} two ' tes...
Shell
#!/bin/sh # # Copyright (c) 2007 Eric Wong # test_description='git svn useSvnsyncProps test' . ./lib-git-svn.sh test_expect_success 'load svnsync repo' ' svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9111/svnsync.dump && git svn init --minimize-url -R arr -i bar "$svnrepo"/bar && git svn init --minimize-url...
Shell
#!/bin/sh # # Copyright (c) 2010 Will Palmer # test_description='git merge-tree' . ./test-lib.sh test_expect_success setup ' test_commit "initial" "initial-file" "initial" ' test_expect_success 'file add A, !B' ' cat >expected <<\EXPECTED && added in remote their 100644 43d5a8ed6ef6c00ff775008633f95787d088285d ...
Shell
#!/bin/sh # # Copyright (c) 2006 Johannes E. Schindelin # test_description='git rerere ! [fifth] version1 ! [first] first ! [fourth] version1 ! [master] initial ! [second] prefer first over second ! [third] version2 ------ + [third] version2 + [fifth] version1 + [fourth] version1 + + + ...
Shell
#!/bin/sh # Based on a test case submitted by Björn Steinbrink. test_description='git blame on conflicted files' . ./test-lib.sh test_expect_success 'setup first case' ' # Create the old file echo "Old line" > file1 && git add file1 && git commit --author "Old Line <ol@localhost>" -m file1.a && # Branch git c...
Shell
#!/bin/sh # # Copyright (c) 2008 Eric Wong # test_description='git svn authors file tests' . ./lib-git-svn.sh cat > svn-authors <<EOF aa = AAAAAAA AAAAAAA <aa@example.com> bb = BBBBBBB BBBBBBB <bb@example.com> EOF test_expect_success 'setup svnrepo' ' for i in aa bb cc dd do svn_cmd mkdir -m $i --username $i "$...
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='checkout should leave clean stat info' . ./test-lib.sh test_expect_success 'setup' ' echo hello >world && git update-index --add world && git commit -m initial && git branch side && echo goodbye >world && git update-index --add world && git commit -m second ' test_expect_success...
Shell
#!/bin/sh test_description='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 test_description='--ancestry-path' # D---E-------F # / \ \ # B---C---G---H---I---J # / \ # A-------K---------------L--M # # D..M == E F G H I J K L M # --ancestry-path D..M == E F H I J L M # # D..M -- M.t == M # --ance...
Shell
#!/bin/sh test_description='auto squash' . ./test-lib.sh test_expect_success setup ' echo 0 >file0 && git add . && test_tick && git commit -m "initial commit" && echo 0 >file1 && echo 2 >file2 && git add . && test_tick && git commit -m "first commit" && git tag first-commit && echo 3 >file3 && git add . ...
Shell
#!/bin/sh # # Copyright (c) 2008 Dmitry V. Levin # test_description='fetch exit status test' . ./test-lib.sh test_expect_success setup ' >file && git add file && git commit -m initial && git checkout -b side && echo side >file && git commit -a -m side && git checkout master && echo next >file && git comm...
Shell
#!/bin/sh test_description='git add --all' . ./test-lib.sh test_expect_success setup ' ( echo .gitignore echo will-remove ) >expect && ( echo actual echo expect echo ignored ) >.gitignore && >will-remove && git add --all && test_tick && git commit -m initial && git ls-files >actual && test_cmp ex...
Shell
#!/bin/sh test_description='Peter MacMillan' . ./test-lib.sh test_expect_success setup ' echo Hello >file && git add file && test_tick && git commit -m V1 && echo Hello world >file && git add file && git checkout -b other ' test_expect_success 'check all changes are staged' ' git diff --exit-code ' test_exp...
Shell
#!/bin/sh test_description='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 # # Copyright (c) 2005 Junio C Hamano # test_description='git ls-files test (-- to terminate the path list). This test runs git ls-files --others with the following on the filesystem. path0 - a file -foo - a file with a funny name. -- - another file with a funny name. ' . ./test-lib.sh ...
Shell
#!/bin/sh # # Copyright (c) 2008 Brad King test_description='git svn dcommit honors auto-props' . ./lib-git-svn.sh generate_auto_props() { cat << EOF [miscellany] enable-auto-props=$1 [auto-props] *.sh = svn:mime-type=application/x-shellscript; svn:eol-style=LF *.txt = svn:mime-type=text/plain; svn:eol-style = nati...
Shell
#!/bin/sh # Copyright (c) 2007 Eric Wong test_description='git svn globbing refspecs' . ./lib-git-svn.sh cat > expect.end <<EOF the end hi start a new branch initial EOF test_expect_success 'test refspec globbing' ' mkdir -p trunk/src/a trunk/src/b trunk/doc && echo "hello world" > trunk/src/a/readme && echo "good...
Shell
#!/bin/sh # A description of the repository used for this test can be found in # t9602/README. test_description='git cvsimport handling of branches and tags' . ./lib-cvs.sh setup_cvs_test_repository t9602 test_expect_success PERL 'import module' ' git cvsimport -C module-git module ' test_expect_success PERL 't...
Shell
#!/bin/sh test_description='more git add -u' . ./test-lib.sh test_expect_success setup ' >xyzzy && _empty=$(git hash-object --stdin <xyzzy) && >yomin && >caskly && if test_have_prereq SYMLINKS; then ln -s frotz nitfol && T_letter=T else printf %s frotz > nitfol && T_letter=M fi && mkdir rezrov && >r...
Shell
#!/bin/sh test_description='combined diff' . ./test-lib.sh setup_helper () { one=$1 branch=$2 side=$3 && git branch $side $branch && for l in $one two three fyra do echo $l done >file && git add file && test_tick && git commit -m $branch && git checkout $side && for l in $one two three quatro do echo...
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='test various @{X} syntax combinations together' . ./test-lib.sh check() { test_expect_${3:-success} "$1 = $2" " echo '$2' >expect && git log -1 --format=%s '$1' >actual && test_cmp expect actual " } nonsense() { test_expect_${2:-success} "$1 is nonsensical" " test_must_fail git log -1 ...
Shell
#!/bin/sh test_description='fetch --all works correctly' . ./test-lib.sh setup_repository () { mkdir "$1" && ( cd "$1" && git init && >file && git add file && test_tick && git commit -m "Initial" && git checkout -b side && >elif && git add elif && test_tick && git commit -m "Second" && git checkout mast...
Shell