Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alter rev-parse syntax to support msys git #69

Merged
merged 1 commit into from
Aug 24, 2020

Conversation

donkopotamus
Copy link
Contributor

@donkopotamus donkopotamus commented Aug 24, 2020

Note:

This PR replaces an existing one as the relevant code had moved

Details

On windows, msys and cygwin versions of git need braces to be escaped when they are invoked via subprocess. (This appears to be an unfortunate side effect of the machinery that converts windows paths to posix-like paths for the executable, and is usually hidden when executing from an msys based shell).

If they are not escaped, then rev^{commit] becomes a meaningless rev^commit to an msys git, resulting in an error.

In contrast, we do not want to escape the braces if passing rev^{commit} to any other form of git. We can avoid having to decide whether escaping is needed by using the alternative notation ^0.

As noted in the rev-parse documentation

A suffix ^ followed by an object type name enclosed in brace pair means dereference the object at <rev> recursively ...
<rev>^0 is a short-hand for <rev>^{commit}.

Pull Request Check List

Resolves: python-poetry/poetry#2667
Replaces: python-poetry/poetry#2668

  • Added tests for changed code. No additional tests should be necessary
  • Updated documentation for changed code. No additional documentation necessary

On windows, msys and cygwin versions of git need braces to be escaped when they
are invoked via subprocess.  (This appears to be is a side effect of the machinery
that converts windows paths to posix-like paths for the executable).

If they are not escaped, then "rev^{commit]" becomes a meaningless "rev^commit"
to an msys git, resulting in an error.

In contrast, we do not want to escape the braces if passing "rev^{commit}" to any
other form of git.  We can avoid having to decide whether escaping is needed by
using the alternative notation "^0".
Copy link
Member

@finswimmer finswimmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your contribution.

LGTM 👍

@finswimmer finswimmer merged commit 306756b into python-poetry:master Aug 24, 2020
@sdispater sdispater mentioned this pull request Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot resolve git branch names using Windows MSYS installations of git
2 participants