git: Call 'url-cache-directory' outside 'update-cached-checkout'.
* guix/git.scm (update-cached-checkout): Call 'url-cache-directory' in 'cache-directory' key argument. (latest-repository-commit): Call 'url-cache-directory'.
This commit is contained in:
		
							parent
							
								
									e29067d22e
								
							
						
					
					
						commit
						ffc3fcade3
					
				
					 1 changed files with 14 additions and 12 deletions
				
			
		
							
								
								
									
										18
									
								
								guix/git.scm
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								guix/git.scm
									
										
									
									
									
								
							| 
						 | 
					@ -114,7 +114,8 @@ OID (roughly the commit hash) corresponding to REF."
 | 
				
			||||||
                                 #:key
 | 
					                                 #:key
 | 
				
			||||||
                                 (ref '(branch . "origin/master"))
 | 
					                                 (ref '(branch . "origin/master"))
 | 
				
			||||||
                                 (cache-directory
 | 
					                                 (cache-directory
 | 
				
			||||||
                                  (%repository-cache-directory)))
 | 
					                                  (url-cache-directory
 | 
				
			||||||
 | 
					                                   url (%repository-cache-directory))))
 | 
				
			||||||
  "Update the cached checkout of URL to REF in CACHE-DIRECTORY.  Return two
 | 
					  "Update the cached checkout of URL to REF in CACHE-DIRECTORY.  Return two
 | 
				
			||||||
values: the cache directory name, and the SHA1 commit (a string) corresponding
 | 
					values: the cache directory name, and the SHA1 commit (a string) corresponding
 | 
				
			||||||
to REF.
 | 
					to REF.
 | 
				
			||||||
| 
						 | 
					@ -122,11 +123,10 @@ to REF.
 | 
				
			||||||
REF is pair whose key is [branch | commit | tag] and value the associated
 | 
					REF is pair whose key is [branch | commit | tag] and value the associated
 | 
				
			||||||
data, respectively [<branch name> | <sha1> | <tag name>]."
 | 
					data, respectively [<branch name> | <sha1> | <tag name>]."
 | 
				
			||||||
  (with-libgit2
 | 
					  (with-libgit2
 | 
				
			||||||
   (let* ((cache-dir     (url-cache-directory url cache-directory))
 | 
					   (let* ((cache-exists? (openable-repository? cache-directory))
 | 
				
			||||||
          (cache-exists? (openable-repository? cache-dir))
 | 
					 | 
				
			||||||
          (repository    (if cache-exists?
 | 
					          (repository    (if cache-exists?
 | 
				
			||||||
                             (repository-open cache-dir)
 | 
					                             (repository-open cache-directory)
 | 
				
			||||||
                             (clone* url cache-dir))))
 | 
					                             (clone* url cache-directory))))
 | 
				
			||||||
     ;; Only fetch remote if it has not been cloned just before.
 | 
					     ;; Only fetch remote if it has not been cloned just before.
 | 
				
			||||||
     (when cache-exists?
 | 
					     (when cache-exists?
 | 
				
			||||||
       (remote-fetch (remote-lookup repository "origin")))
 | 
					       (remote-fetch (remote-lookup repository "origin")))
 | 
				
			||||||
| 
						 | 
					@ -138,7 +138,7 @@ data, respectively [<branch name> | <sha1> | <tag name>]."
 | 
				
			||||||
                              'repository-close!)
 | 
					                              'repository-close!)
 | 
				
			||||||
         (repository-close! repository))
 | 
					         (repository-close! repository))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       (values cache-dir (oid->string oid))))))
 | 
					       (values cache-directory (oid->string oid))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define* (latest-repository-commit store url
 | 
					(define* (latest-repository-commit store url
 | 
				
			||||||
                                   #:key
 | 
					                                   #:key
 | 
				
			||||||
| 
						 | 
					@ -157,10 +157,12 @@ Git repositories are kept in the cache directory specified by
 | 
				
			||||||
    (and (string=? (basename file) ".git")
 | 
					    (and (string=? (basename file) ".git")
 | 
				
			||||||
         (eq? 'directory (stat:type stat))))
 | 
					         (eq? 'directory (stat:type stat))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  (let*-values (((checkout commit)
 | 
					  (let*-values
 | 
				
			||||||
 | 
					      (((checkout commit)
 | 
				
			||||||
        (update-cached-checkout url
 | 
					        (update-cached-checkout url
 | 
				
			||||||
                                #:ref ref
 | 
					                                #:ref ref
 | 
				
			||||||
                                         #:cache-directory cache-directory))
 | 
					                                #:cache-directory
 | 
				
			||||||
 | 
					                                (url-cache-directory url cache-directory)))
 | 
				
			||||||
       ((name)
 | 
					       ((name)
 | 
				
			||||||
        (url+commit->name url commit)))
 | 
					        (url+commit->name url commit)))
 | 
				
			||||||
    (values (add-to-store store name #t "sha256" checkout
 | 
					    (values (add-to-store store name #t "sha256" checkout
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue