summaryrefslogtreecommitdiff
path: root/t/t1010-mktree.sh
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-11-05 06:33:55 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-11-05 06:33:55 -0800
commit189627cd588c2937de7b655595b8ed777f445c85 (patch)
treea705e86785a06f293aa255a0263ddc25ca1ba202 /t/t1010-mktree.sh
downloadgit-189627cd588c2937de7b655595b8ed777f445c85.tar.gz
git-189627cd588c2937de7b655595b8ed777f445c85.tar.bz2
git-189627cd588c2937de7b655595b8ed777f445c85.zip
Imported Upstream version 1.7.10.4upstream/1.7.10.4
Diffstat (limited to 't/t1010-mktree.sh')
-rwxr-xr-xt/t1010-mktree.sh69
1 files changed, 69 insertions, 0 deletions
diff --git a/t/t1010-mktree.sh b/t/t1010-mktree.sh
new file mode 100755
index 00000000..b946f876
--- /dev/null
+++ b/t/t1010-mktree.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+test_description='git mktree'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ for d in a a. a0
+ do
+ mkdir "$d" && echo "$d/one" >"$d/one" &&
+ git add "$d"
+ done &&
+ echo zero >one &&
+ git update-index --add --info-only one &&
+ git write-tree --missing-ok >tree.missing &&
+ git ls-tree $(cat tree.missing) >top.missing &&
+ git ls-tree -r $(cat tree.missing) >all.missing &&
+ echo one >one &&
+ git add one &&
+ git write-tree >tree &&
+ git ls-tree $(cat tree) >top &&
+ git ls-tree -r $(cat tree) >all &&
+ test_tick &&
+ git commit -q -m one &&
+ H=$(git rev-parse HEAD) &&
+ git update-index --add --cacheinfo 160000 $H sub &&
+ test_tick &&
+ git commit -q -m two &&
+ git rev-parse HEAD^{tree} >tree.withsub &&
+ git ls-tree HEAD >top.withsub &&
+ git ls-tree -r HEAD >all.withsub
+'
+
+test_expect_success 'ls-tree piped to mktree (1)' '
+ git mktree <top >actual &&
+ test_cmp tree actual
+'
+
+test_expect_success 'ls-tree piped to mktree (2)' '
+ git mktree <top.withsub >actual &&
+ test_cmp tree.withsub actual
+'
+
+test_expect_success 'ls-tree output in wrong order given to mktree (1)' '
+ perl -e "print reverse <>" <top |
+ git mktree >actual &&
+ test_cmp tree actual
+'
+
+test_expect_success 'ls-tree output in wrong order given to mktree (2)' '
+ perl -e "print reverse <>" <top.withsub |
+ git mktree >actual &&
+ test_cmp tree.withsub actual
+'
+
+test_expect_success 'allow missing object with --missing' '
+ git mktree --missing <top.missing >actual &&
+ test_cmp tree.missing actual
+'
+
+test_expect_success 'mktree refuses to read ls-tree -r output (1)' '
+ test_must_fail git mktree <all >actual
+'
+
+test_expect_success 'mktree refuses to read ls-tree -r output (2)' '
+ test_must_fail git mktree <all.withsub >actual
+'
+
+test_done