Skip to content

Commit c80ff8d

Browse files
committed
Merge branch 'master' into stable-7.6
* master: Add AddCommand #addFilepatterns methods Bazel: Pin jcl-over-slf4j to SLF4J_VERSION Change-Id: I09c2ce5ecc00a0811fbea636200e3565083c2089
2 parents 401eeaa + db7dcf9 commit c80ff8d

File tree

12 files changed

+133
-6
lines changed

12 files changed

+133
-6
lines changed

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ maven.install(
8181
"org.openjdk.jmh:jmh-core:" + JMH_VERSION,
8282
"org.openjdk.jmh:jmh-generator-annprocess:" + JMH_VERSION,
8383
"org.slf4j:slf4j-api:" + SLF4J_VERSION,
84+
"org.slf4j:jcl-over-slf4j:" + SLF4J_VERSION,
8485
"org.slf4j:slf4j-simple:" + SLF4J_VERSION,
8586
"org.tukaani:xz:1.11",
8687
],

org.eclipse.jgit.packaging/org.eclipse.jgit.repository/category.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@
216216
<bundle id="slf4j.simple.source">
217217
<category name="JGit-dependency-bundles"/>
218218
</bundle>
219+
<bundle id="jcl.over.slf4j">
220+
<category name="JGit-dependency-bundles"/>
221+
</bundle>
222+
<bundle id="jcl.over.slf4j.source">
223+
<category name="JGit-dependency-bundles"/>
224+
</bundle>
219225
<bundle id="org.tukaani.xz">
220226
<category name="JGit-dependency-bundles"/>
221227
</bundle>

org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.34.target

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<?pde?>
33
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
4-
<target name="jgit-4.34" sequenceNumber="1771451400">
4+
<target name="jgit-4.34" sequenceNumber="1772188163">
55
<locations>
66
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
77
<unit id="com.jcraft.jsch" version="0.1.55.v20230916-1400"/>
@@ -58,6 +58,12 @@
5858
<version>2.0.17</version>
5959
<type>jar</type>
6060
</dependency>
61+
<dependency>
62+
<groupId>org.slf4j</groupId>
63+
<artifactId>jcl-over-slf4j</artifactId>
64+
<version>2.0.17</version>
65+
<type>jar</type>
66+
</dependency>
6167
</dependencies>
6268
</location>
6369
<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="error" type="Maven" label="sshd">

org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.35.target

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<?pde?>
33
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
4-
<target name="jgit-4.35" sequenceNumber="1771451400">
4+
<target name="jgit-4.35" sequenceNumber="1772188163">
55
<locations>
66
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
77
<unit id="com.jcraft.jsch" version="0.1.55.v20230916-1400"/>
@@ -58,6 +58,12 @@
5858
<version>2.0.17</version>
5959
<type>jar</type>
6060
</dependency>
61+
<dependency>
62+
<groupId>org.slf4j</groupId>
63+
<artifactId>jcl-over-slf4j</artifactId>
64+
<version>2.0.17</version>
65+
<type>jar</type>
66+
</dependency>
6167
</dependencies>
6268
</location>
6369
<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="error" type="Maven" label="sshd">

org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.36.target

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<?pde?>
33
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
4-
<target name="jgit-4.36" sequenceNumber="1771451400">
4+
<target name="jgit-4.36" sequenceNumber="1772188163">
55
<locations>
66
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
77
<unit id="com.jcraft.jsch" version="0.1.55.v20230916-1400"/>
@@ -58,6 +58,12 @@
5858
<version>2.0.17</version>
5959
<type>jar</type>
6060
</dependency>
61+
<dependency>
62+
<groupId>org.slf4j</groupId>
63+
<artifactId>jcl-over-slf4j</artifactId>
64+
<version>2.0.17</version>
65+
<type>jar</type>
66+
</dependency>
6167
</dependencies>
6268
</location>
6369
<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="error" type="Maven" label="sshd">

org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.37.target

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<?pde?>
33
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
4-
<target name="jgit-4.37" sequenceNumber="1771451400">
4+
<target name="jgit-4.37" sequenceNumber="1772188163">
55
<locations>
66
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
77
<unit id="com.jcraft.jsch" version="0.1.55.v20230916-1400"/>
@@ -58,6 +58,12 @@
5858
<version>2.0.17</version>
5959
<type>jar</type>
6060
</dependency>
61+
<dependency>
62+
<groupId>org.slf4j</groupId>
63+
<artifactId>jcl-over-slf4j</artifactId>
64+
<version>2.0.17</version>
65+
<type>jar</type>
66+
</dependency>
6167
</dependencies>
6268
</location>
6369
<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="error" type="Maven" label="sshd">

