Skip to content

Commit ded2444

Browse files
tboegigitster
authored andcommitted
t0027: make commit_chk_wrnNNO() reliable
When the content of a commited file is unchanged and the attributes are changed, Git may not detect that the next commit must treat the file as changed. This happens when lstat() doesn't detect a change, since neither inode, mtime nor size are changed. Add a single "Z" character to change the file size and content. When the files are compared later in checkout_files(), the "Z" is removed before the comparison. Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 90f7b16 commit ded2444

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

t/t0027-auto-crlf.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fi
1212

1313
compare_files () {
1414
tr '\015\000' QN <"$1" >"$1".expect &&
15-
tr '\015\000' QN <"$2" >"$2".actual &&
15+
tr '\015\000' QN <"$2" | tr -d 'Z' >"$2".actual &&
1616
test_cmp "$1".expect "$2".actual &&
1717
rm "$1".expect "$2".actual
1818
}
@@ -114,6 +114,7 @@ commit_chk_wrnNNO () {
114114
do
115115
fname=${pfx}_$f.txt &&
116116
cp $f $fname &&
117+
printf Z >>"$fname" &&
117118
git -c core.autocrlf=$crlf add $fname 2>/dev/null &&
118119
git -c core.autocrlf=$crlf commit -m "commit_$fname" $fname >"${pfx}_$f.err" 2>&1
119120
done

0 commit comments

Comments
 (0)