summaryrefslogtreecommitdiff
path: root/t/t7001-mv.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2008-02-20 16:13:16 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-02-20 16:13:16 -0800
commit9e7bd0110b41f9bb16377e322300629f8c4d6c12 (patch)
treedaf39390f7fcc9436ad3c8e9565ac9092f36ab9d /t/t7001-mv.sh
parentMerge branch 'maint' (diff)
parentbuiltin-mv: minimum fix to avoid losing files (diff)
downloadtgif-9e7bd0110b41f9bb16377e322300629f8c4d6c12.tar.xz
Merge branch 'jc/setup'
* jc/setup: builtin-mv: minimum fix to avoid losing files git-add: adjust to the get_pathspec() changes. Make blame accept absolute paths setup: sanitize absolute and funny paths in get_pathspec()
Diffstat (limited to 't/t7001-mv.sh')
-rwxr-xr-xt/t7001-mv.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b1243b4163..fa382c58da 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -118,4 +118,42 @@ test_expect_success "Sergey Vlasov's test case" '
git mv ab a
'
+test_expect_success 'absolute pathname' '(
+
+ rm -fr mine &&
+ mkdir mine &&
+ cd mine &&
+ test_create_repo one &&
+ cd one &&
+ mkdir sub &&
+ >sub/file &&
+ git add sub/file &&
+
+ git mv sub "$(pwd)/in" &&
+ ! test -d sub &&
+ test -d in &&
+ git ls-files --error-unmatch in/file
+
+
+)'
+
+test_expect_success 'absolute pathname outside should fail' '(
+
+ rm -fr mine &&
+ mkdir mine &&
+ cd mine &&
+ out=$(pwd) &&
+ test_create_repo one &&
+ cd one &&
+ mkdir sub &&
+ >sub/file &&
+ git add sub/file &&
+
+ ! git mv sub "$out/out" &&
+ test -d sub &&
+ ! test -d ../in &&
+ git ls-files --error-unmatch sub/file
+
+)'
+
test_done