Re: [PATCH v8 07/10] convert: unify the "auto" handling of CRLF
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Nov 25, 2016, 15:48 UTC
- Message-ID
- <5502e894-bb22-e8b9-ab7a-49346d238283@web.de>
- In-Reply-To
- <1461942123-16179-1-git-send-email-tboegi@web.de>
RFH, the normalization as descrived in Documentation/gitattributes.txt does not work anymore:
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 $ git status # Show files that will be normalized $ git add -u $ git add .gitattributes $ git commit -m "Introduce end-of-line normalization" -------------------------------------------------
I have different ideas, how a a normalizatio can be done:
A) ------------------------------------------------- $ echo "* text=auto" >.gitattributes $ rm .git/index $ git add . $ git status # Show files that will be normalized $ git commit -m "Introduce end-of-line normalization" -------------------------------------------------
B) $ echo "* text=auto" >.gitattributes && $ git add .gitattributes && $ git ls-files --eol | egrep '^i/(crlf|mixed).*attr/(text|auto)' | ( TAB=$(printf "\t") ; sed -e "s/.*$TAB/dos2unix /" ) >/tmp/$$ && $ /bin/sh /tmp/$$ && $ rm -f /tmp/$$ && $ git add -u && $ git commit -m "Introduce end-of-line normalization"
C) Teach "git add" to learn --renormalize and then ------------------------------------------------- $ echo "* text=auto" >.gitattributes $ git add -u --renormalize $ git add .gitattributes $ git commit -m "Introduce end-of-line normalization" -------------------------------------------------
(None of them is really tested)
A) may loose the execute bit B) dos2unix is not installed everywhere (like Mac OS) C) seems to most attractive, but I couldn't find out how to forward options from "git add" into convert.c
Any help is appreciated.