tools.gitlibs
无法抓取未包含在分支上的 Git SHA1s。例如,如果提交只由标签(例如,v1.2.3-acme1)引用,那么使用 clj -Spath
会因为以下错误而失败
Error building classpath. Missing unknown fb8143248fddb5177de6eb55ed21956782776c4a
org.eclipse.jgit.api.errors.JGitInternalException: Missing unknown fb8143248fddb5177de6eb55ed21956782776c4a
能否用以下补丁更新 tools.gitlibs?
---
src/main/clojure/clojure/tools/gitlibs/impl.clj | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj
index b2eba18..a2ee828 100644
--- a/src/main/clojure/clojure/tools/gitlibs/impl.clj
+++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj
@@ -17,7 +17,7 @@
[org.eclipse.jgit.api Git GitCommand TransportCommand TransportConfigCallback]
[org.eclipse.jgit.lib Repository RepositoryBuilder]
[org.eclipse.jgit.revwalk RevWalk RevCommit]
- [org.eclipse.jgit.transport SshTransport JschConfigSessionFactory]
+ [org.eclipse.jgit.transport SshTransport JschConfigSessionFactory TagOpt]
[com.jcraft.jsch JSch]
[com.jcraft.jsch.agentproxy Connector ConnectorFactory RemoteIdentityRepository]))
@@ -63,7 +63,7 @@
(defn git-fetch
^Git [git-dir]
(let [git (Git. (git-repo git-dir))]
- (call-with-auth (.. git fetch))
+ (call-with-auth (.. git fetch (setTagOpt TagOpt/FETCH_TAGS)))
git))
;; TODO: restrict clone to an optional refspec?
@@ -74,7 +74,8 @@
(.. (Git/cloneRepository) (setURI url) (setGitDir (jio/file git-dir))
(setBare true)
(setNoCheckout true)
- (setCloneAllBranches true)))
+ (setCloneAllBranches true)
+ (setTagOption TagOpt/FETCH_TAGS)))
git-dir)