diff --git a/poetry/vcs/git.py b/poetry/vcs/git.py index 8992c410b76..bca4d325065 100644 --- a/poetry/vcs/git.py +++ b/poetry/vcs/git.py @@ -229,9 +229,15 @@ def rev_parse(self, rev, folder=None): # type: (...) -> str folder.as_posix(), ] - # We need "^{commit}" to ensure that the commit SHA of the commit the - # tag points to is returned, even in the case of annotated tags. - args += ["rev-parse", rev + "^{commit}"] + # We need "^0" (an alternative to "^{commit}") to ensure that the + # commit SHA of the commit the tag points to is returned, even in + # the case of annotated tags. + # + # We deliberately avoid the "^{commit}" syntax itself as on some + # platforms (cygwin/msys to be specific), the braces are interpreted + # as special characters and would require escaping, while on others + # they should not be escaped. + args += ["rev-parse", rev + "^0"] return self.run(*args)