Use proper constants for .gitignore and .git directory

We have a constant for .gitignore, so use it.  While we are in
the same method, correct the reference of ".git" to be the actual
GIT_DIR given.  This might not be within the work tree if the
GIT_DIR and GIT_WORK_TREE environment variables were used.

Change-Id: I38e1cec13405109b9c347858b38dd9fb2f1f2560
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Charley Wang <chwang@redhat.com>
CC: Chris Aniszczyk <caniszczyk@gmail.com>
CC: Stefan Lay <stefan.lay@sap.com>
CC: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Shawn O. Pearce 2010-07-20 09:11:39 -07:00
parent c59db09bc5
commit 938943d674
1 changed files with 3 additions and 3 deletions

View File

@ -130,13 +130,13 @@ public void initialize() throws IOException {
*/
private void readRulesAtBase() {
//Add .gitignore rules
String path = new File(repository.getWorkDir(), ".gitignore").getAbsolutePath();
File f = new File(path);
File f = new File(repository.getWorkDir(), Constants.DOT_GIT_IGNORE);
String path = f.getAbsolutePath();
IgnoreNode n = new IgnoreNode(f.getParentFile());
//Add exclude rules
//TODO: Get /info directory without string concat
path = new File(repository.getWorkDir(), ".git/info/exclude").getAbsolutePath();
path = new File(repository.getDirectory(), "info/exclude").getAbsolutePath();
f = new File(path);
if (f.canRead())
n.addSecondarySource(f);