Skip to content

Commit

Permalink
Merge pull request #1064 from MarkEWaite/do-not-search-parents-for-repo
Browse files Browse the repository at this point in the history
[JENKINS-38699] Only check for git repo in current workspace dir
  • Loading branch information
MarkEWaite committed Apr 4, 2021
2 parents b90a2a0 + c561ab5 commit 449e6ab
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git-client</artifactId>
<version>3.7.0</version>
<version>3.7.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/git/GitSCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ private PollingResult compareRemoteRevisionWithImpl(Job<?, ?> project, Launcher

GitClient git = createClient(listener, environment, project, node, workingDirectory);

if (git.hasGitRepo()) {
if (git.hasGitRepo(false)) {
// Repo is there - do a fetch
listener.getLogger().println("Fetching changes from the remote Git repositories");

Expand Down Expand Up @@ -1205,7 +1205,7 @@ private void retrieveChanges(Run build, GitClient git, TaskListener listener) th
List<RemoteConfig> repos = getParamExpandedRepos(build, listener);
if (repos.isEmpty()) return; // defensive check even though this is an invalid configuration

if (git.hasGitRepo()) {
if (git.hasGitRepo(false)) {
// It's an update
if (repos.size() == 1)
log.println("Fetching changes from the remote Git repository");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ private <T, C extends GitSCMSourceContext<C, R>, R extends GitSCMSourceRequest>
}
GitClient client = git.getClient();
client.addDefaultCredentials(getCredentials());
if (!client.hasGitRepo()) {
if (!client.hasGitRepo(false)) {
listener.getLogger().println("Creating git repository in " + cacheDir);
client.init();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/jenkins/plugins/git/GitSCMFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public SCMFileSystem build(@NonNull Item owner, @NonNull SCM scm, @CheckForNull
CredentialsProvider.track(owner, credential);
}

if (!client.hasGitRepo()) {
if (!client.hasGitRepo(false)) {
listener.getLogger().println("Creating git repository in " + cacheDir);
client.init();
}
Expand Down Expand Up @@ -391,7 +391,7 @@ public SCMFileSystem build(@NonNull SCMSource source, @NonNull SCMHead head, @Ch
}
GitClient client = git.getClient();
client.addDefaultCredentials(gitSCMSource.getCredentials());
if (!client.hasGitRepo()) {
if (!client.hasGitRepo(false)) {
listener.getLogger().println("Creating git repository in " + cacheDir);
client.init();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jenkins/plugins/git/GitToolChooser.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private boolean decideAndUseCache(String remoteName) throws IOException, Interru
if (cacheDir != null) {
Git git = Git.with(TaskListener.NULL, new EnvVars(EnvVars.masterEnvVars)).in(cacheDir).using("git");
GitClient client = git.getClient();
if (client.hasGitRepo()) {
if (client.hasGitRepo(false)) {
long clientRepoSize = FileUtils.sizeOfDirectory(cacheDir) / 1024; // Conversion from Bytes to Kilo Bytes
if (clientRepoSize > sizeOfRepo) {
if (sizeOfRepo > 0) {
Expand Down

0 comments on commit 449e6ab

Please sign in to comment.