diff --git a/src/git_flow/command/merge.py b/src/git_flow/command/merge.py index 9c05184..6539bde 100644 --- a/src/git_flow/command/merge.py +++ b/src/git_flow/command/merge.py @@ -79,7 +79,9 @@ def check_merge_conflicts(target: str): print="Realizando merge de prueba para verificar conflictos" ) - Git("merge", abort=True).exec(print="Abortando merge de prueba", check=False) + # Si el merge no llegó a realizarse (por ejemplo, "Already up to date") no hay nada que abortar + if Git.is_merging(): + Git("merge", abort=True).exec(print="Abortando merge de prueba") if merge_conflicts: base.io_error( diff --git a/src/git_flow/git.py b/src/git_flow/git.py index 9f754e8..d54965c 100644 --- a/src/git_flow/git.py +++ b/src/git_flow/git.py @@ -63,6 +63,11 @@ class Git: def get_branches(prefix: str = ""): return Git._get_references("heads/" + prefix) + @staticmethod + def is_merging() -> bool: + """Indica si hay un merge en curso (existe MERGE_HEAD), con o sin conflictos.""" + return Git("rev-parse", "MERGE_HEAD", quiet=True, verify=True).code() == 0 + @staticmethod def status(): return list(map(Git.Status, Git("status", porcelain=True).lines(False)))