|
22 | 22 | import org.eclipse.jgit.treewalk.filter.PathFilter; |
23 | 23 | import org.scm4j.vcs.api.*; |
24 | 24 | import org.scm4j.vcs.api.exceptions.EVCSBranchExists; |
| 25 | +import org.scm4j.vcs.api.exceptions.EVCSBranchNotFound; |
25 | 26 | import org.scm4j.vcs.api.exceptions.EVCSException; |
26 | 27 | import org.scm4j.vcs.api.exceptions.EVCSFileNotFound; |
27 | 28 | import org.scm4j.vcs.api.exceptions.EVCSTagExists; |
@@ -105,6 +106,7 @@ public VCSTag createUnannotatedTag(String branchName, String tagName, String rev |
105 | 106 |
|
106 | 107 | git |
107 | 108 | .pull() |
| 109 | + .setCredentialsProvider(credentials) |
108 | 110 | .call(); |
109 | 111 |
|
110 | 112 | RevCommit commitToTag = revisionToTag == null ? null : rw.parseCommit(ObjectId.fromString(revisionToTag)); |
@@ -294,10 +296,13 @@ public String getFileContent(String branchName, String fileRelativePath, String |
294 | 296 | git |
295 | 297 | .fetch() |
296 | 298 | .setRefSpecs(new RefSpec("+refs/heads/*:refs/heads/*")) |
297 | | - //.setRemoveDeletedRefs(true) |
298 | 299 | .setCredentialsProvider(credentials) |
299 | 300 | .call(); |
300 | | - git.pull().call(); //TODO: add test when we receive correct file version if we change it from another LWC |
| 301 | + git |
| 302 | + .pull() |
| 303 | + .setCredentialsProvider(credentials) |
| 304 | + .call(); //TODO: add test when we receive correct file version if we change it from another LWC |
| 305 | + |
301 | 306 | ObjectId revisionCommitId = gitRepo.resolve(revision == null ? "refs/heads/" + getRealBranchName(branchName) : revision); |
302 | 307 | if (revision == null && revisionCommitId == null) { |
303 | 308 | throw new EVCSBranchNotFound(getRepoUrl(), getRealBranchName(branchName)); |
@@ -371,6 +376,7 @@ void checkout(Git git, Repository gitRepo, String branchName, String revision) t |
371 | 376 | if (revision == null) { |
372 | 377 | git |
373 | 378 | .pull() |
| 379 | + .setCredentialsProvider(credentials) |
374 | 380 | .call(); |
375 | 381 | cmd |
376 | 382 | .setStartPoint("origin/" + bn) |
@@ -449,7 +455,11 @@ public Set<String> getBranches(String path) { |
449 | 455 | Git git = getLocalGit(wc); |
450 | 456 | Repository gitRepo = git.getRepository()) { |
451 | 457 |
|
452 | | - git.pull().call(); //TODO: add test when we receive correct branches list if we change it from another LWC |
| 458 | + git |
| 459 | + .pull() |
| 460 | + .setCredentialsProvider(credentials) |
| 461 | + .call(); //TODO: add test when we receive correct branches list if we change it from another LWC |
| 462 | + |
453 | 463 | Collection<Ref> refs = gitRepo.getRefDatabase().getRefs(REFS_REMOTES_ORIGIN).values(); |
454 | 464 | Set<String> res = new HashSet<>(); |
455 | 465 | String bn; |
@@ -739,6 +749,7 @@ private void updateLocalTags(Git git) throws Exception { |
739 | 749 | .call(); |
740 | 750 | git |
741 | 751 | .pull() |
| 752 | + .setCredentialsProvider(credentials) |
742 | 753 | .call(); |
743 | 754 | } |
744 | 755 |
|
@@ -774,19 +785,6 @@ public List<VCSTag> getTags() { |
774 | 785 | } |
775 | 786 | } |
776 | 787 |
|
777 | | -// private List<Ref> getTagRefs(Git git) throws Exception { |
778 | | -// // need to remove tags from local repo which are removed in origin |
779 | | -// git |
780 | | -// .fetch() |
781 | | -// .setRefSpecs(new RefSpec("+refs/tags/*:refs/tags/*")) |
782 | | -// .setRemoveDeletedRefs(true) |
783 | | -// .setCredentialsProvider(credentials) |
784 | | -// .call(); |
785 | | -// return git |
786 | | -// .tagList() |
787 | | -// .call(); |
788 | | -// } |
789 | | - |
790 | 788 | @Override |
791 | 789 | public void removeTag(String tagName) { |
792 | 790 | try (IVCSLockedWorkingCopy wc = repo.getVCSLockedWorkingCopy(); |
|
0 commit comments