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

No output, error, or history rewriting in Windows #36

Closed
JeremyCaney opened this issue Dec 23, 2019 · 3 comments
Closed

No output, error, or history rewriting in Windows #36

JeremyCaney opened this issue Dec 23, 2019 · 3 comments
Labels

Comments

@JeremyCaney
Copy link

I understand other users have gotten git-filter-repo to work on Windows. I've proven unable to, however.

I've modified the git-filter-repo's #! line to point to my Python directory (via Anaconda) and executable (python, not python3 as noted elsewhere). Given that modification, I no longer get an error when executing git filter-repo commands—but neither do I get any output, nor see my git history rewritten. I've tried both --path and --analyze arguments.

I fully realize this isn't much to go on, so you may not be able to provide much direction. Obviously, if I had an error message, that would provide some pointers on what's failing. Are there log files somewhere I might look for to help provide more details?

FWIW: I'm running on:

  • git: v2.16.1
  • git-filter-repo: v2.24.0
  • python: 3.6.1
@newren
Copy link
Owner

newren commented Dec 24, 2019

git 2.16.1 doesn't have the necessary facilities to work with filter-repo; you should be running into this line of code:

  if b'--combined-all-paths' not in output:
    raise SystemExit(_("Error: need a version of git whose diff-tree "
                       "command has the --combined-all-paths option"))

I would assume that any string that it doesn't find a translation for it would just return the original and then output it, but I've not heard of anyone else failing to get any output so I am wondering if something is going awry with translations.

Without access to the system or more messages or something, it'll be hard for me to debug. But I'd start by either removing the call to the '_' function (just remove the underscore) and see if you get an error message, check for any special environment variables, and upgrade your git version to one that is supported once you do get error messages. Hope that helps you at least get started.

@JeremyCaney
Copy link
Author

@newren: Thank you so much for the prompt response and the pointers. I really should have done the due diligence of upgrading each of my distributions before reporting this.

At this point, everything is working perfectly. It's really a remarkable tool. I previously used various calls to git-filter-branch to accomplish this type of functionality, and have run into nearly every issue the Git documentation warns about at one time or another. Thank you so much for creating this!

In the end, there turned out to be three different issues that colluded together to make this a bit harder to troubleshoot. These seem a bit silly now that I've isolated them, but I'm going to leave them here in case they help anyone else reading this in the future:

  1. Microsoft has introduced a "feature" into Windows so that there's a stub of Python built into the operating system that provides a message on how to download Python. This means that nearly any path that ends in e.g. python, python3, or python3.exe will not throw an exception, even if it's not being picked up by the actual Python interpreter.
  2. When executing git-filter-repo—or any call that ends up getting captured by the Python stub—from the normal PowerShell environment, however, the above messages are not displayed. This is why I was getting no error, no response.
  3. I have been unable to get any variation of #! paths to be accepted when called from my PowerShell or git bash environments—even when I'm quite confident that the path format and location are correct. That meant all requests were either failing, or getting intercepted by the Python stub.

When combined together, those three issues meant that I would get an error if I put in an obviously incorrect or malformed path, but wouldn't get an error if I put in a valid path that ended in python or python3—regardless of whether or not it was a correct path. With the first issue resolved, I'm able to see the error yielded from the third issue:

fatal: 'filter-repo' appears to be a git command, but we were not able to execute it. Maybe git-filter-repo is broken?

That said, if I run git-filter-repo from my Anaconda PowerShell Prompt, everything works swimmingly! Indeed, it works right out of the box using your normal distribution without needing to modify the shebang at all, as the Anaconda distribution includes aliases to handle e.g. /usr/bin/env/ python3.

I'm not entirely sure why this won't execute in the normal PowerShell or git bash. Part of the issue is that I don't have Python in my path, as I normally use it from iPython or the Anaconda PowerShell Prompt. That said, it should accept a fully-qualified path pointing to the Python interpreter; I'm not sure what's going on there, but am going to assume PEBCAK.

Thank you again for both your help as well as writing this tool.

@newren
Copy link
Owner

newren commented Dec 26, 2019

I'm glad it's working for you now. Thanks for the kind words, and the explanation of what you found on your end which might just help someone else if they hit something similar and search through the issues for similar keywords.

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

No branches or pull requests

2 participants