File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed
Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -229,11 +229,9 @@ From a clean working directory:
229229
230230-------------------------------------------------
231231$ echo "* text=auto" >.gitattributes
232- $ rm .git/index # Remove the index to force Git to
233- $ git reset # re-scan the working directory
232+ $ rm .git/index # Remove the index to re-scan the working directory
233+ $ git add .
234234$ git status # Show files that will be normalized
235- $ git add -u
236- $ git add .gitattributes
237235$ git commit -m "Introduce end-of-line normalization"
238236-------------------------------------------------
239237
Original file line number Diff line number Diff line change @@ -152,4 +152,30 @@ test_expect_success 'eol=crlf _does_ normalize binary files' '
152152 test -z "$LFwithNULdiff"
153153'
154154
155+ test_expect_success ' prepare unnormalized' '
156+ > .gitattributes &&
157+ git config core.autocrlf false &&
158+ printf "LINEONE\nLINETWO\r\n" >mixed &&
159+ git add mixed .gitattributes &&
160+ git commit -m "Add mixed" &&
161+ git ls-files --eol | egrep "i/crlf" &&
162+ git ls-files --eol | egrep "i/mixed"
163+ '
164+
165+ test_expect_success ' normalize unnormalized' '
166+ echo "* text=auto" >.gitattributes &&
167+ rm .git/index &&
168+ git add . &&
169+ git commit -m "Introduce end-of-line normalization" &&
170+ git ls-files --eol | tr "\\t" " " | sort >act &&
171+ cat >exp <<EOF &&
172+ i/-text w/-text attr/text=auto LFwithNUL
173+ i/lf w/crlf attr/text=auto CRLFonly
174+ i/lf w/crlf attr/text=auto LFonly
175+ i/lf w/lf attr/text=auto .gitattributes
176+ i/lf w/mixed attr/text=auto mixed
177+ EOF
178+ test_cmp exp act
179+ '
180+
155181test_done
You can’t perform that action at this time.
0 commit comments