gitflow icon indicating copy to clipboard operation
gitflow copied to clipboard

gitflow-shFlags: No such file or directory

Open DarthSonic opened this issue 7 years ago • 6 comments

sh.exe C:\Users\s.moderow\AppData\Local\Atlassian\SourceTree\gitflow_local\gitflow\git-flow feature start gutschein

C:\Users\s.moderow\AppData\Local\Atlassian\SourceTree\gitflow_local\gitflow\git-flow: line 115: /gitflow-shFlags: No such file or directory

Using git-flow under Windows 10. Git-Flow extension for Visual Studio 2017 and Sourcetree installed.

DarthSonic avatar Feb 01 '18 14:02 DarthSonic

Can confirm that this also happens on a second windows 10 client with other user account after installing git-flow the first time (newest available version).

DarthSonic avatar Feb 02 '18 13:02 DarthSonic

same issue for me C:\Program Files\Git\usr\bin\git-flow: line 115: /gitflow-shFlags: No such file or directory

beardeddev avatar Feb 08 '18 13:02 beardeddev

Exact same issue here: C:\Program Files\Git\usr\bin\git-flow: line 115: /gitflow-shFlags: No such file or directory

I've restored the gitflow-shFlags from gitflow repo -> shFlags to the /usr/bin/ folder, but it didn't help at all.

Slowacki avatar Feb 09 '18 11:02 Slowacki

Okay, so I've managed to solve this issue accidentally, however, I have no idea how exactly. I started messing with the gitflow script, trying to verify that all the variables are actually set and that it's looking for the shFlags file in the correct place. I've added an echo just before that line, to check that:

        echo "$GITFLOW_DIR/gitflow-shFlags"
	. "$GITFLOW_DIR/gitflow-shFlags"
	FLAGS_PARENT="git flow"

The output I'd get would actually be "/gitflow-shFlags", which explains why it couldn't find the file, the $GITFLOW_DIR was empty. Then I turned to check where that variable is set. For windows, it should be in line 68 of the gitflow script.

*MINGW*)
	export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

I've added two more echos just to check the value of GITFLOW_DIR right after setting and to check the value of the expression. Then suddenly, gitflow actually worked. Since then I've changed those two echos to output just random strings, and gitflow still works for some reason. If I remove any of them, it returns to the broken state.

So basically, changing the case flow that's present in gitflow script on line 67 to:

*MINGW*)
	export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
	echo "test"
        echo "test"
	pwd () {
		builtin pwd -W
	}
	;;

has actually fixed my gitflow.

That said, I don't really understand why it does work, I also don't understand why it didn't work in the first place. I suspect it might be something related to race conditions. Hopefully, someone proficient in shell can swoop in and explain what's going on.

I'll leave the above comment here until an actual solution is found.

Slowacki avatar Feb 09 '18 13:02 Slowacki

Hi, I had the same problem using SourceTree 2.5.4 on Windows 10.

I had no success with the echo approach.

*MINGW*) export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") echo "test" echo "test" pwd () { builtin pwd -W } ;;

To get it working quickly I took a brute force approach and hardcoded the paths that referenced $GITFLOW_DIR e.g. # . "$GITFLOW_DIR/gitflow-shFlags" . "C:\blah\AppData\Local\Atlassian\SourceTree\gitflow_local\gitflow\gitflow-shFlags"

kevinglenny avatar Apr 26 '18 10:04 kevinglenny

I fixed it using:

$ cd /usr/local 
$ curl -OL https://raw.github.com/nvie/gitflow/develop/contrib/gitflow-installer.sh
$ mkdir -p /usr/local/gitflow 
$ git clone [email protected]:nvie/shFlags.git
$ cd ..
$ chmod +x gitflow-installer.sh
$ sudo ./gitflow-installer.sh

philippeowagner avatar Mar 18 '22 09:03 philippeowagner