code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/bin/sh while [ "$1" ] do if [ "$1" != "git-sh-setup" -a "$1" != "git-parse-remote" -a "$1" != "git-svn" ]; then old="$1" new=$(echo "$1" | sed 's/git-/git /') echo "Converting '$old' to '$new'" sed -i "s/\\<$old\\>/$new/g" $(git ls-files '*.sh') fi shift done sed -i 's/git merge-one-file/git-merge-one-fi...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # # Fetch one or more remote refs and merge it/them into the current HEAD. USAGE='[-n | --no-stat] [--[no-]commit] [--[no-]squash] [--[no-]ff] [-s strategy]... [<fetch-options>] <repo> <head>...' LONG_USAGE='Fetch one or more remote refs and merge it/them into the curren...
Shell
#!/bin/sh # # Copyright (c) 2010 Junio C Hamano. # case "$action" in continue) git am --resolved --resolvemsg="$resolvemsg" && move_to_original_branch exit ;; skip) git am --skip --resolvemsg="$resolvemsg" && move_to_original_branch exit ;; esac test -n "$rebase_root" && root_flag=--root ret=0 if test -n "$k...
Shell
#!/bin/sh OPTIONS_KEEPDASHDASH= OPTIONS_SPEC="\ git quiltimport [options] -- n,dry-run dry run author= author name and email address for patches without any patches= path to the quilt series and patches " SUBDIRECTORY_ON=Yes . git-sh-setup dry_run="" quilt_author="" while test $# != 0 do case "$1" in ...
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 && for w in Hello world how are you; do echo $w; done >one && mkdir dir && for w in I am very very fine thank you; do echo $w; done >dir/t...
Shell
#!/bin/sh test_description='git repack works correctly' . ./test-lib.sh fsha1= csha1= tsha1= test_expect_success '-A with -d option leaves unreachable objects unpacked' ' echo content > file1 && git add . && test_tick && git commit -m initial_commit && # create a transient branch with unique content git check...
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) 2008 Lea Wiemann # test_description='perl interface (Git.pm)' . ./test-lib.sh if ! test_have_prereq PERL; then skip_all='skipping perl interface tests, perl not available' test_done fi "$PERL_PATH" -MTest::More -e 0 2>/dev/null || { skip_all="Perl Test::More unavailable, skipping test"...
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='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) 2007 Junio C Hamano # test_description='git apply --whitespace=strip and configuration file. ' . ./test-lib.sh test_expect_success setup ' mkdir sub && echo A >sub/file1 && cp sub/file1 saved && git add sub/file1 && echo "B " >sub/file1 && git diff >patch.file ' # Also handcraft G...
Shell
#!/bin/sh # # Copyright (c) 2012 Heiko Voigt # test_description='Test revision walking api' . ./test-lib.sh cat >run_twice_expected <<-EOF 1st > add b > add a 2nd > add b > add a EOF test_expect_success 'setup' ' echo a > a && git add a && git commit -m "add a" && echo b > b && git add b && git commit -m ...
Shell
#!/bin/sh test_description='push with --set-upstream' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-terminal.sh ensure_fresh_upstream() { rm -rf parent && git init --bare parent } test_expect_success 'setup bare parent' ' ensure_fresh_upstream && git remote add upstream parent ' test_expect_success 'setup local commit...
Shell
#!/bin/sh test_description='git rev-list --max-count and --skip test' . ./test-lib.sh test_expect_success 'setup' ' for n in 1 2 3 4 5 ; do \ echo $n > a ; \ git add a ; \ git commit -m "$n" ; \ done ' test_expect_success 'no options' ' test $(git rev-list HEAD | wc -l) = 5 ' te...
Shell
#!/bin/sh # # Copyright (c) 2007 Frank Lichtenheld # test_description='git-cvsserver access tests read access to a git repository with the cvs CLI client via git-cvsserver server' . ./test-lib.sh if ! test_have_prereq PERL; then skip_all='skipping git cvsserver tests, perl not available' test_done fi cvs >/dev/nu...
Shell
#!/bin/sh # # Copyright (c) 2013 Tobias Schulte # test_description='git svn branch for subproject clones' . ./lib-git-svn.sh test_expect_success 'initialize svnrepo' ' mkdir import && ( cd import && mkdir -p trunk/project branches tags && ( cd trunk/project && echo foo > foo ) && svn_cmd import -m "...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git checkout-index -u test. With -u flag, git checkout-index internally runs the equivalent of git update-index --refresh on the checked out entry.' . ./test-lib.sh test_expect_success \ 'preparation' ' echo frotz >path0 && git update-index --add p...
Shell
#!/bin/sh test_description='object name disambiguation Create blobs, trees, commits and a tag that all share the same prefix, and make sure "git rev-parse" can take advantage of type information to disambiguate short object names that are not necessarily unique. The final history used in the test has five commits, w...
Shell
#!/bin/sh # # Copyright (c) 2007 Shawn Pearce # test_description='test git fast-import utility' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash # Print $1 bytes from stdin to stdout. # # This could be written as "head -c $1", but IRIX "head" does not # support the -c option. head_c () {...
Shell
#!/bin/sh test_description='sparse checkout tests * (tag: removed, master) removed | D sub/added * (HEAD, tag: top) modified and added | M init.t | A sub/added * (tag: init) init A init.t ' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree.sh test_expect_success 'setup' ' cat >expected <<-\EOF && 100644 77f0ba1...
Shell
#!/bin/sh # # Copyright (c) 2009 Marc Branchaud # test_description='git svn multiple branch and tag paths in the svn repo' . ./lib-git-svn.sh test_expect_success 'setup svnrepo' ' mkdir project \ project/trunk \ project/b_one \ project/b_two \ project/tags_A \ project/tags_B && echo 1 > project/trunk/a.fi...
Shell
#!/bin/sh # # Copyright (c) 2011 Ray Chen # test_description='git svn test (option --preserve-empty-dirs) This test uses git to clone a Subversion repository that contains empty directories, and checks that corresponding directories are created in the local Git repository with placeholder files.' . ./lib-git-svn.sh ...
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 # # Copyright (c) 2007 Junio C Hamano # test_description='per path merge controlled by merge attribute' . ./test-lib.sh test_expect_success setup ' for f in text binary union do echo Initial >$f && git add $f || break done && test_tick && git commit -m Initial && git branch side && for f in text...
Shell
#!/bin/sh test_description='test local clone' . ./test-lib.sh repo_is_hardlinked() { find "$1/objects" -type f -links 1 >output && test_line_count = 0 output } test_expect_success 'preparing origin repository' ' : >file && git add . && git commit -m1 && git clone --bare . a.git && git clone --bare . x && 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 test_description='git apply --3way' . ./test-lib.sh create_file () { for i do echo "$i" done } sanitize_conflicted_diff () { sed -e ' /^index /d s/^\(+[<>][<>][<>][<>]*\) .*/\1/ ' } test_expect_success setup ' test_tick && create_file >one 1 2 3 4 5 6 7 && cat one >two && git add one two &...
Shell
#!/bin/sh # # Copyright (c) 2012 Daniel Graña # test_description='Test submodules on detached working tree This test verifies that "git submodule" initialization, update and addition works on detahced working trees ' TEST_NO_CREATE_REPO=1 . ./test-lib.sh test_expect_success 'submodule on detached working tree' ' g...
Shell
#!/bin/sh # # Copyright (c) 2005 Fredrik Kuivinen # test_description='Test merge with directory/file conflicts' . ./test-lib.sh test_expect_success 'prepare repository' ' echo Hello >init && git add init && git commit -m initial && git branch B && mkdir dir && echo foo >dir/foo && git add dir/foo && git comm...
Shell
#!/bin/sh test_description='basic clone 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 'clone -o' ' git clone -o foo parent clone-o && (cd clone-o && git rev-parse --verify refs/rem...
Shell
#!/bin/sh test_description='git rebase --whitespace=fix This test runs git rebase --whitespace=fix and make sure that it works. ' . ./test-lib.sh # prepare initial revision of "file" with a blank line at the end cat >file <<EOF a b c EOF # expected contents in "file" after rebase cat >expect-first <<EOF a b c EOF...
Shell
#!/bin/sh test_description='git p4 label tests' . ./lib-git-p4.sh test_expect_success 'start p4d' ' start_p4d ' # Basic p4 label import tests. # test_expect_success 'basic p4 labels' ' test_when_finished cleanup_git && ( cd "$cli" && mkdir -p main && echo f1 >main/f1 && p4 add main/f1 && p4 submit -d ...
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='typechange rename detection' . ./test-lib.sh test_expect_success SYMLINKS setup ' rm -f foo bar && cat "$TEST_DIRECTORY"/../COPYING >foo && ln -s linklink bar && git add foo bar && git commit -a -m Initial && git tag one && rm -f foo bar && cat "$TEST_DIRECTORY"/../COPYING >bar ...
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='tests for git clone -c key=value' . ./test-lib.sh test_expect_success 'clone -c sets config in cloned repo' ' rm -rf child && git clone -c core.foo=bar . child && echo bar >expect && git --git-dir=child/.git config core.foo >actual && test_cmp expect actual ' test_expect_success 'clo...
Shell
#!/bin/sh test_description='git svn authorship' . ./lib-git-svn.sh test_expect_success 'setup svn repository' ' svn_cmd checkout "$svnrepo" work.svn && ( cd work.svn && echo >file svn_cmd add file svn_cmd commit -m "first commit" file ) ' test_expect_success 'interact with it via git svn' ' mkdir work.gi...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='Merge base and parent list computation. ' . ./test-lib.sh M=1130000000 Z=+0000 GIT_COMMITTER_EMAIL=git@comm.iter.xz GIT_COMMITTER_NAME='C O Mmiter' GIT_AUTHOR_NAME='A U Thor' GIT_AUTHOR_EMAIL=git@au.thor.xz export GIT_COMMITTER_EMAIL GIT_COMMITTER_...
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='test date parsing and printing' . ./test-lib.sh # arbitrary reference time: 2009-08-30 19:20:00 TEST_DATE_NOW=1251660000; export TEST_DATE_NOW check_show() { t=$(($TEST_DATE_NOW - $1)) echo "$t -> $2" >expect test_expect_${3:-success} "relative date ($2)" " test-date show $t >actual &...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git ls-files --others --exclude This test runs git ls-files --others and tests --exclude patterns. ' . ./test-lib.sh rm -fr one three for dir in . one one/two three do mkdir -p $dir && for i in 1 2 3 4 5 6 7 8 do >$dir/a.$i done done >"...
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) 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) 2005 Junio C Hamano # test_description='Test mode change diffs. ' . ./test-lib.sh sed_script='s/\(:100644 100755\) \('"$_x40"'\) \2 /\1 X X /' test_expect_success 'setup' ' echo frotz >rezrov && git update-index --add rezrov && tree=`git write-tree` && echo $tree ' test_expect_succe...
Shell
#!/bin/sh test_description='merge-recursive backend test' . ./test-lib.sh test_expect_success 'setup 1' ' echo hello >a && o0=$(git hash-object a) && cp a b && cp a c && mkdir d && cp a d/e && test_tick && git add a b c d/e && git commit -m initial && c0=$(git rev-parse --verify HEAD) && git branch side...
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 test_description='git svn rmdir' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' mkdir import && ( cd import && mkdir -p deeply/nested/directory/number/1 && mkdir -p deeply/nested/directory/number/2 && echo foo >deeply/nested/directory/number/1/file && echo foo >deeply/nested/directory...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git ls-files test (--others should pick up symlinks). This test runs git ls-files --others with the following on the filesystem. path0 - a file path1 - a symlink path2/file2 - a file in a directory path3-junk - a file to confu...
Shell
#!/bin/sh # # Copyright (c) 2010 Brad King # test_description='git update-index for gitlink to .git file. ' . ./test-lib.sh test_expect_success 'submodule with absolute .git file' ' mkdir sub1 && (cd sub1 && git init && REAL="$(pwd)/.real" && mv .git "$REAL" && echo "gitdir: $REAL" >.git && test_commit f...
Shell
#!/bin/sh test_description='git rebase with its hook(s)' . ./test-lib.sh test_expect_success setup ' echo hello >file && git add file && test_tick && git commit -m initial && echo goodbye >file && git add file && test_tick && git commit -m second && git checkout -b side HEAD^ && echo world >git && git add...
Shell
#!/bin/sh test_description='diff hunk fusing' . ./test-lib.sh f() { echo $1 i=1 while test $i -le $2 do echo $i i=$(expr $i + 1) done echo $3 } t() { case $# in 4) hunks=$4; cmd="diff -U$3";; 5) hunks=$5; cmd="diff -U$3 --inter-hunk-context=$4";; esac label="$cmd, $1 common $2" file=f$1 expected=ex...
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='test conversion filters on large files' . ./test-lib.sh set_attr() { test_when_finished 'rm -f .gitattributes' && echo "* $*" >.gitattributes } check_input() { git read-tree --empty && git add small large && git cat-file blob :small >small.index && git cat-file blob :large | head -n...
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
: sanitize_diff_raw='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]* / X X \1# /' compare_diff_raw () { # When heuristics are improved, the score numbers would change. # Ignore them while comparing. # Also we do not check SHA1 hash generation in this test, which # is a job for t0000-basic.sh sed -e "$s...
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 test_description='read-tree D/F conflict corner cases' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree.sh maketree () { ( rm -f .git/index .git/index.lock && git clean -d -f -f -q -x && name="$1" && shift && for it do path=$(expr "$it" : '\([^:]*\)') && mkdir -p $(dirname "$path") && ...
Shell
#!/bin/sh test_description='git svn fetch deleted tag 2' . ./lib-git-svn.sh test_expect_success 'setup svn repo' ' mkdir -p import/branches && mkdir -p import/tags && mkdir -p import/trunk/subdir1 && mkdir -p import/trunk/subdir2 && mkdir -p import/trunk/subdir3 && echo "file1" >import/trunk/subdir1/file && e...
Shell
#!/bin/sh if test -z "$GIT_TEST_GIT_DAEMON" then skip_all="git-daemon testing disabled (define GIT_TEST_GIT_DAEMON to enable)" test_done fi LIB_GIT_DAEMON_PORT=${LIB_GIT_DAEMON_PORT-'8121'} GIT_DAEMON_PID= GIT_DAEMON_DOCUMENT_ROOT_PATH="$PWD"/repo GIT_DAEMON_URL=git://127.0.0.1:$LIB_GIT_DAEMON_PORT start_git_daem...
Shell
#!/bin/sh test_description='combined and merge diff handle binary files and textconv' . ./test-lib.sh test_expect_success 'setup binary merge conflict' ' echo oneQ1 | q_to_nul >binary && git add binary && git commit -m one && echo twoQ2 | q_to_nul >binary && git commit -a -m two && git checkout -b branch-binary...
Shell
#!/bin/sh # Copyright (c) 2006 Eric Wong test_description='git svn metadata migrations from previous versions' . ./lib-git-svn.sh test_expect_success 'setup old-looking metadata' ' cp "$GIT_DIR"/config "$GIT_DIR"/config-old-git-svn && mkdir import && ( cd import && for i in trunk branches/a branches/b tags/0.1 ...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git apply with rejects ' . ./test-lib.sh test_expect_success setup ' for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 do echo $i done >file1 && cat file1 >saved.file1 && git update-index --add file1 && git commit -m initial &&...
Shell
#!/bin/sh test_description='test config file include directives' . ./test-lib.sh test_expect_success 'include file by absolute path' ' echo "[test]one = 1" >one && echo "[include]path = \"$(pwd)/one\"" >.gitconfig && echo 1 >expect && git config test.one >actual && test_cmp expect actual ' test_expect_success '...
Shell
#!/bin/sh # # Copyright (c) 2008 Matthew Ogilvie # Parts adapted from other tests. # test_description='git-cvsserver -kb modes tests -kb mode for binary files when accessing a git repository using cvs CLI client via git-cvsserver server' . ./test-lib.sh marked_as () { foundEntry="$(grep "^/$2/" "$1/CVS/Entries"...
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 test_description='Various filesystem issues' . ./test-lib.sh auml=$(printf '\303\244') aumlcdiar=$(printf '\141\314\210') if test_have_prereq CASE_INSENSITIVE_FS then say "will test on a case insensitive filesystem" test_case=test_expect_failure else test_case=test_expect_success fi if test_have_prere...
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 test_description='git update-index --assume-unchanged test. ' . ./test-lib.sh test_expect_success 'setup' \ ': >file && git add file && git commit -m initial && git branch other && echo upstream >file && git add file && git commit -m upstream' test_expect_success 'do not switch branches with ...
Shell
#!/bin/sh # # Copyright (c) 2006 Josh England # test_description='Test the post-checkout hook.' . ./test-lib.sh test_expect_success setup ' echo Data for commit0. >a && echo Data for commit0. >b && git update-index --add a && git update-index --add b && tree0=$(git write-tree) && commit0=$(echo setup | git comm...
Shell
#!/bin/sh # Try a set of credential helpers; the expected stdin, # stdout and stderr should be provided on stdin, # separated by "--". check() { credential_opts= credential_cmd=$1 shift for arg in "$@"; do credential_opts="$credential_opts -c credential.helper='$arg'" done read_chunk >stdin && read_chunk >exp...
Shell
#!/bin/sh test_description='basic credential helper tests' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-credential.sh test_expect_success 'setup helper scripts' ' cat >dump <<-\EOF && whoami=`echo $0 | sed s/.*git-credential-//` echo >&2 "$whoami: $*" OIFS=$IFS IFS== while read key value; do echo >&2 "$whoami: $ke...
Shell
#!/bin/sh # # Copyright (c) 2009 Vitaly Shukela # Copyright (c) 2009 Eric Wong # test_description='git svn property tests' . ./lib-git-svn.sh test_expect_success 'setup test repository' ' svn_cmd co "$svnrepo" s && ( cd s && mkdir qqq www && echo test_qqq > qqq/test_qqq.txt && echo test_www > www/test_www.t...
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='diff.*.textconv tests' . ./test-lib.sh find_diff() { sed '1,/^index /d' | sed '/^-- $/,$d' } cat >expect.binary <<'EOF' Binary files a/file and b/file differ EOF cat >expect.text <<'EOF' --- a/file +++ b/file @@ -1 +1,2 @@ 0 +1 EOF cat >hexdump <<'EOF' #!/bin/sh "$PERL_PATH" -e '$/ = ...
Shell
#!/bin/sh # # Copyright (c) 2008 Nguyễn Thái Ngọc Duy # test_description='test worktree writing operations when skip-worktree is used' . ./test-lib.sh test_expect_success 'setup' ' test_commit init && echo modified >> init.t && touch added && git add init.t added && git commit -m "modified and added" && git ta...
Shell
#!/bin/sh # # Copyright (c) 2007 Carlos Rica # test_description='git reset Documented tests for git reset' . ./test-lib.sh test_expect_success 'creating initial files and commits' ' test_tick && echo "1st file" >first && git add first && git commit -m "create 1st file" && echo "2nd file" >second && git add s...
Shell
#!/bin/sh test_description='signed commit 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 -S -m initial && git tag initial && git branch side && echo 2 >file && test_tick && git commit -a -S -m second...
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='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 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. Also make sure that command line parser understands the normal "flags first and then non ...
Shell
#!/bin/sh # # Copyright (c) 2006 Junio C Hamano # test_description='quoted output' . ./test-lib.sh FN='濱野' GN='純' HT=' ' DQ='"' echo foo 2>/dev/null > "Name and an${HT}HT" if ! test -f "Name and an${HT}HT" then # FAT/NTFS does not allow tabs in filenames skip_all='Your filesystem does not allow tabs in filenames'...
Shell
#!/bin/sh test_description="Test whether cache-tree is properly updated Tests whether various commands properly update and/or rewrite the cache-tree extension. " . ./test-lib.sh cmp_cache_tree () { test-dump-cache-tree >actual && sed "s/$_x40/SHA/" <actual >filtered && test_cmp "$1" filtered } # We don't bother...
Shell
#!/bin/sh test_description='Test notes trees that also contain non-notes' . ./test-lib.sh number_of_commits=100 start_note_commit () { test_tick && cat <<INPUT_END commit refs/notes/commits committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE data <<COMMIT notes COMMIT from refs/notes/commits...
Shell
#!/bin/sh test_description='git remote group handling' . ./test-lib.sh mark() { echo "$1" >mark } update_repo() { (cd $1 && echo content >>file && git add file && git commit -F ../mark) } update_repos() { update_repo one $1 && update_repo two $1 } repo_fetched() { if test "`git log -1 --pretty=format:%s $1...
Shell
#!/bin/sh # # Copyright (c) 2009, Junio C Hamano # test_description='log family learns --stdin' . ./test-lib.sh check () { for cmd in rev-list "log --stat" do for i in "$@" do printf "%s\n" $i done >input && test_expect_success "check $cmd $*" ' git $cmd $(cat input) >expect && git $cmd --stdin <i...
Shell
#!/bin/sh test_description='checkout $tree -- $paths' . ./test-lib.sh test_expect_success setup ' mkdir dir && >dir/master && echo common >dir/common && git add dir/master dir/common && test_tick && git commit -m "master has dir/master" && git checkout -b next && git mv dir/master dir/next0 && echo next >dir/...
Shell
#!/bin/sh test_description='test fetching of oddly-named refs' . ./test-lib.sh # afterwards we will have: # HEAD - two # refs/for/refs/heads/master - one # refs/heads/master - three test_expect_success 'setup repo with odd suffix ref' ' echo content >file && git add . && git commit -m one && git update-ref ref...
Shell
#!/bin/sh test_description='cd_to_toplevel' . ./test-lib.sh test_cd_to_toplevel () { test_expect_success $3 "$2" ' ( cd '"'$1'"' && . "$(git --exec-path)"/git-sh-setup && cd_to_toplevel && [ "$(pwd -P)" = "$TOPLEVEL" ] ) ' } TOPLEVEL="$(pwd -P)/repo" mkdir -p repo/sub/dir mv .git repo/ SUBDIRECTOR...
Shell
#!/bin/sh test_description='diff -r -t shows directory additions and deletions' . ./test-lib.sh test_expect_success setup ' mkdir dc dr dt && >dc/1 && >dr/2 && >dt/3 && >fc && >fr && >ft && git add . && test_tick && git commit -m initial && rm -fr dt dr ft fr && mkdir da ft && for p in dc/1 da/4 dt ft/...
Shell
#!/bin/sh test_description='test dumb fetching over http via static file' . ./test-lib.sh if test -n "$NO_CURL"; then skip_all='skipping test, git built without http support' test_done fi LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5550'} . "$TEST_DIRECTORY"/lib-httpd.sh start_httpd test_expect_success 'setup repository' ' ...
Shell
#!/bin/sh # Copyright (c) 2006, Junio C Hamano. test_description='Per branch config variables affects "git fetch". ' . ./test-lib.sh D=`pwd` test_bundle_object_count () { git verify-pack -v "$1" >verify.out && test "$2" = $(grep '^[0-9a-f]\{40\} ' verify.out | wc -l) } convert_bundle_to_pack () { while read x ...
Shell
#!/bin/sh # # Copyright (c) 2007 Johannes E Schindelin # test_description='Test git stash' . ./test-lib.sh test_expect_success 'stash some dirty working directory' ' echo 1 > file && git add file && test_tick && git commit -m initial && echo 2 > file && git add file && echo 3 > file && test_tick && git stas...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='git apply symlinks and partial files ' . ./test-lib.sh test_expect_success SYMLINKS setup ' ln -s path1/path2/path3/path4/path5 link1 && git add link? && git commit -m initial && git branch side && rm -f link? && ln -s htap6 link1 && git...
Shell
#!/bin/sh # # Copyright (c) 2007 Eric Wong # test_description='git svn init/clone tests' . ./lib-git-svn.sh # setup, run inside tmp so we don't have any conflicts with $svnrepo set -e rm -r .git mkdir tmp cd tmp test_expect_success 'setup svnrepo' ' mkdir project project/trunk project/branches project/tags && ech...
Shell
#!/bin/sh test_description='test globbing (and noglob) of pathspec limiting' . ./test-lib.sh test_expect_success 'create commits with glob characters' ' test_commit unrelated bar && test_commit vanilla foo && # insert file "f*" in the commit, but in a way that avoids # the name "f*" in the worktree, because it is...
Shell
#!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='Same rename detection as t4003 but testing diff-raw. ' . ./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 fr...
Shell
#!/bin/sh test_description='git p4 relative chdir' . ./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" ) ' # P4 reads from P4CONFIG file to find its server params, if the # environm...
Shell
#!/bin/sh test_description='rev-list/rev-parse --glob' . ./test-lib.sh commit () { test_tick && echo $1 > foo && git add foo && git commit -m "$1" } compare () { # Split arguments on whitespace. git $1 $2 >expected && git $1 $3 >actual && test_cmp expected actual } test_expect_success 'setup' ' commit ma...
Shell
#!/bin/sh test_description='difference in submodules' . ./test-lib.sh . "$TEST_DIRECTORY"/diff-lib.sh test_expect_success setup ' test_tick && test_create_repo sub && ( cd sub && echo hello >world && git add world && git commit -m submodule ) && test_tick && echo frotz >nitfol && git add nitfol sub &...
Shell
#!/bin/sh test_description='git blame encoding conversion' . ./test-lib.sh . "$TEST_DIRECTORY"/t8005/utf8.txt . "$TEST_DIRECTORY"/t8005/euc-japan.txt . "$TEST_DIRECTORY"/t8005/sjis.txt test_expect_success 'setup the repository' ' # Create the file echo "UTF-8 LINE" > file && git add file && git commit --author "...
Shell