Skip to content

Commit

Permalink
Add generation of .gitattributes to bdep-new
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-kolpackov committed Feb 27, 2020
1 parent 001a9cc commit 921d80c
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions bdep/new.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -879,15 +879,15 @@ namespace bdep
}
};

// .gitignore
// .gitignore & .gitattributes
//
// See also tests/.gitignore below.
//
if (!sub)
{
if (vc == vcs::git)
{
// Use POSIX directory separators here.
// Note: use POSIX directory separators in these files.
//
open (out / ".gitignore");
if (!pkg)
Expand Down Expand Up @@ -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 ();
}
}

Expand Down

0 comments on commit 921d80c

Please sign in to comment.