Skip to content

git command flag parameters seems to perform backwards from spec #171

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

Closed
jwir3 opened this issue Jul 14, 2014 · 2 comments
Closed

git command flag parameters seems to perform backwards from spec #171

jwir3 opened this issue Jul 14, 2014 · 2 comments

Comments

@jwir3
Copy link

jwir3 commented Jul 14, 2014

As per the 0.3.1 documentation:

Using git directly
...
Keyword arguments translate to short and long keyword arguments on the commandline. The special notion git.command(flag=True) will create a flag without value like command --flag.

I have a test repo available at https://github.com/jwir3/git-risk/blob/issue-5/src/test/data/testrepo.zip

When I run the following command via the command line:
git merge-base 6a5c7989 6ff49 c2a881d

I get the following result:
deb5eb357ef6677301b629922279cf2221d4a91d

Which should correspond to the command:
repo.git.merge_base(("6a5c79", "6ff49", "c2a881d"))

However, this GitPython command returns:
88f06c9cf2c3bccf3df73a6c2bcb8a34549ef20f

Which is the equivalent result returned when I perform:
git merge-base 6a5c7989 6ff49 c2a881d --octopus

This should be the same as:
repo.git.merge_base(("6a5c79", "6ff49", "c2a881d"), octopus=True)

Running the above command (with the "octopus=True") results in the commit returned from the command line version without the "--octopus" flag (i.e. commit "deb5eb357ef6677301b629922279cf2221d4a91d"). Thus, it seems to me that the flags that are being passed in when using the git command directly are reversed somewhere along the line before sending it to the git subprocess.

@Byron
Copy link
Member

Byron commented Jul 14, 2014

That's an interesting one indeed.
What do you see when you execute your test with the GIT_PYTHON_TRACE=full environment variable set ? This would show the exact git commands issued under the hood, including their return values.

@jwir3
Copy link
Author

jwir3 commented Jul 16, 2014

Ugh...

My bad. I had an incorrect commit within the merge-base command within my test. Using GIT_PYTHON_TRACE=full showed me that --octopus was actually getting used. It turned out that the test data I have has the reverse of the two commits with --octopus and without it if I use a different third hash.

Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants