Browse Source

Define DEFAULT_REF_PREFIX

Jelmer Vernooij 4 months ago
parent
commit
35337d72da
1 changed files with 7 additions and 4 deletions
  1. 7 4
      dulwich/client.py

+ 7 - 4
dulwich/client.py

@@ -128,6 +128,12 @@ from .refs import (
 )
 from .repo import Repo
 
+# Default ref prefix, used if none is specified.
+# GitHub defaults to just sending HEAD if no ref-prefix is
+# specified, so explicitly request all refs to match
+# behaviour with v1 when no ref-prefix is specified.
+DEFAULT_REF_PREFIX = [b"HEAD", b"refs/"]
+
 ObjectID = bytes
 
 
@@ -1375,10 +1381,7 @@ class TraditionalGitClient(GitClient):
                 proto.write_pkt_line(b"symrefs")
                 proto.write_pkt_line(b"peel")
                 if ref_prefix is None:
-                    # GitHub defaults to just sending HEAD if no ref-prefix is
-                    # specified, so explicitly request all refs to match
-                    # behaviour with v1 when no ref-prefix is specified.
-                    ref_prefix = [b"HEAD", b"refs/"]
+                    ref_prefix = DEFAULT_REF_PREFIX
                 for prefix in ref_prefix:
                     proto.write_pkt_line(b"ref-prefix " + prefix)
                 proto.write_pkt_line(None)