-
Notifications
You must be signed in to change notification settings - Fork 67
Error using on Windows #273
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
Comments
Thanks for this issue report @apwojcik and thanks for trying to use StGit on Windows. That's one of us so far! While I've tried to avoid any obvious incompatibilities with Windows and ensure that StGit builds for Windows, I've never even tried running it. I don't have or use Windows, so figuring out and fixing Windows-specific issues will require help from others. To clarify, you are attempting to run a I also note that you are using the head of the master branch. It would be very helpful to know whether the same issue is present in v2.1.0 and/or v2.0.0. My strong suspicion about the root of this are the |
That's correct. I am using |
You are right - the |
The issue described above does not occur in the release version 2.1.0. I found another issue with Windows (version 2.1.0 and newer).
The git exit code is 128. Stacked Git 2.1.0 When there are no conflicts between patches, everything works fine. |
Thanks for the follow-ups on this issue, @apwojcik. It's now somewhere on my todo list to see if there is a way to do the needed path munging without using Note that I strongly prefer approaches that do not grow StGit's dependency tree. Or use any unstable features. |
I'd like to get stgit working on Windows; is there some way I can help? I've recommended it to my coworkers for helping to maintain well-organized PRs, but many of them use Windows, and I don't know of an alternative workflow for them. |
Using gix::path::realpath() provides an alternative means of getting an absolute path, but without adding the extra rigamarole to the front of paths that std::Path::canonicalize() adds on Windows. Refs: #273
Hi @bonsairobo. I appreciate your interest in getting StGit working on Windows and I'm glad to hear it is helpful for your workflow. Happy to have help with getting StGit working on Windows. The main problem with StGit on Windows is that I don't know what the problems are...because I don't use Windows and StGit's test suite is not running on Windows. I've just pushed a fix for the particular problem that this issue identifies. I was able to reproduce the problem and verify the fix using a wine environment. I briefly attempted to run the entire StGit test suite using wine. It was a total hack job, but sufficient to run the test suite. This informed me as follows:
However, it remains a big mystery to me as to whether this wine environment is truly representative of real world Windows environments that StGit may be run from. Would Anyway, the most helpful thing for getting StGit working on Windows would be to enable the test suite to run natively on Windows. If we had that, then bugs could be identified and fixed and it could be incorporated into CI to keep Windows support from regressing as StGit evolves. StGit's test suite is borrowed from Git's test suite. I.e. we use the same makefile structure, helper shell scripts, and test script structure. Ostensibly Git's test suite runs on Windows. So a good exercise would be to clone Git's git repo and attempt to build and test it in a Windows environment. I may have pruned Windows-specific bits from If that sounds like too big of a chunk, I'm also happy to get one-off issue reports for anything not working on Windows. |
@jpgrayson Thanks for the detailed response. I agree that ideally the stgit test suite would be running on native Windows. WINE is a great start though! It looks like there is at least a Windows build CI action that's passing.
It seems like the easiest option would be to use Git Bash, which claims to behave identically to bash on *NIX:
I can give this a try. I'll try running the test suite using Git Bash.
What's the easiest way to recover these bits? Should I just diff your |
I think the next step after Git Bash would be Powershell. That's what most of my coworkers use. I know very little about it though. Hopefully stgit is using enough cross-platform process APIs that there isn't much to fix. |
Well I've come to realize that building git inside of Git Bash for Windows would require that I install gcc somehow. I don't really want to do this, and it's starting to seem out of scope for testing STGit per se. @jpgrayson What's the reason for using Git's test Makefiles? Is it not feasible to get your test coverage by writing Rust integration tests? |
StGit's test suite predates the Rust implementation of StGit. The original implementation was in Python. So one answer is that the makefile/shell-script approach is language agnostic, which is good. Another reason is that there are almost 1200 tests defined across 118 test files. We would need a pretty big incentive to migrate that mass of tests to a different test infrastructure. For these kind of integration/regression tests (i.e. not unit tests), a key aspect of the test is to demonstrate StGit's behaviors in the target environment, so running Rust's test infra could be made to do the same things as the current test infrastructure, but it would be a big effort and I'm not sure that it would directly solve the problems with testing on Windows. Following your link from above to https://gitforwindows.org/ revealed that there is Git for Windows SDK that apparently provides the MSYS2-based environment needed to build Git and run its test suite. I may have a go of trying to install and use that Git for Windows SDK from within Wine and see if it can work as an environment for running StGit's test suite. I appreciate the steps you've taken thus far, @bonsairobo. |
True, but it is not platform agnostic, hence the current predicament with Windows. But I totally get not wanting to rewrite this massive test suite. I wouldn't suggest doing that, so if you can find a way to get these tests running in something resembling a Windows environment with minimal effort, it sounds worthwhile.
Are these tests copied from Git? I.e. these tests are just showing that If so, maybe it's not strictly necessary to port all of these tests to native Windows. I don't know the details of this passthrough logic, but maybe it would be easier to write some new targeted tests of that logic that can run on native Windows.
Cool. That would have been my next step if I wanted to get the unix build tools working in Windows. Wasn't too keen on going through that process last night though. Let me know how it goes! |
I have pushed a bunch of fixes for various issues affecting StGit on Windows. As of 342e5ab, the Windows build of StGit is passing the test suite and included in the CI suite. Here's an enumeration of some of the issues that prevented StGit from working on Windows:
Anyway, StGit now seems to work well enough on Windows with the Git for Windows distribution. Closing. |
Recently
stgit
stopped working on Windows for me.I can initialize the branch with metadata. Then, I can convert existing commits to patches. I can pop them one by one or all at once and push them back. After that, I can convert them to commits, too. Finally, I can create a new patch.
stg undo
works, too. That's it.I cannot anymore
stg refresh
, change the order of patches, push anything when I delete a patch in the middle of the stack, etc. The error I am receiving is most of the time, for example:error: 'git update-index': fatal: not a git repository: '\\?\C:\Repo\.git'
.Stacked Git 2.1.0 (a5e19a6)
git version 2.37.3.windows.1
The Python and early Rust versions were working just fine on Windows. The issues probably started as soon as release 2.0.0 was published.
The text was updated successfully, but these errors were encountered: