[PATCH 04/17] CLI/git: make existance of config branch optional on clone

Subject: [PATCH 04/17] CLI/git: make existance of config branch optional on clone

Date: Sun, 15 May 2022 15:14:09 -0300

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


This branch is actually only used by an associated
utility (notmuch-report), and notmuch-git works fine without it.
---
 notmuch-git.in | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/notmuch-git.in b/notmuch-git.in
index 4b94046d..57b5a0ec 100755
--- a/notmuch-git.in
+++ b/notmuch-git.in
@@ -273,7 +273,13 @@ def clone(repository):
             wait=True)
     _git(args=['config', '--unset', 'core.worktree'], wait=True, expect=(0, 5))
     _git(args=['config', 'core.bare', 'true'], wait=True)
-    _git(args=['branch', 'config', 'origin/config'], wait=True)
+    (status, stdout, stderr) = _git(args=['show-ref', '--verify',
+                                          '--quiet',
+                                          'refs/remotes/origin/config'],
+                                    expect=(0,1),
+                                    wait=True)
+    if status == 0:
+        _git(args=['branch', 'config', 'origin/config'], wait=True)
     existing_tags = get_tags()
     if existing_tags:
         _LOG.warning(
-- 
2.35.2

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: