code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/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='test multi-tree read-tree without merging' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree.sh test_expect_success setup ' echo one >a && git add a && git commit -m initial && git tag initial && echo two >b && git add b && git commit -m second && git checkout -b side initial && ...
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) 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 # # Copyright (c) 2009 Robert Zeh test_description='git svn creates empty directories, calls git gc, makes sure they are still empty' . ./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_expec...
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) 2008 Kevin Ballard # test_description='git svn clone with percent escapes' . ./lib-git-svn.sh test_expect_success 'setup svnrepo' ' mkdir project project/trunk project/branches project/tags && echo foo > project/trunk/foo && svn_cmd import -m "$test_description" project "$svnrepo/pr jec...
Shell
#!/bin/sh test_description='Test Git when git repository is located at root This test requires write access in root. Do not bother if you do not have a throwaway chroot or VM. Script t1509/prepare-chroot.sh may help you setup chroot, then you can chroot in and execute this test from there. ' . ./test-lib.sh test_c...
Shell
#!/bin/sh test_description='GIT_EDITOR, core.editor, and stuff' . ./test-lib.sh unset EDITOR VISUAL GIT_EDITOR test_expect_success 'determine default editor' ' vi=$(TERM=vt100 git var GIT_EDITOR) && test -n "$vi" ' if ! expr "$vi" : '[a-z]*$' >/dev/null then vi= fi for i in GIT_EDITOR core_editor EDITOR VISU...
Shell
#!/bin/sh test_description='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) 2007 Junio C Hamano # test_description='Quoting paths in diff output. ' . ./test-lib.sh P0='pathname' P1='pathname with HT' P2='pathname with SP' P3='pathname with LF' echo 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || { skip_all='Your filesystem does not allow tabs in filenames'...
Shell
#!/bin/sh test_description='tracking branch update checks for git push' . ./test-lib.sh test_expect_success 'setup' ' echo 1 >file && git add file && git commit -m 1 && git branch b1 && git branch b2 && git branch b3 && git clone . aa && git checkout b1 && echo b1 >>file && git commit -a -m b1 && git chec...
Shell
#!/bin/sh # # Copyright (c) 2007 Carl D. Worth # test_description='git ls-files test (--with-tree). This test runs git ls-files --with-tree and in particular in a scenario known to trigger a crash with some versions of git. ' . ./test-lib.sh test_expect_success setup ' # The bug we are exercising requires a fair n...
Shell
#!/bin/sh 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) 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='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 test_description='test git rev-list --cherry-pick -- file' . ./test-lib.sh # A---B---D---F # \ # \ # C---E # # B changes a file foo.c, adding a line of text. C changes foo.c as # well as bar.c, but the change in foo.c was identical to change B. # D and C change bar in the same way, E and F different...
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) 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='recursive merge corner cases involving criss-cross merges' . ./test-lib.sh get_clean_checkout () { git reset --hard && git clean -fdqx && git checkout "$1" } # # L1 L2 # o---o # / \ / \ # o X ? # \ / \ / # o---o # R1 R2 # test_expect_success 'setup basic criss-cross + r...
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='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 test_description='Merge-recursive ours and theirs variants' . ./test-lib.sh test_expect_success setup ' for i in 1 2 3 4 5 6 7 8 9 do echo "$i" done >file && git add file && cp file elif && git commit -m initial && sed -e "s/1/one/" -e "s/9/nine/" >file <elif && git commit -a -m ours && git che...
Shell
#!/bin/sh test_description='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
#!/bin/sh test_description='ls-files tests with relative paths This test runs git ls-files with various relative path arguments. ' . ./test-lib.sh new_line=' ' sq=\' test_expect_success 'prepare' ' : >never-mind-me && git add never-mind-me && mkdir top && ( cd top && mkdir sub && x="x xa xbc xdef xghij x...
Shell
#!/bin/sh test_description='fetch/receive strict mode' . ./test-lib.sh test_expect_success setup ' echo hello >greetings && git add greetings && git commit -m greetings && S=$(git rev-parse :greetings | sed -e "s|^..|&/|") && X=$(echo bye | git hash-object -w --stdin | sed -e "s|^..|&/|") && mv -f .git/objects...
Shell
#!/bin/sh test_expect_success PERL 'set up terminal for tests' ' # Reading from the pty master seems to get stuck _sometimes_ # on Mac OS X 10.5.0, using Perl 5.10.0 or 5.8.9. # # Reproduction recipe: run # # i=0 # while ./test-terminal.perl echo hi $i # do # : $((i = $i + 1)) # done # # After 2000 iterat...
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) 2010 Jay Soffian # test_description='git svn fancy glob test' . ./lib-git-svn.sh test_expect_success 'load svn repo' " svnadmin load -q '$rawsvnrepo' < '$TEST_DIRECTORY/t9154/svn.dump' && git svn init --minimize-url -T trunk '$svnrepo' && git svn fetch " test_expect_success 'add red ...
Shell
#!/bin/sh test_description='git archive attribute pattern tests' . ./test-lib.sh 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 ignored export-ig...
Shell
#!/bin/sh # # Copyright (c) 2011 Roberto Tyley # test_description='Correctly identify and parse loose object headers There are two file formats for loose objects - the original standard format, and the experimental format introduced with Git v1.4.3, later deprecated with v1.5.3. Although Git no longer writes the expe...
Shell
#!/bin/sh test_description='test log with i18n features' . ./test-lib.sh # two forms of é utf8_e=$(printf '\303\251') latin1_e=$(printf '\351') test_expect_success 'create commits in different encodings' ' test_tick && cat >msg <<-EOF && utf8 t${utf8_e}st EOF git add msg && git -c i18n.commitencoding=utf8 co...
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 # # Copyright (c) 2008 Timo Hirvonen # test_description='Test diff/status color escape codes' . ./test-lib.sh color() { actual=$(git config --get-color no.such.slot "$1") && test "$actual" = "$2" } invalid_color() { test_must_fail git config --get-color no.such.slot "$1" } test_expect_success 'reset' ...
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 test_description='git am with corrupt input' . ./test-lib.sh # Note the missing "+++" line: cat > bad-patch.diff <<'EOF' From: A U Thor <au.thor@example.com> diff --git a/f b/f index 7898192..6178079 100644 --- a/f @@ -1 +1 @@ -a +b EOF test_expect_success setup ' test $? = 0 && echo a > f && git add f ...
Shell
#!/bin/sh # # Copyright (c) 2007 Lars Hjemli # test_description='git merge Testing basic merge operations/option parsing. ! [c0] commit 0 ! [c1] commit 1 ! [c2] commit 2 ! [c3] commit 3 ! [c4] c4 ! [c5] c5 ! [c6] c6 * [master] Merge commit 'c1' -------- - [master] Merge commit 'c1'...
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) 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 # # 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='Test cloning a repository larger than 2 gigabyte' . ./test-lib.sh if test -z "$GIT_TEST_CLONE_2GB" then say 'Skipping expensive 2GB clone test; enable it with GIT_TEST_CLONE_2GB=t' else test_set_prereq CLONE_2GB fi test_expect_success CLONE_2GB 'setup' ' git config pack.compression 0 ...
Shell
#!/bin/sh test_description='test cloning a repository with detached HEAD' . ./test-lib.sh head_is_detached() { git --git-dir=$1/.git rev-parse --verify HEAD && test_must_fail git --git-dir=$1/.git symbolic-ref HEAD } test_expect_success 'setup' ' echo one >file && git add file && git commit -m one && echo two ...
Shell
#!/bin/sh # # Copyright (c) 2006 Brian C Gernhardt # test_description='Format-patch numbering options' . ./test-lib.sh test_expect_success setup ' echo A > file && git add file && git commit -m First && echo B >> file && git commit -a -m Second && echo C >> file && git commit -a -m Third ' # Each of thes...
Shell
#!/bin/sh test_description='diff whitespace error detection' . ./test-lib.sh test_expect_success setup ' git config diff.color.whitespace "blue reverse" && >F && git add F && echo " Eight SP indent" >>F && echo " HT and SP indent" >>F && echo "With trailing SP " >>F && echo "Carriage ReturnQ" | tr Q...
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 <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 # # 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) 2012 Valentin Duperray, Lucien Kong, Franck Jonas, # Thomas Nguy, Khoi Nguyen # Grenoble INP Ensimag # test_description='git status advices' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh set_fake_editor test_expect_success 'prepare for conflicts' ' test_commit init main...
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 test_description='Basic subproject functionality' . ./test-lib.sh test_expect_success 'setup: create superproject' ' : >Makefile && git add Makefile && git commit -m "Superproject created" ' test_expect_success 'setup: create subprojects' ' mkdir sub1 && ( cd sub1 && git init && : >Makefile && git add...
Shell
#!/bin/sh test_description=gitattributes . ./test-lib.sh attr_check () { path="$1" expect="$2" git $3 check-attr test -- "$path" >actual 2>err && echo "$path: test: $2" >expect && test_cmp expect actual && test_line_count = 0 err } test_expect_success 'setup' ' mkdir -p a/b/d a/c b && ( echo "[attr]notes...
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) 2009 Eric Wong test_description='git svn refuses to dcommit non-UTF8 messages' . ./lib-git-svn.sh # ISO-2022-JP can pass for valid UTF-8, so skipping that in this test for H in ISO8859-1 eucJP do test_expect_success "$H setup" ' mkdir $H && svn_cmd import -m "$H test" $H "$svnrepo"/...
Shell
#!/bin/sh test_description='push to a repository that borrows from elsewhere' . ./test-lib.sh test_expect_success setup ' mkdir alice-pub && ( cd alice-pub && GIT_DIR=. git init ) && mkdir alice-work && ( cd alice-work && git init && >file && git add . && git commit -m initial && git push ../ali...
Shell
#!/bin/sh test_description='fetch/push involving ref namespaces' . ./test-lib.sh test_expect_success setup ' test_tick && git init original && ( cd original && echo 0 >count && git add count && test_commit 0 && echo 1 >count && git add count && test_commit 1 && git remote add pushee-namespaced "ext...
Shell
#!/bin/sh test_description='git filter-branch' . ./test-lib.sh test_expect_success 'setup' ' test_commit A && GIT_COMMITTER_DATE="@0 +0000" GIT_AUTHOR_DATE="@0 +0000" && test_commit --notick B && git checkout -b branch B && test_commit D && mkdir dir && test_commit dir/D && test_commit E && git checkout mast...
Shell
#!/bin/sh test_description='rebase should handle arbitrary git message' . ./test-lib.sh cat >F <<\EOF This is an example of a commit log message that does not conform to git commit convention. It has two paragraphs, but its first paragraph is not friendly to oneline summary format. EOF cat >G <<\EOF commit log me...
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) 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 test_description='add -i basic tests' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh test_expect_success PERL 'setup (initial)' ' echo content >file && git add file && echo more >>file && echo lines >>file ' test_expect_success PERL 'status works (initial)' ' git add -i </dev/null >output &...
Shell
#!/bin/sh . ./test-lib.sh unset CVS_SERVER if ! type cvs >/dev/null 2>&1 then skip_all='skipping cvsimport tests, cvs not found' test_done fi CVS="cvs -f" export CVS cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'` case "$cvsps_version" in 2.1 | 2.2*) ;; '') skip_all='skipping cvsimport tests, cvs...
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='test automatic tag following' . ./test-lib.sh if ! test_have_prereq NOT_MINGW; then say "GIT_DEBUG_SEND_PACK not supported - skipping tests" fi # End state of the repository: # # T - tag1 S - tag2 # / / # L - A ------ O ------ B # \ \ ...
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='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='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='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 # # Copyright (c) 2008 Jan Krüger # test_description='git svn respects rewriteRoot during rebuild' . ./lib-git-svn.sh mkdir import (cd import touch foo svn_cmd import -m 'import for git svn' . "$svnrepo" >/dev/null ) rm -rf import test_expect_success 'init, fetch and checkout repository' ' git svn init...
Shell
#!/bin/sh test_description='merge-recursive backend test' . ./test-lib.sh # A <- create some files # / \ # B C <- cause rename/delete conflicts between B and C # / \ # |\ /| # | D E | # | \ / | # | X | # | / \ | # | / \ | # |/ \|...
Shell
#!/bin/sh # # Copyright (c) 2006 Shawn Pearce # test_description='git reset should cull empty subdirs' . ./test-lib.sh test_expect_success \ 'creating initial files' \ 'mkdir path0 && cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && git add path0/COPYING && git commit -m add -a' test_expect_su...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='commit and log output encodings' . ./test-lib.sh compare_with () { git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' >current && case "$3" in '') test_cmp "$2" current ;; ?*) iconv -f "$3" -t UTF-8 >current.utf8 <current && iconv -f "$3" -t...
Shell
#!/bin/sh # # Copyright (C) 2005 Rene Scharfe # test_description='git tar-tree and git get-tar-commit-id test This test covers the topics of file contents, commit date handling and commit id embedding: The contents of the repository is compared to the extracted tar archive. The repository contains simple text f...
Shell
#!/bin/sh # # Copyright (c) 2007 Eric Wong # test_description='git svn funky branch names' . ./lib-git-svn.sh # Abo-Uebernahme (Bug #994) scary_uri='Abo-Uebernahme%20%28Bug%20%23994%29' scary_ref='Abo-Uebernahme%20(Bug%20#994)' test_expect_success 'setup svnrepo' ' mkdir project project/trunk project/branches proje...
Shell
#!/bin/sh # # Copyright (c) Robin Rosenberg # test_description='Test export of commits to CVS' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh if ! test_have_prereq PERL; then skip_all='skipping git cvsexportcommit tests, perl not available' test_done fi cvs >/dev/null 2>&1 if test $? -ne 1 then ski...
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 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_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 # # Copyright (c) 2007 Andy Parkins # test_description='for-each-ref test' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-gpg.sh # Mon Jul 3 15:18:43 2006 +0000 datestamp=1151939923 setdate_and_increment () { GIT_COMMITTER_DATE="$datestamp +0200" datestamp=$(expr "$datestamp" + 1) GIT_AUTHOR_DATE="$da...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git mailinfo and git mailsplit test' . ./test-lib.sh test_expect_success 'split sample box' \ 'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last && last=`cat last` && echo total is $last && test `cat last` = 17' check_mailinfo () { m...
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 # # 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='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 # # Copyright (c) 2010, Will Palmer # test_description='Test pretty formats' . ./test-lib.sh test_expect_success 'set up basic repos' ' >foo && >bar && git add foo && test_tick && git commit -m initial && git add bar && test_tick && git commit -m "add bar" ' test_expect_success 'alias builtin forma...
Shell
#!/bin/sh # # Copyright (c) 2009 Johan Herland # test_description='Test "git submodule foreach" This test verifies that "git submodule foreach" correctly visits all submodules that are currently checked out. ' . ./test-lib.sh test_expect_success 'setup a submodule tree' ' echo file > file && git add file && tes...
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='ignore CR in CRLF sequence while computing similiarity' . ./test-lib.sh test_expect_success setup ' cat "$TEST_DIRECTORY"/t0022-crlf-rename.sh >sample && git add sample && test_tick && git commit -m Initial && append_cr <"$TEST_DIRECTORY"/t0022-crlf-rename.sh >elpmas && git add e...
Shell
#!/bin/sh 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) 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 # # 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 HT=' ' echo 2>/dev/null > "Name with an${HT}HT" if ! test -f "Name with an${HT}HT" then # since FAT/N...
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='selecting remote repo in ambiguous cases' . ./test-lib.sh reset() { rm -rf foo foo.git fetch clone } make_tree() { git init "$1" && (cd "$1" && test_commit "$1") } make_bare() { git init --bare "$1" && (cd "$1" && tree=`git hash-object -w -t tree /dev/null` && commit=$(echo "$1"...
Shell
#!/bin/sh # # Copyright (c) 2006 Carl D. Worth # test_description='Test of git add, including the -- option.' . ./test-lib.sh test_expect_success \ 'Test of git add' \ 'touch foo && git add foo' test_expect_success \ 'Post-check that foo is in the index' \ 'git ls-files foo | grep foo' test_expect_...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git checkout-index test. This test registers the following filesystem structure in the cache: path0/file0 - a file in a directory path1/file1 - a file in a directory and attempts to check it out when the work tree has: path0/file0 - a ...
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 && echo third >f...
Shell
#!/bin/sh # # Copyright (c) 2008 David Reiss # test_description='Test various path utilities' . ./test-lib.sh norm_path() { test_expect_success $3 "normalize path: $1 => $2" \ "test \"\$(test-path-utils normalize_path_copy '$1')\" = '$2'" } # On Windows, we are using MSYS's bash, which mangles the paths. # Absolu...
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 # # 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='test diff with a bogus tree containing the null sha1' . ./test-lib.sh empty_tree=4b825dc642cb6eb9a060e54bf8d69288fbee4904 test_expect_success 'create bogus tree' ' bogus_tree=$( printf "100644 fooQQQQQQQQQQQQQQQQQQQQQ" | q_to_nul | git hash-object -w --stdin -t tree ) ' test_expe...
Shell
#!/bin/sh die() { echo >&2 "$@" exit 1 } xmkdir() { while [ -n "$1" ]; do [ -d "$1" ] || mkdir "$1" || die "Unable to mkdir $1" shift done } R="$1" [ -n "$R" ] || die "Usage: prepare-chroot.sh <root>" [ -x git ] || die "This script needs to be executed at git source code's top directory" [ -x /bin/busybox ]...
Shell