From 938943d6747bb915e89714f21388a1f1e6ca0b24 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 20 Jul 2010 09:11:39 -0700 Subject: [PATCH] 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 CC: Charley Wang CC: Chris Aniszczyk CC: Stefan Lay CC: Matthias Sohn --- .../src/org/eclipse/jgit/ignore/SimpleIgnoreCache.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/SimpleIgnoreCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/SimpleIgnoreCache.java index 0d74e881c..fc346a98f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/SimpleIgnoreCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/SimpleIgnoreCache.java @@ -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);