code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/bin/sh test_description='test subject preservation with format-patch | am' . ./test-lib.sh make_patches() { type=$1 subject=$2 test_expect_success "create patches with $type subject" ' git reset --hard baseline && echo $type >file && git commit -a -m "$subject" && git format-patch -1 --stdout >$type.pat...
Shell
#!/bin/sh # # Copyright (c) 2006 Eric Wong # test_description='git svn basic tests' GIT_SVN_LC_ALL=${LC_ALL:-$LANG} . ./lib-git-svn.sh say 'define NO_SVN_TESTS to skip git svn tests' case "$GIT_SVN_LC_ALL" in *.UTF-8) test_set_prereq UTF8 ;; *) say "# UTF-8 locale not set, some tests skipped ($GIT_SVN_LC_ALL)" ...
Shell
#!/bin/sh test_description='update-index with options' . ./test-lib.sh test_expect_success basics ' >one && >two && >three && # need --add when adding test_must_fail git update-index one && test -z "$(git ls-files)" && git update-index --add one && test zone = "z$(git ls-files)" && # update-index is atomi...
Shell
#!/bin/sh test_description='--reverse combines with --parents' . ./test-lib.sh commit () { test_tick && echo $1 > foo && git add foo && git commit -m "$1" } test_expect_success 'set up --reverse example' ' commit one && git tag root && commit two && git checkout -b side HEAD^ && commit three && git check...
Shell
#!/bin/sh # # Copyright (c) 2007 Kristian Høgsberg <krh@redhat.com> # # FIXME: Test the various index usages, -i and -o, test reflog, # signoff test_description='git commit' . ./test-lib.sh . "$TEST_DIRECTORY/diff-lib.sh" author='The Real Author <someguy@his.email.org>' test_tick test_expect_success 'initial statu...
Shell
#!/bin/sh test_description='git show' . ./test-lib.sh test_expect_success setup ' echo hello world >foo && H=$(git hash-object -w foo) && git tag -a foo-tag -m "Tags $H" $H && HH=$(expr "$H" : "\(..\)") && H38=$(expr "$H" : "..\(.*\)") && rm -f .git/objects/$HH/$H38 ' test_expect_success 'showing a tag that p...
Shell
#!/bin/sh # # Copyright (c) 2005 Jon Seymour # test_description='Tests git rev-list --topo-order functionality' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions list_duplicates() { "$@" | sort | uniq -d } date >path0 git update-index --add path0 save_tag tree git write-tree on_committ...
Shell
#!/bin/sh # # 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 p4 transparency to shell metachars in filenames' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' test_expect_success 'init depot' ' ( cd "$cli" && echo file1 >file1 && p4 add file1 && p4 submit -d "file1" ) ' test_expect_success 'shell metachars in filenam...
Shell
#!/bin/sh # Copyright (c) 2010, Jens Lehmann test_description='Recursive "git fetch" for submodules' . ./test-lib.sh pwd=$(pwd) add_upstream_commit() { ( cd submodule && head1=$(git rev-parse --short HEAD) && echo new >> subfile && test_tick && git add subfile && git commit -m new subfile && head2=$(...
Shell
#!/bin/sh # # Copyright (c) 2005 Johannes Schindelin # test_description='Test git config in different settings' . ./test-lib.sh test_expect_success 'clear default config' ' rm -f .git/config ' cat > expect << EOF [core] penguin = little blue EOF test_expect_success 'initial' ' git config core.penguin "little blu...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes E. Schindelin # test_description='add -e basic tests' . ./test-lib.sh cat > file << EOF LO, praise of the prowess of people-kings of spear-armed Danes, in days long sped, we have heard, and what honor the athelings won! Oft Scyld the Scefing from squadroned foes, from many a...
Shell
#!/bin/sh # # Copyright (c) 2010 Peter Collingbourne # test_description='git apply submodule tests' . ./test-lib.sh test_expect_success setup ' cat > create-sm.patch <<EOF && diff --git a/dir/sm b/dir/sm new file mode 160000 index 0000000..0123456 --- /dev/null +++ b/dir/sm @@ -0,0 +1 @@ +Subproject commit 01234567...
Shell
#!/bin/sh # # this script sets up a Subversion repository for Makefile in the # first ever git merge, as if it were done with svk. # set -e svk depotmap foo ~/.svk/foo svk co /foo/ foo cd foo mkdir trunk mkdir branches svk add trunk branches svk commit -m "Setup trunk and branches" cd trunk git cat-file blob 6683463...
Shell
#!/bin/sh test_description='Merge-recursive merging renames' . ./test-lib.sh modify () { sed -e "$1" <"$2" >"$2.x" && mv "$2.x" "$2" } test_expect_success setup \ ' cat >A <<\EOF && a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb c ccccccccccccccccccccccccccccc...
Shell
#!/bin/sh test_description='Test cherry-pick with directory/file conflicts' . ./test-lib.sh test_expect_success 'Initialize repository' ' mkdir a && >a/f && git add a && git commit -m a ' test_expect_success SYMLINKS 'Setup rename across paths each below D/F conflicts' ' mkdir b && ln -s ../a b/a && git add b...
Shell
#!/bin/sh # test_description='git web--browse basic tests This test checks that git web--browse can handle various valid URLs.' . ./test-lib.sh test_web_browse () { # browser=$1 url=$2 git web--browse --browser="$1" "$2" >actual && tr -d '\015' <actual >text && test_cmp expect text } test_expect_success \ 'UR...
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 # # Copyright (c) 2007 Eric Wong test_description='git svn dcommit clobber series' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' mkdir import && (cd import && awk "BEGIN { for (i = 1; i < 64; i++) { print i } }" > file svn_cmd import -m "initial" . "$svnrepo" ) && git svn init "$svnrepo" &...
Shell
#!/bin/sh test_description='git merge Testing octopus merge when reducing parents to independent branches.' . ./test-lib.sh # 0 - 1 # \ 2 # \ 3 # \ 4 - 5 # # So 1, 2, 3 and 5 should be kept, 4 should be avoided. test_expect_success 'setup' ' echo c0 > c0.c && git add c0.c && git commit -m c0 && git tag c...
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 # # Copyright (c) 2009 Eric Wong, Mark Lodato # test_description='git svn authors prog tests' . ./lib-git-svn.sh cat > svn-authors-prog <<'EOF' #!/usr/bin/perl $_ = shift; if (s/-sub$//) { print "$_ <$_\@sub.example.com>\n"; } else { print "$_ <$_\@example.com>\n"; } EOF chmod +x svn-authors-prog cat >...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git apply handling binary patches ' . ./test-lib.sh test_expect_success '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 bl...
Shell
#!/bin/sh test_description='Basic fetch/push functionality. This test checks the following functionality: * command-line syntax * refspecs * fast-forward detection, and overriding it * configuration * hooks * --porcelain output format * hiderefs ' . ./test-lib.sh D=`pwd` mk_empty () { repo_name="$1" rm -fr "$re...
Shell
#!/bin/sh # # Copyright (c) 2007 Eric Wong # # Don't run this test by default unless the user really wants it # I don't like the idea of taking a port and possibly leaving a # daemon running on a users system if the test fails. # Not all git users will need to interact with SVN. test_description='git svn dcommit new ...
Shell
#!/bin/sh # # Copyright (c) 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='messages from rebase operation' . ./test-lib.sh quick_one () { echo "$1" >"file$1" && git add "file$1" && test_tick && git commit -m "$1" } test_expect_success setup ' quick_one O && git branch topic && quick_one X && quick_one A && quick_one B && quick_one Y && git checkout ...
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='basic work tree status reporting' . ./test-lib.sh test_expect_success setup ' git config --global advice.statusuoption false && test_commit A && test_commit B oneside added && git checkout A^0 && test_commit C oneside created ' test_expect_success 'A/A conflict' ' git checkout B^0 ...
Shell
#!/bin/sh test_description='common tail optimization' . ./test-lib.sh z=zzzzzzzz ;# 8 z="$z$z$z$z$z$z$z$z" ;# 64 z="$z$z$z$z$z$z$z$z" ;# 512 z="$z$z$z$z" ;# 2048 z2047=$(expr "$z" : '.\(.*\)') ; #2047 x=zzzzzzzzzz ;# 10 y="$x$x$x$x$x$x$x$x$x$x" ;# 100 z="$y$y$y$y$y$y$y$y$y$y" ;# 1000 z1000=$z z100=$y z10=$x zs()...
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) 2010 Andreas Gruenbacher # test_description='git apply filename consistency check' . ./test-lib.sh test_expect_success setup ' cat > bad1.patch <<EOF && diff --git a/f b/f new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/f-blah @@ -0,0 +1 @@ +1 EOF cat > bad2.patch <<EOF ...
Shell
#!/bin/sh test_description='git-status ignored files' . ./test-lib.sh cat >expected <<\EOF ?? .gitignore ?? actual ?? expected ?? untracked/ EOF test_expect_success 'status untracked directory with --ignored' ' echo "ignored" >.gitignore && mkdir untracked && : >untracked/ignored && : >untracked/uncommitted && ...
Shell
#!/bin/sh # Copyright (c) 2011, Google Inc. test_description='diff --stat-count' . ./test-lib.sh test_expect_success 'setup' ' >a && >b && >c && >d && git add a b c d && git commit -m initial ' test_expect_success 'mode-only change show as a 0-line change' ' git reset --hard && test_chmod +x b d && echo a >...
Shell
#!/bin/sh test_description='test textconv caching' . ./test-lib.sh cat >helper <<'EOF' #!/bin/sh sed 's/^/converted: /' "$@" >helper.out cat helper.out EOF chmod +x helper test_expect_success 'setup' ' echo foo content 1 >foo.bin && echo bar content 1 >bar.bin && git add . && git commit -m one && echo foo conte...
Shell
#!/bin/sh # 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 # # Copyright (c) 2005 Junio C Hamano # test_description='Same rename detection as t4003 but testing diff-raw -z. ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success \ 'prepare reference tree' \ 'cat "$TEST_DIRECTORY"/../COPYING >COPYING && echo...
Shell
#!/bin/sh # # Copyright (c) 2009 Eric Wong test_description='git svn creates empty directories' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' for i in a b c d d/e d/e/f "weird file name" do svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i" done ' test_expect_success 'clone' 'git svn clone "$svnrepo" clon...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='Test rename detection in diff engine. ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh echo >path0 'Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Line 7 Line 8 Line 9 Line 10 line 11 Line 12 Line 13 Line 14 Line 15 ' test_expect_success \ 'update-...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='More rename detection ' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success \ 'prepare reference tree' \ 'cat "$TEST_DIRECTORY"/../COPYING >COPYING && echo frotz >rezrov && git update-i...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # Copyright (c) 2005 Robert Fitzsimons # test_description='git ls-tree directory and filenames handling. This test runs git ls-tree with the following in a tree. 1.txt - a file 2.txt - a file path0/a/b/c/1.txt - a file in a direct...
Shell
#!/bin/sh test_description='fetch follows remote-tracking branches correctly' . ./test-lib.sh test_expect_success setup ' >file && git add . && test_tick && git commit -m Initial && git branch b-0 && git branch b1 && git branch b/one && test_create_repo other && ( cd other && git config remote.origin.ur...
Shell
#!/bin/sh # # Copyright (c) 2007 Junio C Hamano test_description='git checkout to switch between branches with symlink<->dir' . ./test-lib.sh test_expect_success SYMLINKS setup ' mkdir frotz && echo hello >frotz/filfre && git add frotz/filfre && test_tick && git commit -m "master has file frotz/filfre" && gi...
Shell
#!/bin/sh # # Copyright (c) 2007 Jakub Narebski # test_description='gitweb as standalone script (basic tests). This test runs gitweb (git web interface) as CGI script from commandline, and checks that it would not write any errors or warnings to log.' . ./gitweb-lib.sh # -------------------------------------------...
Shell
#!/bin/sh test_description='git ls-remote' . ./test-lib.sh test_expect_success setup ' >file && git add file && test_tick && git commit -m initial && git tag mark && git show-ref --tags -d | sed -e "s/ / /" >expected.tag && ( echo "$(git rev-parse HEAD) HEAD" git show-ref -d | sed -e "s/ / /" ) >expected...
Shell
#!/bin/sh # # Copyright (c) 2009, 2010, 2012, 2013 David Aguilar # test_description='git-difftool Testing basic diff tool invocation ' . ./test-lib.sh difftool_test_setup () { test_config diff.tool test-tool && test_config difftool.test-tool.cmd 'cat "$LOCAL"' && test_config difftool.bogus-tool.cmd false } prom...
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 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 && echo "one text" > .gitattributes && for w in Hello world how are you; do echo $w; done >one && for w in I am very very fine thank you;...
Shell
#!/bin/sh # # Copyright (c) 2009 Christian Couder # test_description='Tests for "git reset" with "--merge" and "--keep" options' . ./test-lib.sh test_expect_success setup ' for i in 1 2 3; do echo line $i; done >file1 && cat file1 >file2 && git add file1 file2 && test_tick && git commit -m "Initi...
Shell
#!/bin/sh test_description='Test am with auto.crlf' . ./test-lib.sh cat >patchfile <<\EOF From 38be10072e45dd6b08ce40851e3fca60a31a340b Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen <x@y.com> Date: Thu, 23 Aug 2007 13:00:00 +0200 Subject: test1 --- foo | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) c...
Shell
#!/bin/sh test_description='git cat-file textconv support' . ./test-lib.sh cat >helper <<'EOF' #!/bin/sh grep -q '^bin: ' "$1" || { echo "E: $1 is not \"binary\" file" 1>&2; exit 1; } sed 's/^bin: /converted: /' "$1" EOF chmod +x helper test_expect_success 'setup ' ' echo "bin: test" >one.bin && if test_have_prere...
Shell
#!/bin/sh test_description='Test merge without common ancestors' . ./test-lib.sh # This scenario is based on a real-world repository of Shawn Pearce. # 1 - A - D - F # \ X / # B X # X \ # 2 - C - E - G GIT_COMMITTER_DATE="2006-12-12 23:28:00 +0100" export GIT_COMMITTER_DATE test_expect_success ...
Shell
#!/bin/sh # # Copyright (c) 2008 Nicolas Pitre # test_description='resilience to pack corruptions with redundant objects' . ./test-lib.sh # Note: the test objects are created with knowledge of their pack encoding # to ensure good code path coverage, and to facilitate direct alteration # later on. The assumed charact...
Shell
#!/bin/sh test_description='git status with certain file name lengths' . ./test-lib.sh files="0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z" check() { len=$1 prefix=$2 for i in $files do : >$prefix$i done test_expect_success "status, filename length $len" " git add $prefix* && ...
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='format-patch mime headers and extra headers do not conflict' . ./test-lib.sh test_expect_success 'create commit with utf-8 body' ' echo content >file && git add file && git commit -m one && echo more >>file && git commit -a -m "two utf-8 body: ñ" ' test_expect_success 'patch has mi...
Shell
#!/bin/sh # # Copyright (c) 2010 Steven Walter # test_description='git svn mergeinfo propagation' . ./lib-git-svn.sh say 'define NO_SVN_TESTS to skip git svn tests' test_expect_success 'initialize source svn repo' ' svn_cmd mkdir -m x "$svnrepo"/trunk && svn_cmd co "$svnrepo"/trunk "$SVN_TREE" && ( cd "$SVN_TR...
Shell
#!/bin/sh # # 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 test_description='git p4 label tests' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' # Basic p4 label tests. # # Note: can't have more than one label per commit - others # are silently discarded. # test_expect_success 'basic p4 labels' ' test_when_finished cleanup_git && ( cd "$cli" ...
Shell
#!/bin/sh test_description='git p4 options' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' test_expect_success 'init depot' ' ( cd "$cli" && echo file1 >file1 && p4 add file1 && p4 submit -d "change 1" && echo file2 >file2 && p4 add file2 && p4 submit -d "change 2" && echo file3 >...
Shell
#!/bin/sh test_description='merge signature verification tests' . ./test-lib.sh . "$TEST_DIRECTORY/lib-gpg.sh" test_expect_success GPG 'create signed commits' ' echo 1 >file && git add file && test_tick && git commit -m initial && git tag initial && git checkout -b side-signed && echo 3 >elif && git add elif &&...
Shell
#!/bin/sh # Copyright (c) 2008 Marcus Griep test_description='git svn multi-glob branch names' . ./lib-git-svn.sh test_expect_success 'setup svnrepo' ' mkdir project project/trunk project/branches \ project/branches/v14.1 project/tags && echo foo > project/trunk/foo && svn_cmd import -m "$test_description" proj...
Shell
#!/bin/sh # # Copyright (c) 2006 Shawn Pearce # test_description='git checkout-index --temp test. With --temp flag, git checkout-index writes to temporary merge files rather than the tracked path.' . ./test-lib.sh test_expect_success \ 'preparation' ' mkdir asubdir && echo tree1path0 >path0 && echo tree1path1 >path...
Shell
#!/bin/sh # # Copyright (c) 2006 Shawn O. Pearce # test_description='Test the update hook infrastructure.' . ./test-lib.sh test_expect_success setup ' echo This is a test. >a && git update-index --add a && tree0=$(git write-tree) && commit0=$(echo setup | git commit-tree $tree0) && echo We hope it works. >a && ...
Shell
#!/bin/sh test_description='magic pathspec tests using git-add' . ./test-lib.sh test_expect_success 'setup' ' mkdir sub anothersub && : >sub/foo && : >anothersub/foo ' test_expect_success 'add :/' " cat >expected <<-EOF && add 'anothersub/foo' add 'expected' add 'sub/actual' add 'sub/foo' EOF (cd sub && g...
Shell
#!/bin/sh test_description='git p4 preserve users' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' test_expect_success 'create files' ' ( cd "$cli" && p4 client -o | sed "/LineEnd/s/:.*/:unix/" | p4 client -i && echo file1 >file1 && echo file2 >file2 && p4 add file1 file2 && p4 submit ...
Shell
#!/bin/sh # # Copyright (c) 2009 Mark Rada # test_description='gitweb as standalone script (parsing script output). This test runs gitweb (git web interface) as a CGI script from the commandline, and checks that it produces the correct output, either in the HTTP header or the actual script output.' . ./gitweb-lib.s...
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="Test the svn importer's input handling routines. These tests provide some simple checks that the line_buffer API behaves as advertised. While at it, check that input of newlines and null bytes are handled correctly. " . ./test-lib.sh test_expect_success 'hello world' ' echo ">HELLO" >ex...
Shell
#!/bin/sh test_description='fetch/push involving alternates' . ./test-lib.sh count_objects () { loose=0 inpack=0 eval "$( git count-objects -v | sed -n -e 's/^count: \(.*\)/loose=\1/p' \ -e 's/^in-pack: \(.*\)/inpack=\1/p' )" && echo $(( $loose + $inpack )) } test_expect_success setup ' ( git init ...
Shell
#!/bin/sh test_description='.git file Verify that plumbing commands work when .git is a file ' . ./test-lib.sh objpath() { echo "$1" | sed -e 's|\(..\)|\1/|' } objck() { p=$(objpath "$1") if test ! -f "$REAL/objects/$p" then echo "Object not found: $REAL/objects/$p" false fi } test_expect_success 'ini...
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' ' mkdir ...
Shell
#!/bin/sh test_description='Merge-recursive merging renames' . ./test-lib.sh test_expect_success setup \ ' cat >A <<\EOF && a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb c cccccccccccccccccccccccccccccccccccccccccccccccc d ddddddddddddddddddddddddddddddddddddddd...
Shell
#!/bin/sh test_description='basic update-index tests Tests for command-line parsing and basic operation. ' . ./test-lib.sh test_expect_success 'update-index --nonsense fails' ' test_must_fail git update-index --nonsense 2>msg && cat msg && test -s msg ' test_expect_success 'update-index --nonsense dumps usage' ...
Shell
#!/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='histogram diff algorithm' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-diff-alternative.sh test_diff_frobnitz "histogram" test_diff_unique "histogram" test_done
Shell
#!/bin/sh test_description='merge conflict in crlf repo b---M / / initial---a ' . ./test-lib.sh test_expect_success setup ' git config core.autocrlf true && echo foo | append_cr >file && git add file && git commit -m "Initial" && git tag initial && git branch side && echo line from a | append_c...
Shell
#!/bin/sh printf "Content-Type: text/%s\n" "html" echo printf "%s\n" "001e# service=git-upload-pack" printf "%s" "0000" printf "%s%c%s%s\n" \ "00a58681d9f286a48b08f37b3a095330da16689e3693 HEAD" \ 0 \ " include-tag multi_ack_detailed multi_ack ofs-delta" \ " side-band side-band-64k thin-pack no-progress shallow no...
Shell
#!/bin/sh test_description='basic git gc tests ' . ./test-lib.sh test_expect_success 'gc empty repository' ' git gc ' test_expect_success 'gc --gobbledegook' ' test_expect_code 129 git gc --nonsense 2>err && test_i18ngrep "[Uu]sage: git gc" err ' test_expect_success 'gc -h with invalid configuration' ' mkdir b...
Shell
#!/bin/sh test_description='git p4 submit failure handling' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' test_expect_success 'init depot' ' ( cd "$cli" && p4 client -o | sed "/LineEnd/s/:.*/:unix/" | p4 client -i && echo line1 >file1 && p4 add file1 && p4 submit -d "line1 in file1" )...
Shell
#!/bin/sh # # Copyright (c) 2005 Johannes Schindelin # test_description='A simple turial in the form of a test case' . ./test-lib.sh test_expect_success 'blob' ' echo "Hello World" > hello && echo "Silly example" > example && git update-index --add hello example && test blob = "$(git cat-file -t 557db03)" ' ...
Shell
#!/bin/sh test_expect_success 'determine default pager' ' test_might_fail git config --unset core.pager && less=$( unset PAGER GIT_PAGER; git var GIT_PAGER ) && test -n "$less" ' if expr "$less" : '[a-z][a-z]*$' >/dev/null then test_set_prereq SIMPLEPAGER fi
Shell
#!/bin/sh test_description='git remote porcelain-ish' . ./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 master ...
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 # # Copyright (c) 2005 Junio C Hamano # test_description='Break and then rename We have two very different files, file0 and file1, registered in a tree. We update file1 so drastically that it is more similar to file0, and then remove file0. With -B, changes to file1 should be broken into separate delete a...
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='blob conversion via gitattributes' . ./test-lib.sh cat <<EOF >rot13.sh #!$SHELL_PATH tr \ 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \ 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM' EOF chmod +x rot13.sh test_expect_success setup ' git config filter.rot13.smudge ...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='Two way merge with read-tree -m $H $M This test tries two-way merge (aka fast-forward with carry forward). There is the head (called H) and another commit (called M), which is simply ahead of H. The index and the work tree contains a state that is ...
Shell
#!/bin/sh out_prefix=$(dirname "$0")/../test-results/valgrind.out output= count=0 total_count=0 missing_message= new_line=' ' # start outputting the current valgrind error in $out_prefix.++$count, # and the test case which failed in the corresponding .message file start_output () { test -z "$output" || return # pr...
Shell
#!/bin/sh base=$(basename "$0") TOOL_OPTIONS='--leak-check=no' case "$GIT_VALGRIND_MODE" in memcheck-fast) ;; memcheck) VALGRIND_VERSION=$(valgrind --version) VALGRIND_MAJOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*\([0-9]*\)') VALGRIND_MINOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*[0-9]*\.\([0-9]*\)') test 3 -gt "$VA...
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 Jens Lehmann, based on t7401 by Ping Yin # test_description='Support for verbose submodule differences in git diff This test tries to verify the sanity of the --submodule option of git diff. ' . ./test-lib.sh add_file () { ( cd "$1" && shift && for name do echo "$name" >...
Shell
: included from 6002 and others [ -d .git/refs/tags ] || mkdir -p .git/refs/tags :> sed.script # Answer the sha1 has associated with the tag. The tag must exist in .git or .git/refs/tags tag() { _tag=$1 [ -f .git/refs/tags/$_tag ] || error "tag: \"$_tag\" does not exist" cat .git/refs/tags/$_tag } # Generate a c...
Shell
#!/bin/sh # # Copyright (c) 2005 Amos Waterland # test_description='git rebase assorted tests This test runs git rebase and checks that the author information is not lost among other things. ' . ./test-lib.sh GIT_AUTHOR_NAME=author@name GIT_AUTHOR_EMAIL=bogus@email@address export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL te...
Shell
#!/bin/sh # # Copyright (c) 2007 Eric Wong # test_description='git svn tracking removed top-level path' . ./lib-git-svn.sh test_expect_success 'make history for tracking' ' mkdir import && mkdir import/trunk && echo hello >> import/trunk/README && svn_cmd import -m initial import "$svnrepo" && rm -rf import && ...
Shell
#!/bin/sh # # Copyright (c) 2006 Shawn Pearce # test_description='mmap sliding window tests' . ./test-lib.sh test_expect_success \ 'setup' \ 'rm -f .git/index* && for i in a b c do echo $i >$i && test-genrandom "$i" 32768 >>$i && git update-index --add $i || return 1 ...
Shell
#!/bin/sh # # Copyright (c) 2007 Lars Hjemli # test_description='Basic porcelain support for submodules This test tries to verify basic sanity of the init, update and status subcommands of git submodule. ' . ./test-lib.sh test_expect_success 'setup - initial commit' ' >t && git add t && git commit -m "initial co...
Shell
#!/bin/sh test_description='Test cherry-pick continuation features + conflicting: rewrites unrelated to conflicting + yetanotherpick: rewrites foo to e + anotherpick: rewrites foo to d + picked: rewrites foo to c + unrelatedpick: rewrites unrelated to reallyunrelated + base: rewrites foo to b + initial:...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes E. Schindelin # test_description='Test commit notes index (expensive!)' . ./test-lib.sh test_set_prereq NOT_EXPENSIVE test -n "$GIT_NOTES_TIMING_TESTS" && test_set_prereq EXPENSIVE test -x /usr/bin/time && test_set_prereq USR_BIN_TIME create_repo () { number_of_commits=$1 ...
Shell
#!/bin/sh test_description='git init' . ./test-lib.sh check_config () { if test -d "$1" && test -f "$1/config" && test -d "$1/refs" then : happy else echo "expected a directory $1, a file $1/config and $1/refs" return 1 fi bare=$(GIT_CONFIG="$1/config" git config --bool core.bare) worktree=$(GIT_CONFIG="...
Shell