From 3bebec22f7618749a1560e76d55949cb18fc70e0 Mon Sep 17 00:00:00 2001 From: Oleg Semyonov Date: Fri, 5 Apr 2013 23:43:58 +0300 Subject: [PATCH] OP-772: Enforce line ending agreements (git 1.7.2+ required for this to work) This is a part of OP-726, OP-727 tasks to normalize source code. Use the following to normalise your local repository to be able to merge: git rm --cached -r . git diff --cached --name-only -z | xargs -0 git add git commit -m "Normalise line endings" git ls-files -z | xargs -0 rm git checkout . --- .gitattributes | 31 +++++++++++++++++++++++++++++++ flight/.gitattributes | 17 +++++++++++++++++ ground/.gitattributes | 17 +++++++++++++++++ make/.gitattributes | 10 ++++++++++ matlab/.gitattributes | 6 ++++++ package/.gitattributes | 5 +++++ shared/.gitattributes | 5 +++++ 7 files changed, 91 insertions(+) create mode 100644 .gitattributes create mode 100644 flight/.gitattributes create mode 100644 ground/.gitattributes create mode 100644 make/.gitattributes create mode 100644 matlab/.gitattributes create mode 100644 package/.gitattributes create mode 100644 shared/.gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..260bbe52b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,31 @@ +# +# Line endings normalization: http://wiki.openpilot.org/display/Doc/Coding+Style +# You need at least git 1.7.2 for this to work (previous versions ignore text and eol attributes). +# +# Make sure you have committed all local changes first. Then use the following bash commands +# to normalize your local repository to be able to merge it with a mainline: +# +# Minimal normalization: +# git rm --cached -r . +# git reset --hard +# git add . +# git commit -m "Normalize line endings" +# +# Or full normalization (don't do that on Windows, it breaks file modes): +# git rm --cached -r . +# git diff --cached --name-only -z | xargs -0 git add +# git commit -m "Normalize line endings" +# git ls-files -z | xargs -0 rm +# git checkout . +# + +# Set default behaviour (do not convert line endings regardless of local git core settings) +* -text + +# All *.txt files in the root should be Windows-readable (CRLF) +/*.txt text eol=crlf + +# Root Makefile has LF line endings +/Makefile text eol=lf + +# More attributes are defined in per-directory .gitattributes which override this file diff --git a/flight/.gitattributes b/flight/.gitattributes new file mode 100644 index 000000000..e85fe7958 --- /dev/null +++ b/flight/.gitattributes @@ -0,0 +1,17 @@ +# +# Flight source code files should always have LF line endings by agreement +# http://wiki.openpilot.org/display/Doc/Coding+Style +# + +*.c text eol=lf +*.h text eol=lf +*.py text eol=lf + +*.s text eol=lf +*.S text eol=lf +*.ld text eol=lf +*.inc text eol=lf + +Makefile text eol=lf +Makefile.* text eol=lf +*.mk text eol=lf diff --git a/ground/.gitattributes b/ground/.gitattributes new file mode 100644 index 000000000..a9834a726 --- /dev/null +++ b/ground/.gitattributes @@ -0,0 +1,17 @@ +# +# Ground source code files should always have CRLF line endings by agreement +# http://wiki.openpilot.org/display/Doc/Coding+Style +# + +*.c text eol=crlf +*.cpp text eol=crlf +*.h text eol=crlf +*.hpp text eol=crlf + +*.ui text eol=crlf +*.qrc text eol=crlf +*.qml text eol=crlf +*.pluginspec text eol=crlf + +*.pri text eol=crlf +*.pro text eol=crlf diff --git a/make/.gitattributes b/make/.gitattributes new file mode 100644 index 000000000..66e2df4a4 --- /dev/null +++ b/make/.gitattributes @@ -0,0 +1,10 @@ +# +# All make includes should have LF line endings to be consistent with flight code +# + +*.mk text eol=lf +*.py text eol=lf + +/templates/firmwareinfotemplate.c text eol=lf +/templates/gcs_version_info_template.h text eol=crlf +/templates/*.txt text eol=crlf diff --git a/matlab/.gitattributes b/matlab/.gitattributes new file mode 100644 index 000000000..8e2cfd840 --- /dev/null +++ b/matlab/.gitattributes @@ -0,0 +1,6 @@ +# +# Matlab files have LF line endings +# + +*.m text eol=lf +*.mdl text eol=lf diff --git a/package/.gitattributes b/package/.gitattributes new file mode 100644 index 000000000..5aa1fab05 --- /dev/null +++ b/package/.gitattributes @@ -0,0 +1,5 @@ +# +# Only Makefiles will have LF line endings +# + +/*.mk text eol=lf diff --git a/shared/.gitattributes b/shared/.gitattributes new file mode 100644 index 000000000..77dc7b089 --- /dev/null +++ b/shared/.gitattributes @@ -0,0 +1,5 @@ +# +# Shared UAVObject definisiton should have LF line endings +# + +/uavobjectdefinition/*.xml text eol=lf