. , (Visual Studio) Unicode BOM , . Perforce Unicode , Unicode Perforce. git p4 submit :
error: patch failed: path/to/file.csproj:1
error: path/to/file.csproj: patch does not apply
~/.gitconfig:
[filter "utf8-autobom"]
clean = sed -b -e '1!b' -e 's/^\\xEF\\xBB\\xBF//'
smudge = sed -b -e '1!b' -e 's/\\(^\\|^\\xEF\\xBB\\xBF\\)/\\xEF\\xBB\\xBF/'
utf8-autobom , .gitattributes:
*.csproj filter=utf8-autobom
Git :
rm .git/index
git reset
Git Perforce, :
git add .
git commit --amend
git p4 submit
sed, "abc" :
# Remove 'abc' from beginning of file, if present
sed -b -e '1!b' -e 's/^abc//'
# Add 'abc' to beginning of file, if not present
sed -b -e '1!b' -e 's/\(^\|^abc\)/abc/'
UTF-8 EF BB BF "abc".
, clean , smudge. , , Git Perforce.
( clean smudge . gitattributes)
, :
error: patch failed: path/to/file.csproj:1
error: path/to/file.csproj: patch does not apply
, 1, 1 .
, , git diff p4/master HEAD. , <U+FEFF> . , , Notepad ++, Git. Perforce. Notepad ++ "UTF-8-BOM" Git "UTF-8" Perforce. ( Linux Cygwin: file <path-to-file>, .)
Googling "UTF-8-BOM" .
Git .
smudge, . Git (, git checkout). smudge :
[filter "utf8-autobom"]
clean = sed -b -e '1!b' -e 's/^\\xEF\\xBB\\xBF//'