code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/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 && git ...
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='git apply should exit non-zero with unrecognized input.' . ./test-lib.sh test_expect_success 'setup' ' test_commit 1 ' test_expect_success 'apply --check exits non-zero with unrecognized input' ' test_must_fail git apply --check - <<-\EOF I am not a patch I look nothing like a patch ...
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 # # Copyright (c) 2010 Ævar Arnfjörð Bjarmason # test_description="Gettext reencoding of our *.po/*.mo files works" . ./lib-gettext.sh # The constants used in a tricky observation for undefined behaviour RUNES="TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ" PUNTS="TILRAUN: ?? ???? ??? ?...
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 # # 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' test_expect_success 'setup' ' cat >"$p0" <...
Shell
#!/bin/sh test_description='Test automatic use of a pager.' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-pager.sh . "$TEST_DIRECTORY"/lib-terminal.sh test_expect_success 'setup' ' sane_unset GIT_PAGER GIT_PAGER_IN_USE && test_unconfig core.pager && PAGER="cat >paginated.out" && export PAGER && test_commit initial ...
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 "* tag '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 test_description='credential-store tests' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-credential.sh helper_test store test_done
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_lin...
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' GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease export GIT_INTERNAL_GETTEXT_TEST_FALLBACKS . ./lib-gettext.sh test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)"...
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='test parsing of svndiff0 files Using the "test-svn-fe -d" helper, check that svn-fe correctly interprets deltas using various facilities (some from the spec, some only learned from practice). ' . ./test-lib.sh >empty printf foo >preimage test_expect_success 'reject empty delta' ' test_m...
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
# # Library code for git p4 tests # . ./test-lib.sh if ! test_have_prereq PYTHON; then skip_all='skipping git p4 tests; python not available' test_done fi ( p4 -h && p4d -h ) >/dev/null 2>&1 || { skip_all='skipping git p4 tests; no p4 or p4d' test_done } # Try to pick a unique port: guess a large number, then ho...
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
#!/bin/sh # # Copyright (c) 2007 Carlos Rica # test_description='git tag Tests for operations with tags.' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-gpg.sh # creating and listing lightweight tags: tag_exists () { git show-ref --quiet --verify refs/tags/"$1" } # todo: git tag -l now returns always zero, when fixed, ...
Shell
#!/bin/sh test_description='pushing to a mirror repository' . ./test-lib.sh D=`pwd` invert () { if "$@"; then return 1 else return 0 fi } mk_repo_pair () { rm -rf master mirror && mkdir mirror && ( cd mirror && git init && git config receive.denyCurrentBranch warn ) && mkdir master && ( cd mas...
Shell
#!/bin/sh # # Copyright (c) 2008 Christian Couder # test_description='Tests replace refs functionality' exec </dev/null . ./test-lib.sh add_and_commit_file() { _file="$1" _msg="$2" git add $_file || return $? test_tick || return $? git commit --quiet -m "$_file: $_msg" } HASH1= HASH2= HASH3= HA...
Shell
#!/bin/sh test_description='test fetching over git protocol' . ./test-lib.sh LIB_GIT_DAEMON_PORT=${LIB_GIT_DAEMON_PORT-5570} . "$TEST_DIRECTORY"/lib-git-daemon.sh start_git_daemon test_expect_success 'setup repository' ' echo content >file && git add file && git commit -m one ' test_expect_success 'create git-ac...
Shell
#!/bin/sh test_description='merge simplification' . ./test-lib.sh note () { git tag "$1" } unnote () { git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g" } test_expect_success setup ' echo "Hi there" >file && git add file && test_tick && git commit -m "Initial file" && note A && git bra...
Shell
#!/bin/sh # # Copyright (c) 2005 Amos Waterland # Copyright (c) 2006 Christian Couder # test_description='git pack-refs should not change the branch semantic This test runs git pack-refs and git show-ref and checks that the branch semantic is still the same. ' . ./test-lib.sh echo '[core] logallrefupdates = true' >>...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='Test diff raw-output. ' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh cat >.test-plain-OA <<\EOF :000000 100644 0000000000000000000000000000000000000000 ccba72ad3888a3520b39efcf780b9ee64167535d A AA :000000 100644 000000000000000000000...
Shell
#!/bin/sh test_description='test git rev-parse --parseopt' . ./test-lib.sh cat > expect <<\END_EXPECT cat <<\EOF usage: some-command [options] <args>... some-command does foo and bar! -h, --help show the help --foo some nifty option --foo --bar ... some cool op...
Shell
#!/bin/sh # # Copyright (c) 2005 Johannes Schindelin # test_description='Test diff of symlinks. ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh test_expect_success SYMLINKS 'diff new symlink and file' ' cat >expected <<-\EOF && diff --git a/frotz b/frotz new file mode 120000 index 0000000..7c465af --- /dev/nu...
Shell
#!/bin/sh test_description='log --grep/--author/--regexp-ignore-case/-S/-G' . ./test-lib.sh test_expect_success setup ' >file && git add file && test_tick && git commit -m initial && echo Picked >file && test_tick && git commit -a --author="Another Person <another@example.com>" -m second ' test_expect_succes...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git apply should handle files with incomplete lines. ' . ./test-lib.sh # setup (echo a; echo b) >frotz.0 (echo a; echo b; echo c) >frotz.1 (echo a; echo b | tr -d '\012') >frotz.2 (echo a; echo c; echo b | tr -d '\012') >frotz.3 for i in 0 1 2 3 d...
Shell
#!/bin/sh test_description='read-tree -m -u checks working tree files' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree.sh # two-tree test test_expect_success 'two-way setup' ' mkdir subdir && echo >file1 file one && echo >file2 file two && echo >subdir/file1 file one in subdirectory && echo >subdir/file2 fi...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='git checkout tests. Creates master, forks renamer and side branches from it. Test switching across them. ! [master] Initial A one, A two * [renamer] Renamer R one->uno, M two ! [side] Side M one, D two, A three ! [simple] Simple D one,...
Shell
#!/bin/sh # # Copyright (c) 2009 Greg Price # test_description='git rebase -p should respect --onto In a rebase with --onto, we should rewrite all the commits that aren'"'"'t on top of $ONTO, even if they are on top of $UPSTREAM. ' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh # Set up branches like this: # A1-...
Shell