nvie / gitflow

Git extensions to provide high-level repository operations for Vincent Driessen's branching model.
http://nvie.com/posts/a-successful-git-branching-model/
Other
26.6k stars 2.66k forks source link

gitflow-shFlags: No such file or directory #6407

Open DarthSonic opened 6 years ago

DarthSonic commented 6 years ago

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 commented 6 years ago

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).

beardeddev commented 6 years ago

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

Slowacki commented 6 years ago

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 commented 6 years ago

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.

kevinglenny commented 6 years ago

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"

philippeowagner commented 2 years ago

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 git@github.com:nvie/shFlags.git
$ cd ..
$ chmod +x gitflow-installer.sh
$ sudo ./gitflow-installer.sh