diff --git a/contrib/README.md b/contrib/README.md new file mode 100644 index 000000000..290381b55 --- /dev/null +++ b/contrib/README.md @@ -0,0 +1,16 @@ +Installing on Windows +===================== + +1. git clone --recursive https://github.com/DarinMacRae/gitflow.git +2. Open a command prompt with Administrative privilege + (Don't use Powershell) +3. cd into gitflow\contrib +4. ensure that GIT_HOME is pointing to the installation folder of Git + e.g. + set GIT_HOME=C:\Users\\AppData\Local\Programs\Git\cmd + set GIT_HOME=C:\Program Files\Git\usr\bin + +5. Run msysgit-install + +Note, that it works with installations of Git other than MSysGit. + diff --git a/contrib/msysgit-install.cmd b/contrib/msysgit-install.cmd index 5f005bfa7..5b345e48c 100644 --- a/contrib/msysgit-install.cmd +++ b/contrib/msysgit-install.cmd @@ -20,25 +20,25 @@ call :ChkGetopt getopt.exe || set ERR=1 if %ERR%==1 goto :End echo getopt.exe... Found -if not exist "%GIT_HOME%\bin\git-flow" goto :Install -echo GitFlow is already installed.>&2 +if not exist "%GIT_HOME%\git-hf" goto :Install +echo HubFlow is already installed.>&2 set /p mychoice="Do you want to replace it [y/n]" if "%mychoice%"=="y" goto :DeleteOldFiles goto :Abort :DeleteOldFiles echo Deleting old files... -for /F %%i in ("%GIT_HOME%\git-flow*" "%GIT_HOME%\gitflow-*") do if exist "%%~fi" del /F /Q "%%~fi" +for /F %%i in ("%GIT_HOME%\git-hf*" "%GIT_HOME%\git-hf-*" "%GIT_HOME%\hubflow-*") do if exist "%%~fi" del /F /Q "%%~fi" :Install echo Copying files... ::goto :EOF -xcopy "%~dp0\..\git-flow" "%GIT_HOME%\bin" /Y /R /F +xcopy "%~dp0\..\git-hf" "%GIT_HOME%" /Y /R /F if errorlevel 4 if not errorlevel 5 goto :AccessDenied if errorlevel 1 set ERR=1 -xcopy "%~dp0\..\git-flow*" "%GIT_HOME%\bin" /Y /R /F || set ERR=1 -xcopy "%~dp0\..\gitflow-*" "%GIT_HOME%\bin" /Y /R /F || set ERR=1 -xcopy "%~dp0\..\shFlags\src\shflags" "%GIT_HOME%\bin\gitflow-shFlags" /Y /R /F || set ERR=1 +xcopy "%~dp0\..\git-hf*" "%GIT_HOME%" /Y /R /F || set ERR=1 +xcopy "%~dp0\..\hubflow-*" "%GIT_HOME%" /Y /R /F || set ERR=1 +xcopy "%~dp0\..\shFlags\src\shflags" "%GIT_HOME%\hubflow-shFlags" /Y /R /F || set ERR=1 if %ERR%==1 choice /T 30 /C Y /D Y /M "Some unexpected errors happened. Sorry, you'll have to fix them by yourself." diff --git a/git-hf-feature b/git-hf-feature index 03fba4c20..b3f40e327 100644 --- a/git-hf-feature +++ b/git-hf-feature @@ -483,15 +483,15 @@ cmd_checkout() { # # - https://github.com/bmomberger-reciprocity # - https://github.com/jhofmeyr - - # does the feature already exist? - if git_local_branch_exists "$BRANCH" ; then + + # does the feature already exist? + if git_local_branch_exists "$FEATURE_BRANCH" ; then # we have a local branch - use that - hubflow_change_branch "$BRANCH" - elif git_remote_branch_exists "$ORIGIN/$BRANCH" ; then + hubflow_change_branch "$FEATURE_BRANCH" + elif git_remote_branch_exists "$ORIGIN/$FEATURE_BRANCH" ; then # we have a remote branch - create a local feature branch based # on the remote branch - git checkout -b "$BRANCH" --track "$ORIGIN/$BRANCH" + git checkout -b "$FEATURE_BRANCH" --track "$ORIGIN/$FEATURE_BRANCH" else # the user is really trying to start a new feature # diff --git a/hubflow-common b/hubflow-common index cf515ad33..fc0a137e8 100644 --- a/hubflow-common +++ b/hubflow-common @@ -260,6 +260,11 @@ hubflow_change_branch() { } hubflow_branch_push() { + # make sure we have something to push onto the stack + if [[ -z $1 ]] ; then + die "*** internal error: attempt to push empty item onto the stack" + fi + # make sure we have a stack to push onto if [[ -z BRANCH_STACK ]] ; then BRANCH_STACK=() @@ -285,10 +290,11 @@ hubflow_branch_pop() { # make sure the stack is not empty [[ $BRANCH_STACK_SP != 0 ]] || die "Internal error: attempt to pop from empty BRANCH_STACK" - # pop the branch from the stack - local popped_branch=${BRANCH_STACK[$BRANCH_STACK_SP]} - BRANCH_STACK[$BRANCH_STACK_SP]= - let "BRANCH_STACK_SP -= 1" + # pop the branch from the stack + local tmp_branch_sp=$BRANCH_STACK_SP + let "BRANCH_STACK_SP -= 1" + local popped_branch=${BRANCH_STACK[$BRANCH_STACK_SP]} + unset BRANCH_STACK[$tmp_branch_sp] # do we need to switch branch too? hubflow_change_branch "$popped_branch"