]> git.scottworley.com Git - git-cache/blobdiff - git_cache.py
Start on 1.4.2
[git-cache] / git_cache.py
index b0f992e76589666ee86f5f8d8e27f51142af71c5..1ed26017ceb18f0831d8b5566068c6eb11fdcf7a 100644 (file)
@@ -156,7 +156,6 @@ def _show_force_warning() -> None:
     print('*' * 74, file=sys.stderr)
 
 
-
 @backoff.on_exception(
     backoff.expo,
     subprocess.CalledProcessError,
@@ -177,8 +176,14 @@ def fetch(repo: Repo, ref: Ref, force: bool = False) -> Tuple[Path, Rev]:
     cachedir = git_cachedir(repo)
     if not os.path.exists(cachedir):
         logging.debug("Initializing git repo")
-        subprocess.run(['git', 'init', '--bare', cachedir],
-                       check=True, stdout=sys.stderr)
+        subprocess.run(['git',
+                        '-c',
+                        'init.defaultBranch=git-cache--no-default-branch',
+                        'init',
+                        '--bare',
+                        cachedir],
+                       check=True,
+                       stdout=sys.stderr)
 
     logging.debug('Fetching ref "%s" from %s', ref, repo)
     _git_fetch(cachedir, repo, ref, force=force)