code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/bin/sh # # Copyright (c) 2007 Frank Lichtenheld # test_description='git-cvsserver access tests read access to a git repository with the cvs CLI client via git-cvsserver server' . ./test-lib.sh if ! test_have_prereq PERL; then skip_all='skipping git cvsserver tests, perl not available' test_done fi cvs >/dev/nu...
Shell
#!/bin/sh # # 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='git rebase --abort tests' . ./test-lib.sh ### Test that we handle space characters properly work_dir="$(pwd)/test dir" test_expect_success setup ' mkdir -p "$work_dir" && cd "$work_dir" && git init && echo a > a && git add a && git commit -m a && git branch to-rebase && echo b >...
Shell
#!/bin/sh test_description='read-tree -u --reset' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree.sh # two-tree test test_expect_success 'setup' ' git init && mkdir df && echo content >df/file && git add df/file && git commit -m one && git ls-files >expect && rm -rf df && echo content >df && git...
Shell
#!/bin/sh # # Copyright (c) 2007 Junio C Hamano # test_description='git apply --whitespace=strip and configuration file. ' . ./test-lib.sh test_expect_success setup ' mkdir sub && echo A >sub/file1 && cp sub/file1 saved && git add sub/file1 && echo "B " >sub/file1 && git diff >patch.file ' # Also handcraft G...
Shell
#!/bin/sh test_description='git rebase --whitespace=fix This test runs git rebase --whitespace=fix and make sure that it works. ' . ./test-lib.sh # prepare initial revision of "file" with a blank line at the end cat >file <<EOF a b c EOF # expected contents in "file" after rebase cat >expect-first <<EOF a b c EOF...
Shell
#!/bin/sh # # Copyright (c) 2010 Ævar Arnfjörð Bjarmason # if test "$(git config --bool core.filemode)" = false then say 'filemode disabled on the filesystem' else test_set_prereq FILEMODE fi
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 # # Copyright (c) 2010 Johan Herland # test_description='Test notes merging at various fanout levels' . ./test-lib.sh verify_notes () { notes_ref="$1" commit="$2" if test -f "expect_notes_$notes_ref" then git -c core.notesRef="refs/notes/$notes_ref" notes | sort >"output_notes_$notes_ref" && tes...
Shell
#!/bin/sh # # Copyright (c) 2009, 2010 David Aguilar # test_description='git-difftool Testing basic diff tool invocation ' . ./test-lib.sh remove_config_vars() { # Unset all config variables used by git-difftool git config --unset diff.tool git config --unset diff.guitool git config --unset difftool.test-tool.c...
Shell
#!/bin/sh # # Copyright (c) 2009 Eric Wong # test_description='git svn shallow clone' . ./lib-git-svn.sh test_expect_success 'setup test repository' ' svn_cmd mkdir -m "create standard layout" \ "$svnrepo"/trunk "$svnrepo"/branches "$svnrepo"/tags && svn_cmd cp -m "branch off trunk" \ "$svnrepo"/trunk "$svnre...
Shell
#!/bin/sh # # Copyright (c) 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 # Description of the files in the repository: # # imported-once.txt: # # Imported once. 1.1 and 1.1.1.1 should be identical. # # imported-twice.txt: # # Imported twice. HEAD should reflect the contents of the # second import (i.e., have the same contents as 1.1.1.2). # # imported...
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='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 # # 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='update-index and add refuse to add beyond symlinks' . ./test-lib.sh test_expect_success SYMLINKS setup ' >a && mkdir b && ln -s b c && >c/d && git update-index --add a b/d ' test_expect_success SYMLINKS 'update-index --add beyond symlinks' ' test_must_fail git update-index --add c/...
Shell
#!/bin/sh test_description='checkout can switch to last branch and merge base' . ./test-lib.sh test_expect_success 'setup' ' echo hello >world && git add world && git commit -m initial && git branch other && echo "hello again" >>world && git add world && git commit -m second ' test_expect_success '"checkout ...
Shell
#!/bin/sh 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 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 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='remote tracking stats' . ./test-lib.sh advance () { echo "$1" >"$1" && git add "$1" && test_tick && git commit -m "$1" } test_expect_success setup ' for i in a b c; do advance $i || break done && git clone . test && ( cd test && git checkout -b b1 origin && git reset --h...
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 # # 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 echo "commit message" >> "$1" exit 0
Shell
#!/bin/sh echo "Signed-off-by: foo <bar@frotz>" >> "$1" exit 0
Shell
#!/bin/sh sed -e "s/intermediate/edited/g" <"$1" >"$1-" mv "$1-" "$1" exit 0
Shell
#!/bin/sh sed -e 's/|$//' >>"$1" <<\EOF | commit message | EOF exit 0
Shell
#!/bin/sh echo "# this is a new comment" >> "$1" echo "# and so is this" >> "$1" exit 0
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='git-merge Do not overwrite changes.' . ./test-lib.sh test_expect_success 'setup' ' test_commit c0 c0.c && test_commit c1 c1.c && test_commit c1a c1.c "c1 a" && git reset --hard c0 && test_commit c2 c2.c && git reset --hard c0 && mkdir sub && echo "sub/f" > sub/f && mkdir sub2 &&...
Shell
#!/bin/sh test_description='diff hunk header truncation' . ./test-lib.sh N='日本語' N1='日' N2='日本' NS="$N$N$N$N$N$N$N$N$N$N$N$N$N" test_expect_success setup ' ( echo "A $NS" for c in B C D E F G H I J K do echo " $c" done echo "L $NS" for c in M N O P Q R S T U V do echo " $c" done ) >file ...
Shell
#!/bin/sh # # Copyright (c) Jim Meyering # test_description='diff honors config option, diff.suppressBlankEmpty' . ./test-lib.sh cat <<\EOF > exp || diff --git a/f b/f index 5f6a263..8cb8bae 100644 --- a/f +++ b/f @@ -1,2 +1,2 @@ -x +y EOF exit 1 test_expect_success \ "$test_description" \ 'printf "\nx\n" >...
Shell
#!/bin/sh # # Copyright (c) 2008 Stephen Haberman # test_description='git rebase preserve merges This test runs git rebase with preserve merges and ensures commits dropped by the --cherry-pick flag have their childrens parents rewritten. ' . ./test-lib.sh # set up two branches like this: # # A - B - C - D - E # \ ...
Shell
#!/bin/sh # # 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 sub/1 H sub/2 EOF cat >expect.skip <<EOF S 1 H 2 S sub/1 H sub/2 EOF test_expect_success 'setup' ' mkdir sub && touch ./1 ./2 sub/1 sub/2 && git add 1 2 sub/1 sub/2 ...
Shell
#!/bin/sh test_description='test that git handles an svn repository with missing md5sums' . ./lib-git-svn.sh # Loading a node from a svn dumpfile without a Text-Content-Length # field causes svn to neglect to store or report an md5sum. (it will # calculate one if you had put Text-Content-Length: 0). This showed # ...
Shell
#!/bin/sh # # Copyright (c) 2007 Michael Spang # test_description='git clean basic tests' . ./test-lib.sh git config clean.requireForce no test_expect_success 'setup' ' mkdir -p src && touch src/part1.c Makefile && echo build >.gitignore && echo \*.o >>.gitignore && git add . && git commit -m setup && touch...
Shell
#!/bin/sh test_description='test cherry-pick and revert with conflicts - + picked: rewrites foo to c + base: rewrites foo to b + initial: writes foo as a, unrelated as unrelated ' . ./test-lib.sh test_cmp_rev () { git rev-parse --verify "$1" >expect.rev && git rev-parse --verify "$2" >actual.rev && test...
Shell
#!/bin/sh test_description='git apply with weird postimage filenames' . ./test-lib.sh test_expect_success 'setup' ' vector=$TEST_DIRECTORY/t4135 && test_tick && git commit --allow-empty -m preimage && git tag preimage && reset_preimage() { git checkout -f preimage^0 && git read-tree -u --reset HEAD && g...
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) 2007 Johannes E. Schindelin # test_description='git status' . ./test-lib.sh test_expect_success 'status -h in broken repository' ' mkdir broken && test_when_finished "rm -fr broken" && ( cd broken && git init && echo "[status] showuntrackedfiles = CORRUPT" >>.git/config && test...
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='test @{-N} syntax' . ./test-lib.sh make_commit () { echo "$1" > "$1" && git add "$1" && git commit -m "$1" } test_expect_success 'setup' ' make_commit 1 && git branch side && make_commit 2 && make_commit 3 && git checkout side && make_commit 4 && git merge master && git che...
Shell
#!/bin/sh test_description='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 # # Copyright (c) 2006 Junio C Hamano # test_description='git update-index --again test. ' . ./test-lib.sh cat > expected <<\EOF 100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad 0 file1 100644 9db8893856a8a02eaa73470054b7c1c5a7c82e47 0 file2 EOF test_expect_success 'update-index --add' \ 'echo hello world ...
Shell
#!/bin/sh test_description='test cherry-pick and revert with renames -- + rename2: renames oops to opos + rename1: renames oops to spoo + added: adds extra line to oops ++ initial: has lines in oops ' . ./test-lib.sh test_expect_success setup ' for l in a b c d e f g h i j k l m n o do echo $l$...
Shell
#!/bin/sh test_description='git annotate' . ./test-lib.sh PROG='git annotate' . "$TEST_DIRECTORY"/annotate-tests.sh test_expect_success 'Annotating an old revision works' ' git annotate file master >result && awk "{ print \$3; }" <result >authors && test 2 = $(grep A <authors | wc -l) && test 2 = $(grep B <autho...
Shell
#!/bin/sh test_description='pull options' . ./test-lib.sh test_expect_success 'setup' ' mkdir parent && (cd parent && git init && echo one >file && git add file && git commit -m one) ' test_expect_success 'git pull -q' ' mkdir clonedq && (cd clonedq && git init && git pull -q "../parent" >out 2>err && tes...
Shell
#!/bin/sh # # Copyright (c) 2010 Nazri Ramliy # test_description='Test for "git log --decorate" colors' . ./test-lib.sh get_color () { git config --get-color no.such.slot "$1" } test_expect_success setup ' git config diff.color.commit yellow && git config color.decorate.branch green && git config color.decorate...
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 test_description='detect unwritable repository and fail correctly' . ./test-lib.sh test_expect_success setup ' >file && git add file && test_tick && git commit -m initial && echo >file && git add file ' test_expect_success POSIXPERM,SANITY 'write-tree should notice unwritable repository' ' test_w...
Shell
#!/bin/sh test_description='apply to deeper directory without getting fooled with symlink' . ./test-lib.sh lecho () { for l_ do echo "$l_" done } test_expect_success SYMLINKS setup ' mkdir -p arch/i386/boot arch/x86_64 && lecho 1 2 3 4 5 >arch/i386/boot/Makefile && ln -s ../i386/boot arch/x86_64/boot && gi...
Shell
#!/bin/sh test_description='branch --contains <commit>, --merged, and --no-merged' . ./test-lib.sh test_expect_success setup ' >file && git add file && test_tick && git commit -m initial && git branch side && echo 1 >file && test_tick && git commit -a -m "second on master" && git checkout side && echo 1...
Shell
#!/bin/sh test_description='git-p4 tests' . ./test-lib.sh ( p4 -h && p4d -h ) >/dev/null 2>&1 || { skip_all='skipping git-p4 tests; no p4 or p4d' test_done } GITP4=$GIT_BUILD_DIR/contrib/fast-import/git-p4 P4DPORT=10669 export P4PORT=localhost:$P4DPORT db="$TRASH_DIRECTORY/db" cli="$TRASH_DIRECTORY/cli" git="$T...
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='Test automatic use of a pager.' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-pager.sh . "$TEST_DIRECTORY"/lib-terminal.sh cleanup_fail() { echo >&2 cleanup failed (exit 1) } test_expect_success 'setup' ' sane_unset GIT_PAGER GIT_PAGER_IN_USE && test_unconfig core.pager && PAGER="cat >pa...
Shell
#!/bin/sh # # Copyright (C) 2005 Rene Scharfe # test_description='git commit-tree options test This test checks that git commit-tree can create a specific commit object by defining all environment variables that it understands. ' . ./test-lib.sh cat >expected <<EOF tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 auth...
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='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='git merge Testing merge when using a custom message for the merge commit.' . ./test-lib.sh create_merge_msgs() { echo >exp.subject "custom message" cp exp.subject exp.log && echo >>exp.log "" && echo >>exp.log "* commit 'c2':" && echo >>exp.log " c2" } test_expect_success 'setup'...
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='undoing resolution' . ./test-lib.sh check_resolve_undo () { msg=$1 shift while case $# in 0) break ;; 1|2|3) die "Bug in check-resolve-undo test" ;; esac do path=$1 shift for stage in 1 2 3 do sha1=$1 shift case "$sha1" in '') continue ;; esac sha1=$(git r...
Shell
#!/bin/sh test_description='git rebase --continue tests' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh set_fake_editor test_expect_success 'setup' ' test_commit "commit-new-file-F1" F1 1 && test_commit "commit-new-file-F2" F2 2 && git checkout -b topic HEAD^ && test_commit "commit-new-file-F2-on-topic-bra...
Shell
#!/bin/sh # # Copyright (c) 2006 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) 2005 Junio C Hamano # test_description='git apply handling binary patches ' . ./test-lib.sh # setup cat >file1 <<EOF A quick brown fox jumps over the lazy dog. A tiny little penguin runs around in circles. There is a flag with Linux written on it. A slow black-and-white panda just sits t...
Shell
#!/bin/sh # # Copyright (c) 2006 Eric Wong # test_description='git rebase --merge --skip tests' . ./test-lib.sh # we assume the default git am -3 --skip strategy is tested independently # and always works :) test_expect_success setup ' echo hello > hello && git add hello && git commit -m "hello" && git branch s...
Shell
#!/bin/sh test_description='git cat-file' . ./test-lib.sh echo_without_newline () { printf '%s' "$*" } strlen () { echo_without_newline "$1" | wc -c | sed -e 's/^ *//' } maybe_remove_timestamp () { if test -z "$2"; then echo_without_newline "$1" else echo_without_newline "$(printf '%s\n' "...
Shell
#!/bin/sh # # 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 # # Copyright (c) 2005 Junio C Hamano # test_description='git checkout-index --prefix test. This test makes sure that --prefix option works as advertised, and also verifies that such leading path may contain symlinks, unlike the GIT controlled paths. ' . ./test-lib.sh test_expect_success \ 'setup' \ ...
Shell
#!/bin/sh test_diff_frobnitz() { cat >file1 <<\EOF #include <stdio.h> // Frobs foo heartily int frobnitz(int foo) { int i; for(i = 0; i < 10; i++) { printf("Your answer is: "); printf("%d\n", foo); } } int fact(int n) { if(n > 1) { return fact(n-1) * n; } retu...
Shell
#!/bin/sh test_description='reflog walk shows repeated commits again' . ./test-lib.sh test_expect_success 'setup commits' ' test_tick && echo content >file && git add file && git commit -m one && git tag one && echo content >>file && git add file && git commit -m two && git tag two ' test_expect_success 'setup ...
Shell
#!/bin/sh test_description='Examples from the git-notes man page Make sure the manual is not full of lies.' . ./test-lib.sh test_expect_success 'setup' ' test_commit A && test_commit B && test_commit C ' test_expect_success 'example 1: notes to add an Acked-by line' ' cat <<-\EOF >expect && B Notes: ...
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 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) 2007 Steven Grimm # test_description='git commit Tests for selected commit options.' . ./test-lib.sh commit_msg_is () { expect=commit_msg_is.expect actual=commit_msg_is.actual printf "%s" "$(git log --pretty=format:%s%b -1)" >$expect && printf "%s" "$1" >$actual && test_i18ncmp $ex...
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='git mv in subdirs' . ./test-lib.sh test_expect_success \ 'prepare reference tree' \ 'mkdir path0 path1 && cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && git add path0/COPYING && git commit -m add -a' test_expect_success \ 'moving the file out of subdirectory' ...
Shell
#!/bin/sh test_description="git hash-object" . ./test-lib.sh echo_without_newline() { printf '%s' "$*" } test_blob_does_not_exist() { test_expect_success 'blob does not exist in database' " test_must_fail git cat-file blob $1 " } test_blob_exists() { test_expect_success 'blob exists in database' " git cat-...
Shell
#!/bin/sh # # Copyright (c) 2010 Ævar Arnfjörð Bjarmason # test_description='Gettext Shell fallbacks' . ./test-lib.sh . "$GIT_BUILD_DIR"/git-sh-i18n test_expect_success 'gettext: our gettext() fallback has pass-through semantics' ' printf "test" >expect && gettext "test" >actual && test_i18ncmp expect ac...
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 # # Copyright(C) 2008 Stephen Habermann & Andreas Ericsson # test_description='git rebase -p should preserve merges Run "git rebase -p" and check that merges are properly carried along ' . ./test-lib.sh GIT_AUTHOR_EMAIL=bogus_email_address export GIT_AUTHOR_EMAIL # Clone 1 (trivial merge): # # A1--A2 <-- ...
Shell
#!/bin/sh test_description="git merge Testing a custom strategy. * (HEAD, master) Merge commit 'c3' |\ | * (tag: c3) c3 * | (tag: c1) c1 |/ | * tag: c2) c2 |/ * (tag: c0) c0 " . ./test-lib.sh test_expect_success 'set up custom strategy' ' cat >git-merge-theirs <<-EOF && #!$SHELL_PATH eval git read-tree --rese...
Shell
#!/bin/sh test_description='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 test_description='test show-branch with more than 8 heads' . ./test-lib.sh numbers="1 2 3 4 5 6 7 8 9 10" test_expect_success 'setup' ' > file && git add file && test_tick && git commit -m initial && for i in $numbers do git checkout -b branch$i master && > file$i && git add file$i && test...
Shell
#!/bin/sh # # Copyright (c) 2008 Stephen Haberman # test_description='git rebase preserve merges This test runs git rebase with -p and tries to squash a commit from after a merge to before the merge. ' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh set_fake_editor # set up two branches like this: # # A1 - B1 - ...
Shell
#!/bin/sh test_description='apply same filename' . ./test-lib.sh test_expect_success 'setup' ' mkdir -p some/sub/dir && echo Hello > some/sub/dir/file && git add some/sub/dir/file && git commit -m initial && git tag initial ' cat > patch << EOF diff a/bla/blub/dir/file b/bla/blub/dir/file --- a/bla/blub/dir/...
Shell
#!/bin/sh # # Copyright (c) 2007 David Symonds test_description='git checkout from subdirectories' . ./test-lib.sh test_expect_success setup ' echo "base" > file0 && git add file0 && mkdir dir1 && echo "hello" > dir1/file1 && git add dir1/file1 && mkdir dir2 && echo "bonjour" > dir2/file2 && git add dir2/fi...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='Pathspec restrictions Prepare: file0 path1/file1 ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success \ setup \ 'echo frotz >file0 && mkdir path1 && echo rezrov >path1...
Shell
#!/bin/sh test_description='patching from inconvenient places' . ./test-lib.sh test_expect_success 'setup' ' cat >patch <<-\EOF && diff file.orig file --- a/file.orig +++ b/file @@ -1 +1,2 @@ 1 +2 EOF patch="$(pwd)/patch" && echo 1 >preimage && printf "%s\n" 1 2 >postimage && echo 3 >other && test_ti...
Shell
#!/bin/sh test_description='checkout must not overwrite an untracked objects' . ./test-lib.sh test_expect_success 'setup' ' mkdir -p a/b/c && >a/b/c/d && git add -A && git commit -m base && git tag start ' test_expect_success 'create a commit where dir a/b changed to file' ' git checkout -b file && rm -rf a...
Shell
#!/bin/sh test_description='merging with submodules' . ./test-lib.sh # # history # # a --- c # / \ / # root X # \ / \ # b --- d # test_expect_success setup ' mkdir sub && (cd sub && git init && echo original > file && git add file && test_tick && git commit -m sub-root)...
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 test_description='tagopt variable affects "git fetch" and is overridden by commandline.' . ./test-lib.sh setup_clone () { git clone --mirror . $1 && git remote add remote_$1 $1 && (cd $1 && git tag tag_$1) } test_expect_success setup ' test_commit test && setup_clone one && git config remote.remote...
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 && set_and_save_state bar bar_work bar_index && sa...
Shell
#!/bin/sh test_description='diff --exit-code with whitespace' . ./test-lib.sh test_expect_success setup ' mkdir a b && echo >c && echo >a/d && echo >b/e && git add . && test_tick && git commit -m initial && echo " " >a/d && test_tick && git commit -a -m second && echo " " >a/d && echo " " >b/e && git ad...
Shell
#!/bin/sh # # 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 # # 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 # # Copyright (C) 2006 Martin Waitz <tali@admingilde.org> # test_description='test transitive info/alternate entries' . ./test-lib.sh # test that a file is not reachable in the current repository # but that it is after creating a info/alternate entry reachable_via() { alternate="$1" file="$2" if git cat-...
Shell
#!/bin/sh test_description='fetching and pushing, with or without wildcard' . ./test-lib.sh D=`pwd` mk_empty () { rm -fr testrepo && mkdir testrepo && ( cd testrepo && git init && git config receive.denyCurrentBranch warn && mv .git/hooks .git/hooks-disabled ) } mk_test () { mk_empty && ( for ref i...
Shell
#!/bin/sh test_description='blame output in various formats on a simple case' . ./test-lib.sh test_expect_success 'setup' ' echo a >file && git add file test_tick && git commit -m one && echo b >>file && echo c >>file && echo d >>file && test_tick && git commit -a -m two ' cat >expect <<'EOF' ^baf5e0b (A U ...
Shell