diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-11-23 13:28:53 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-11-23 13:28:53 -0800 |
commit | 3686aa1caf907d22fe318c28efe93f0e7870ba50 (patch) | |
tree | f99a303bd14c7343be7ccc5b9df5382f1bf79246 /t/t1020-subdirectory.sh | |
parent | aa2577a9c3bd5559bd580feca6edec4d70254adc (diff) | |
parent | 1e501a7c47ad5ada53d3b1acfb9f131f76e969ec (diff) | |
download | git-3686aa1caf907d22fe318c28efe93f0e7870ba50.tar.gz |
Merge branch 'maint' into tj/imap-send-remove-unusedtj/maint-imap-send-remove-unused
* maint: (18123 commits)
documentation fix: git difftool uses diff tools, not merge tools.
Git 1.7.7.4
Makefile: add missing header file dependencies
notes merge: eliminate OUTPUT macro
mailmap: xcalloc mailmap_info
name-rev --all: do not even attempt to describe non-commit object
Git 1.7.7.3
docs: Update install-doc-quick
docs: don't mention --quiet or --exit-code in git-log(1)
Git 1.7.7.2
t7511: avoid use of reserved filename on Windows.
clone: Quote user supplied path in a single quote pair
read-cache.c: fix index memory allocation
make the sample pre-commit hook script reject names with newlines, too
Reindent closing bracket using tab instead of spaces
Git 1.7.7.1
RelNotes/1.7.7.1: setgid bit patch is about fixing "git init" via Makefile setting
gitweb: fix regression when filtering out forks
Almost ready for 1.7.7.1
pack-objects: don't traverse objects unnecessarily
...
Conflicts:
imap-send.c
Diffstat (limited to 't/t1020-subdirectory.sh')
-rwxr-xr-x | t/t1020-subdirectory.sh | 192 |
1 files changed, 192 insertions, 0 deletions
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh new file mode 100755 index 0000000000..3b1b985996 --- /dev/null +++ b/t/t1020-subdirectory.sh @@ -0,0 +1,192 @@ +#!/bin/sh +# +# Copyright (c) 2006 Junio C Hamano +# + +test_description='Try various core-level commands in subdirectory. +' + +. ./test-lib.sh +. "$TEST_DIRECTORY"/lib-read-tree.sh + +test_expect_success setup ' + long="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" && + for c in $long; do echo $c; done >one && + mkdir dir && + for c in x y z $long a b c; do echo $c; done >dir/two && + cp one original.one && + cp dir/two original.two +' + +test_expect_success 'update-index and ls-files' ' + git update-index --add one && + case "`git ls-files`" in + one) echo pass one ;; + *) echo bad one; exit 1 ;; + esac && + ( + cd dir && + git update-index --add two && + case "`git ls-files`" in + two) echo pass two ;; + *) echo bad two; exit 1 ;; + esac + ) && + case "`git ls-files`" in + dir/two"$LF"one) echo pass both ;; + *) echo bad; exit 1 ;; + esac +' + +test_expect_success 'cat-file' ' + two=`git ls-files -s dir/two` && + two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` && + echo "$two" && + git cat-file -p "$two" >actual && + cmp dir/two actual && + ( + cd dir && + git cat-file -p "$two" >actual && + cmp two actual + ) +' +rm -f actual dir/actual + +test_expect_success 'diff-files' ' + echo a >>one && + echo d >>dir/two && + case "`git diff-files --name-only`" in + dir/two"$LF"one) echo pass top ;; + *) echo bad top; exit 1 ;; + esac && + # diff should not omit leading paths + ( + cd dir && + case "`git diff-files --name-only`" in + dir/two"$LF"one) echo pass subdir ;; + *) echo bad subdir; exit 1 ;; + esac && + case "`git diff-files --name-only .`" in + dir/two) echo pass subdir limited ;; + *) echo bad subdir limited; exit 1 ;; + esac + ) +' + +test_expect_success 'write-tree' ' + top=`git write-tree` && + echo $top && + ( + cd dir && + sub=`git write-tree` && + echo $sub && + test "z$top" = "z$sub" + ) +' + +test_expect_success 'checkout-index' ' + git checkout-index -f -u one && + cmp one original.one && + ( + cd dir && + git checkout-index -f -u two && + cmp two ../original.two + ) +' + +test_expect_success 'read-tree' ' + rm -f one dir/two && + tree=`git write-tree` && + read_tree_u_must_succeed --reset -u "$tree" && + cmp one original.one && + cmp dir/two original.two && + ( + cd dir && + rm -f two && + read_tree_u_must_succeed --reset -u "$tree" && + cmp two ../original.two && + cmp ../one ../original.one + ) +' + +test_expect_success 'alias expansion' ' + ( + git config alias.ss status && + cd dir && + git status && + git ss + ) +' + +test_expect_success '!alias expansion' ' + pwd >expect && + ( + git config alias.test !pwd && + cd dir && + git test >../actual + ) && + test_cmp expect actual +' + +test_expect_success 'GIT_PREFIX for !alias' ' + printf "dir/" >expect && + ( + git config alias.test "!sh -c \"printf \$GIT_PREFIX\"" && + cd dir && + git test >../actual + ) && + test_cmp expect actual +' + +test_expect_success 'GIT_PREFIX for built-ins' ' + # Use GIT_EXTERNAL_DIFF to test that the "diff" built-in + # receives the GIT_PREFIX variable. + printf "dir/" >expect && + printf "#!/bin/sh\n" >diff && + printf "printf \"\$GIT_PREFIX\"" >>diff && + chmod +x diff && + ( + cd dir && + printf "change" >two && + env GIT_EXTERNAL_DIFF=./diff git diff >../actual + git checkout -- two + ) && + test_cmp expect actual +' + +test_expect_success 'no file/rev ambiguity check inside .git' ' + git commit -a -m 1 && + ( + cd .git && + git show -s HEAD + ) +' + +test_expect_success 'no file/rev ambiguity check inside a bare repo' ' + git clone -s --bare .git foo.git && + ( + cd foo.git && + GIT_DIR=. git show -s HEAD + ) +' + +# This still does not work as it should... +: test_expect_success 'no file/rev ambiguity check inside a bare repo' ' + git clone -s --bare .git foo.git && + ( + cd foo.git && + git show -s HEAD + ) +' + +test_expect_success SYMLINKS 'detection should not be fooled by a symlink' ' + rm -fr foo.git && + git clone -s .git another && + ln -s another yetanother && + ( + cd yetanother/.git && + git show -s HEAD + ) +' + +test_done |