From c3cf3ec358f33abb8839f4a45cecf368410f7bca Mon Sep 17 00:00:00 2001 From: James Edwards Date: Mon, 30 Oct 2023 10:40:41 -0600 Subject: [PATCH 1/2] fix issue with partial branch match --- manic/repository_git.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/manic/repository_git.py b/manic/repository_git.py index adc666c..2a9e2f7 100644 --- a/manic/repository_git.py +++ b/manic/repository_git.py @@ -380,8 +380,8 @@ def _check_for_valid_ref(self, ref, remote_name, dirname): is_tag = self._ref_is_tag(ref, dirname) is_branch = self._ref_is_branch(ref, remote_name, dirname) is_hash = self._ref_is_hash(ref, dirname) - is_valid = is_tag or is_branch or is_hash + print(f"is_tag {is_tag} is_branch {is_branch} is_valid {is_valid}") if not is_valid: msg = ('In repo "{0}": reference "{1}" does not appear to be a ' 'valid tag, branch or hash! Please verify the reference ' @@ -710,7 +710,10 @@ def _git_lsremote_branch(ref, remote_name, dirname): cmd = ('git -C {dirname} ls-remote --exit-code --heads ' '{remote_name} {ref}').format( dirname=dirname, remote_name=remote_name, ref=ref).split() - status = execute_subprocess(cmd, status_to_caller=True) + status, output = execute_subprocess(cmd, status_to_caller=True, output_to_caller=True) + if not status and not f"refs/heads/{ref}" in output: + # In this case the ref is contained in the branch name but is not the complete branch name + return -1 return status @staticmethod From b4466a5aa8069a722d327f5b3d1eb1c98aa88a1c Mon Sep 17 00:00:00 2001 From: James Edwards Date: Mon, 30 Oct 2023 11:47:06 -0600 Subject: [PATCH 2/2] remove debug print statement --- manic/repository_git.py | 1 - 1 file changed, 1 deletion(-) diff --git a/manic/repository_git.py b/manic/repository_git.py index 2a9e2f7..ac55084 100644 --- a/manic/repository_git.py +++ b/manic/repository_git.py @@ -381,7 +381,6 @@ def _check_for_valid_ref(self, ref, remote_name, dirname): is_branch = self._ref_is_branch(ref, remote_name, dirname) is_hash = self._ref_is_hash(ref, dirname) is_valid = is_tag or is_branch or is_hash - print(f"is_tag {is_tag} is_branch {is_branch} is_valid {is_valid}") if not is_valid: msg = ('In repo "{0}": reference "{1}" does not appear to be a ' 'valid tag, branch or hash! Please verify the reference '