FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Ignore all but specified files by joerwin · Pull Request #1105 · docker-java/docker-java · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .MD  (1) .jar  (1) .java  (2) .txt  (1) No extension  (1) dotfile  (1) All 6 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
      • Dockerfile.java
        • .dockerignore
        • Dockerfile
        • README.MD
          • foo.jar
          • bar.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,10 @@ private void addFilesInDirectory(File directory) {

if (files.length != 0) {
for (File f : files) {
if (effectiveMatchingIgnorePattern(f) == null) {
if (f.isDirectory()) {
addFilesInDirectory(f);
} else {
filesToAdd.add(f);
}
if (f.isDirectory()) {
addFilesInDirectory(f);
} else if (effectiveMatchingIgnorePattern(f) == null) {
filesToAdd.add(f);
}
}
// base directory should at least contains Dockerfile, but better check
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ public String apply(File file) {
}
};

@Test
public void ignoreAllBut() throws Exception {
File baseDir = fileFromBuildTestResource("dockerignore/IgnoreAllBut");
Dockerfile dockerfile = new Dockerfile(new File(baseDir, "Dockerfile"), baseDir);
Dockerfile.ScannedResult result = dockerfile.parse();
Collection<String> filesToAdd = transform(result.filesToAdd, TO_FILE_NAMES);

assertThat(filesToAdd,
containsInAnyOrder("Dockerfile", "foo.jar"));
}

@Test
public void nestedDirsPatterns() throws Exception {
File baseDir = fileFromBuildTestResource("dockerignore/NestedDirsDockerignore");
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!Dockerfile
!build/libs/foo.jar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM ubuntu:18.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DO NOT WANT THIS IN THE DOCKER
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo.jar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FILE

Back | FazBrowse Home | New Git URL