aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-02-27 11:16:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-02-27 11:16:44 +0200
commit921d80c6dbf23b9d3c0b102f1a153bb6291c5433 (patch)
treed34ba98cd37f8db0e32a53ae7e25f1c97d83a55a
parent001a9cc3f7d5077905b9ad2dde0376b9d12baff4 (diff)
Add generation of .gitattributes to bdep-new
-rw-r--r--bdep/new.cxx26
1 files changed, 24 insertions, 2 deletions
diff --git a/bdep/new.cxx b/bdep/new.cxx
index 849b3d3..fcef234 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -879,7 +879,7 @@ namespace bdep
}
};
- // .gitignore
+ // .gitignore & .gitattributes
//
// See also tests/.gitignore below.
//
@@ -887,7 +887,7 @@ namespace bdep
{
if (vc == vcs::git)
{
- // Use POSIX directory separators here.
+ // Note: use POSIX directory separators in these files.
//
open (out / ".gitignore");
if (!pkg)
@@ -918,6 +918,28 @@ namespace bdep
<< "*.exe.manifest" << endl
<< "*.pc" << endl;
os.close ();
+
+ open (out / ".gitattributes");
+ os << "# This is a good default: files that are auto-detected by git to be text are" << endl
+ << "# converted to the platform-native line ending (LF on Unix, CRLF on Windows)" << endl
+ << "# in the working tree and to LF in the repository." << endl
+ << "#" << endl
+ << "* text=auto"<< endl
+ << endl
+ << "# Use `eol=crlf` for files that should have the CRLF line ending both in the" << endl
+ << "# working tree (even on Unix) and in the repository." << endl
+ << "#" << endl
+ << "#*.bat text eol=crlf" << endl
+ << endl
+ << "# Use `eol=lf` for files that should have the LF line ending both in the" << endl
+ << "# working tree (even on Windows) in the repository." << endl
+ << "#" << endl
+ << "#*.sh text eol=lf" << endl
+ << endl
+ << "# Use `binary` to make sure certain files are never auto-detected as text." << endl
+ << "#" << endl
+ << "#*.png binary" << endl;
+ os.close ();
}
}