org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.38.target

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<?pde?>
33
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
4-
<target name="jgit-4.38" sequenceNumber="1771451400">
4+
<target name="jgit-4.38" sequenceNumber="1772188163">
55
<locations>
66
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
77
<unit id="com.jcraft.jsch" version="0.1.55.v20230916-1400"/>
@@ -58,6 +58,12 @@
5858
<version>2.0.17</version>
5959
<type>jar</type>
6060
</dependency>
61+
<dependency>
62+
<groupId>org.slf4j</groupId>
63+
<artifactId>jcl-over-slf4j</artifactId>
64+
<version>2.0.17</version>
65+
<type>jar</type>
66+
</dependency>
6167
</dependencies>
6268
</location>
6369
<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="error" type="Maven" label="sshd">

org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.39.target

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<?pde?>
33
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
4-
<target name="jgit-4.39" sequenceNumber="1771451400">
4+
<target name="jgit-4.39" sequenceNumber="1772188163">
55
<locations>
66
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
77
<unit id="com.jcraft.jsch" version="0.1.55.v20230916-1400"/>
@@ -58,6 +58,12 @@
5858
<version>2.0.17</version>
5959
<type>jar</type>
6060
</dependency>
61+
<dependency>
62+
<groupId>org.slf4j</groupId>
63+
<artifactId>jcl-over-slf4j</artifactId>
64+
<version>2.0.17</version>
65+
<type>jar</type>
66+
</dependency>
6167
</dependencies>
6268
</location>
6369
<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="error" type="Maven" label="sshd">

org.eclipse.jgit.packaging/org.eclipse.jgit.target/maven/dependencies.tpd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ maven slf4j
263263
artifactId = "slf4j-simple"
264264
version = "2.0.17"
265265
}
266+
dependency {
267+
groupId = "org.slf4j"
268+
artifactId = "jcl-over-slf4j"
269+
version = "2.0.17"
270+
}
266271
}
267272

268273
maven xz

org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.io.OutputStream;
2828
import java.io.PrintWriter;
2929
import java.nio.file.Files;
30+
import java.util.List;
3031
import java.util.Set;
3132
import java.util.concurrent.TimeUnit;
3233

@@ -109,6 +110,46 @@ public void testAddExistingSingleFile() throws IOException, GitAPIException {
109110
}
110111
}
111112

113+
@Test
114+
public void testAddExistingMultipleFiles()
115+
throws IOException, GitAPIException {
116+
File file = new File(db.getWorkTree(), "a.txt");
117+
FileUtils.createNewFile(file);
118+
file = new File(db.getWorkTree(), "b.txt");
119+
FileUtils.createNewFile(file);
120+
try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
121+
writer.print("content");
122+
}
123+
124+
try (Git git = new Git(db)) {
125+
git.add().addFilepatterns("a.txt", "b.txt").call();
126+
127+
assertEquals(
128+
"[a.txt, mode:100644, content:][b.txt, mode:100644, content:content]",
129+
indexState(CONTENT));
130+
}
131+
}
132+
133+
@Test
134+
public void testAddExistingMultipleFilesCollection()
135+
throws IOException, GitAPIException {
136+
File file = new File(db.getWorkTree(), "a.txt");
137+
FileUtils.createNewFile(file);
138+
file = new File(db.getWorkTree(), "b.txt");
139+
FileUtils.createNewFile(file);
140+
try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
141+
writer.print("content");
142+
}
143+
144+
try (Git git = new Git(db)) {
145+
git.add().addFilepatterns(List.of("a.txt", "b.txt")).call();
146+
147+
assertEquals(
148+
"[a.txt, mode:100644, content:][b.txt, mode:100644, content:content]",
149+
indexState(CONTENT));
150+
}
151+
}
152+
112153
@Test
113154
public void testAddLink() throws IOException, GitAPIException {
114155
assumeTrue(db.getFS().supportsSymlinks());

0 commit comments

Comments
 (0)