summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-06-27 09:56:49 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-06-27 09:56:49 -0700
commitc49fd57bf472143b1a0bbfb246c91e6ea0f06887 (patch)
treef2d6588d8302f18d43beb1e4f285f034e3c38513 /t
parentMerge branch 'jk/avoid-unbounded-alloca' (diff)
parentadd: add --chmod=+x / --chmod=-x options (diff)
downloadtgif-c49fd57bf472143b1a0bbfb246c91e6ea0f06887.tar.xz
Merge branch 'et/add-chmod-x'
"git update-index --add --chmod=+x file" may be usable as an escape hatch, but not a friendly thing to force for people who do need to use it regularly. "git add --chmod=+x file" can be used instead. * et/add-chmod-x: add: add --chmod=+x / --chmod=-x options
Diffstat (limited to 't')
-rwxr-xr-xt/t3700-add.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index f14a665356..4865304ebb 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -332,4 +332,34 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file out
test_i18ncmp expect.err actual.err
'
+test_expect_success 'git add --chmod=+x stages a non-executable file with +x' '
+ echo foo >foo1 &&
+ git add --chmod=+x foo1 &&
+ case "$(git ls-files --stage foo1)" in
+ 100755" "*foo1) echo pass;;
+ *) echo fail; git ls-files --stage foo1; (exit 1);;
+ esac
+'
+
+test_expect_success 'git add --chmod=-x stages an executable file with -x' '
+ echo foo >xfoo1 &&
+ chmod 755 xfoo1 &&
+ git add --chmod=-x xfoo1 &&
+ case "$(git ls-files --stage xfoo1)" in
+ 100644" "*xfoo1) echo pass;;
+ *) echo fail; git ls-files --stage xfoo1; (exit 1);;
+ esac
+'
+
+test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '
+ git config core.filemode 1 &&
+ git config core.symlinks 1 &&
+ echo foo >foo2 &&
+ git add --chmod=+x foo2 &&
+ case "$(git ls-files --stage foo2)" in
+ 100755" "*foo2) echo pass;;
+ *) echo fail; git ls-files --stage foo2; (exit 1);;
+ esac
+'
+
test_done