-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Added check for Windows environment so that we can fix paths #161
Conversation
+1 to be integrated soon for msysgit users! |
@@ -42,7 +42,12 @@ if [ "$DEBUG" = "yes" ]; then | |||
set -x | |||
fi | |||
|
|||
export GITFLOW_DIR=$(dirname "$0") | |||
if [ -n "$MSYSTEM" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't detect my system being Windows. That might be because I, when installed MsysGit, chose to only use Windows Command Prompt, and not using the "normal" git bash. So if there is another way of detecting Windows, that detects Windows in both situations, that would probably be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly does the $MSYSTEM
variable come from here? Is it guaranteed to be set inside all MsysGit shells? Is this documented behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...because I agree with @NiklasHansen's comment on this one.
OK - didn't realise it was occurring in all shells - I've changed the check to look at the OS environment variable instead - let me know if that fixes the problem. |
Your latest commit seems to work for me @mhart, on both the normal Windows cmd and on Git Bash. Thanks! |
Is the |
It's available in Git Bash - shows up as "MINGW32_NT-6.1 etc, etc" for me - not sure about other environments |
Happy to change to 'uname | grep -c ^MINGW' (checking $OSTYPE would be the other portable option) - do we need to consider Cygwin, etc though? |
Ah, sorry @dvide - didn't see your comment. |
Yeah, the problem is that the msysgit installer adds |
Tested commit Also |
Considering that you can't create a file with a backslash in the name on Windows anyway (even Cygwin won't deal with it: http://www.cygwin.com/cygwin-ug-net/using-specialnames.html), it should be fine... no? |
@mhart Are you allowed backslashes in names on normal non-cygwin unix? If so, I think it's probably best to keep the windows OS detection then. |
Yeah - I wasn't suggesting getting rid of the detection - just that the slash replace should work on any Windows shell regardless, without messing with filenames any more so than the shell itself would. |
@mhart That's correct yes. Sorry for the confusion. I was the one suggesting to get rid of the detection, but I didn't realize you could have backslashes in names on other OSes so scratch that. But you're right that on Cygwin, even with your new code it doesn't cause any issues there anyway, so that's nice to know. |
Just cleaned up the check/replace - @dvide, let me know if that still works for you |
@mhart, Tested Though if I edit Not sure if that was intended, but like I say, it still seems to work for me anyway. |
If we can safely find a way that works on all platforms, I'm fine to avoid the OS-detection and just always replace backslashes as Unix users are unlikely to run into troubles with this, and at the same time we're helping out all Windows users. Please take a look a my proposal here: develop...feature/convert-slashes Will this do the trick for all of you? If it works, it has the best of a few advantages:
|
Hi @nvie, your proposal
It must be the space in the path the produces two arguments to dirname. That's why the quote marks are where they are in |
Hi @dvide, I've updated my patch. Can you test it again? |
@nvie That works fine yeah. Tested it again on all three. |
OK, then I'm closing this issue and go for the proposed solution. Thanks for your patience, all ;) |
After a recent installation of msysGit (Git-1.7.7-preview20111014.exe), I've found that the path seems to be getting mangled when invoking git-flow, and the following error occurs:
This turns out to be because the
GITFLOW_DIR
variable is created by usingdirname $0
and$0
in this case happens to be a Windows path with backslashes, and so the command just returns '.' instead of the actual path to Git.This patch checks to see if we're in a Windows environment and if so converts the path accordingly.