Skip to content

Commit 2d1d15b

Browse files
committed
fix: swap is_ancestor to use its own error handling due to git merge-base --is-ancestor only showing through status
1 parent 8df514f commit 2d1d15b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/util.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import cruft
1919
import typer
20+
from bandit.plugins.injection_shell import subprocess_popen_with_shell_equals_true
2021
from cookiecutter.utils import work_in
2122
from cruft._commands.utils.cruft import get_cruft_file
2223
from cruft._commands.utils.cruft import json_dumps
@@ -109,7 +110,11 @@ def is_branch_synced_with_remote(branch: str) -> bool:
109110

110111
def is_ancestor(ancestor: str, descendent: str) -> bool:
111112
"""Checks if the branch is synced with its remote."""
112-
return git("merge-base", "--is-ancestor", ancestor, descendent, ignore_error=True) is not None
113+
try:
114+
git("merge-base", "--is-ancestor", ancestor, descendent)
115+
return True
116+
except subprocess.CalledProcessError:
117+
return False
113118

114119

115120
def get_current_branch() -> str:

0 commit comments

Comments
 (0)