]> git.scottworley.com Git - git-cache/blobdiff - git_cache.py
Suppress git's init.defaultBranch hints
[git-cache] / git_cache.py
index d54041be67fe1d3336cce7f1e03cf272288695ee..1ed26017ceb18f0831d8b5566068c6eb11fdcf7a 100644 (file)
@@ -176,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)