Fix testcase failure when extended attributes are in use
06cbe855 (Make core.sharedRepository more generic, 2008-04-16) made several testcases in t1301-shared-repo.sh which fail if on a system which creates files with extended attributes (e.g. SELinux), since ls appends a '+' sign to the permission set in such cases. In fact, POSIX.1 allows ls to add a single printable character after the usual 3x3 permission bits to show that an optional alternate/additional access method is associated with the path. This fixes the testcase to strip any such sign prior to verifying the permission set. Signed-off-by: Junio C Hamano <gitster@pobox.com> Tested-by: Deskin Miller <deskinm@umich.edu>
Junio C Hamano committed
Oct 19, 2008 at 22:51 UTC
5610e3b0315d652d6b8e6535afe0e7e461c8a0a0
1 file changed
+6
-4
t/t1301-shared-repo.sh
+6
-4
@@ -20,6 +20,10 @@ test_expect_success 'shared = 0400 (faulty permission u-w)' '
20
test $ret != "0"
21
'
22
23
+modebits () {
24
+ ls -l "$1" | sed -e 's|^\(..........\).*|\1|'
25
+}
26
+
27
for u in 002 022
28
do
29
test_expect_success "shared=1 does not clear bits preset by umask $u" '
@@ -85,8 +89,7 @@ do
89
90
rm -f .git/info/refs &&
91
git update-server-info &&
88
- actual="$(ls -l .git/info/refs)" &&
89
- actual=${actual%% *} &&
92
+ actual="$(modebits .git/info/refs)" &&
93
test "x$actual" = "x-$y" || {
94
ls -lt .git/info
95
false
@@ -98,8 +101,7 @@ do
101
102
rm -f .git/info/refs &&
103
git update-server-info &&
101
- actual="$(ls -l .git/info/refs)" &&
102
- actual=${actual%% *} &&
104
+ actual="$(modebits .git/info/refs)" &&
105
test "x$actual" = "x-$x" || {
106
ls -lt .git/info
107
false