[PATCH 08/16] CLI/git: make existance of config branch optional on clone

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

Date:Sat, 23 Apr 2022 10:38:40 -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.

With this change we can use "notmuch git clone" in the setup for
the tests in T850-git.sh
---
 notmuch-git.in   | 8 +++++++-
 test/T850-git.sh | 9 +--------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/notmuch-git.in b/notmuch-git.in
index 3a58fd28..8b397080 100755
--- a/notmuch-git.in
+++ b/notmuch-git.in
@@ -303,7 +303,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(
diff --git a/test/T850-git.sh b/test/T850-git.sh
index d682141f..417692d4 100755
--- a/test/T850-git.sh
+++ b/test/T850-git.sh
@@ -4,20 +4,13 @@ test_description='"notmuch git" to save and restore tags'
 
 add_git_repos () {
     notmuch git -C remote.git -p '' init
-
-    # now make a "local" repo to work on
-    git clone --bare --quiet remote.git tags.git
-    git -C tags.git config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
-    git -C tags.git fetch origin
-    git -C tags.git branch -u origin/master master
+    notmuch git -C tags.git -p '' clone remote.git
 }
 
 add_email_corpus
 add_git_repos
 
 test_begin_subtest "clone"
-# currently broken because of hard-wired requirement for config branch
-test_subtest_known_broken
 test_expect_success "notmuch git -C clone.git clone tags.git"
 
 test_begin_subtest "commit"
-- 
2.35.2

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

Thread: