From b878cdcf6b4c2445553dcd1507d5c3008bf56b7b Mon Sep 17 00:00:00 2001 From: Charley Wang Date: Tue, 13 Jul 2010 00:34:15 +0200 Subject: Add compatibility with gitignore specifications This patch adds ignore compatibility to jgit. It encompasses exclude files as well as .gitignore. Uses TreeWalk and FileTreeIterator to find nodes and parses .gitignore files when required. The patch includes a simple cache that can be used to save results and avoid excessive gitignore parsing. CQ: 4302 Bug: 303925 Change-Id: Iebd7e5bb534accca4bf00d25bbc1f561d7cad11b Signed-off-by: Chris Aniszczyk Signed-off-by: Stefan Lay Signed-off-by: Matthias Sohn --- .../tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/.gitignore | 1 + .../org/eclipse/jgit/test/resources/excludeTest/new/.gitignore | 1 + .../org/eclipse/jgit/test/resources/excludeTest/new/a/.gitignore | 0 .../org/eclipse/jgit/test/resources/excludeTest/new/a/b1/.gitignore | 1 + .../org/eclipse/jgit/test/resources/excludeTest/new/a/b1/test.stp | 0 .../org/eclipse/jgit/test/resources/excludeTest/new/a/b2/c/.gitignore | 1 + .../org/eclipse/jgit/test/resources/excludeTest/new/a/b2/c/test.stp | 0 .../tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/notignored | 0 .../org/eclipse/jgit/test/resources/excludeTest/src/.gitignore | 4 ++++ .../tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/src/test.stp | 0 .../tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/test.stp | 0 11 files changed, 8 insertions(+) create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/.gitignore create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/.gitignore create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/.gitignore create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b1/.gitignore create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b1/test.stp create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b2/c/.gitignore create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b2/c/test.stp create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/notignored create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/src/.gitignore create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/src/test.stp create mode 100644 org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/test.stp (limited to 'org.eclipse.jgit.test/tst-rsrc/org/eclipse') diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/.gitignore b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/.gitignore new file mode 100644 index 0000000000..b3f6bc97fb --- /dev/null +++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/.gitignore @@ -0,0 +1 @@ +!/notignored diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/.gitignore b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/.gitignore new file mode 100644 index 0000000000..09b8574b00 --- /dev/null +++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/.gitignore @@ -0,0 +1 @@ +notarealfile diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/.gitignore b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b1/.gitignore b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b1/.gitignore new file mode 100644 index 0000000000..82b0f5d464 --- /dev/null +++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b1/.gitignore @@ -0,0 +1 @@ +/c diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b1/test.stp b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b1/test.stp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b2/c/.gitignore b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b2/c/.gitignore new file mode 100644 index 0000000000..3c6cf10b1d --- /dev/null +++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b2/c/.gitignore @@ -0,0 +1 @@ +/notarealfile2 diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b2/c/test.stp b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/new/a/b2/c/test.stp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/notignored b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/notignored new file mode 100644 index 0000000000..e69de29bb2 diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/src/.gitignore b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/src/.gitignore new file mode 100644 index 0000000000..b314092d16 --- /dev/null +++ b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/src/.gitignore @@ -0,0 +1,4 @@ +/*.st? +!/test.stp +!/a.c +/a.c diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/src/test.stp b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/src/test.stp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/test.stp b/org.eclipse.jgit.test/tst-rsrc/org/eclipse/jgit/test/resources/excludeTest/test.stp new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3