Skip to content

Commit

Permalink
Merge branch 'tb/doc-eol-normalization'
Browse files Browse the repository at this point in the history
Doc update.

* tb/doc-eol-normalization:
  gitattributes.txt: document how to normalize the line endings
  • Loading branch information
gitster committed Apr 24, 2017
2 parents 6b51cb6 + 8599974 commit 848d9a9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Documentation/gitattributes.txt
Expand Up @@ -229,11 +229,9 @@ From a clean working directory:

-------------------------------------------------
$ echo "* text=auto" >.gitattributes
$ rm .git/index # Remove the index to force Git to
$ git reset # re-scan the working directory
$ rm .git/index # Remove the index to re-scan the working directory
$ git add .
$ git status # Show files that will be normalized
$ git add -u
$ git add .gitattributes
$ git commit -m "Introduce end-of-line normalization"
-------------------------------------------------

Expand Down
26 changes: 26 additions & 0 deletions t/t0025-crlf-auto.sh
Expand Up @@ -152,4 +152,30 @@ test_expect_success 'eol=crlf _does_ normalize binary files' '
test -z "$LFwithNULdiff"
'

test_expect_success 'prepare unnormalized' '
> .gitattributes &&
git config core.autocrlf false &&
printf "LINEONE\nLINETWO\r\n" >mixed &&
git add mixed .gitattributes &&
git commit -m "Add mixed" &&
git ls-files --eol | egrep "i/crlf" &&
git ls-files --eol | egrep "i/mixed"
'

test_expect_success 'normalize unnormalized' '
echo "* text=auto" >.gitattributes &&
rm .git/index &&
git add . &&
git commit -m "Introduce end-of-line normalization" &&
git ls-files --eol | tr "\\t" " " | sort >act &&
cat >exp <<EOF &&
i/-text w/-text attr/text=auto LFwithNUL
i/lf w/crlf attr/text=auto CRLFonly
i/lf w/crlf attr/text=auto LFonly
i/lf w/lf attr/text=auto .gitattributes
i/lf w/mixed attr/text=auto mixed
EOF
test_cmp exp act
'

test_done

0 comments on commit 848d9a9

Please sign in to comment.