Commit 610b6ac1 authored by cmosh's avatar cmosh

Merge branch 'release/0.4.3'

parents 1ffb6b10 9180f569
debian/files
debian/*.substvars
debian/*.debhelper.log
debian/*/*
.timelog
.seconds
.seconds-feature-workingtime
.timelog-feature-workingtime
.seconds-feature-sdsa
.timelog-feature-sdsa
.seconds-feature-finish_fix
.timelog-feature-finish_fix
.seconds-feature-finish_fix
.timelog-feature-finish_fix
.seconds-feature-finish_fix
.timelog-feature-finish_fix
.seconds-feature-interrupt
.timelog-feature-interrupt
.seconds-feature-interrupt_final_test
.timelog-feature-interrupt_final_test
.breaktime-feature-interrupt_final_test
.seconds-feature-interrupt_final_test
.timelog-feature-interrupt_final_test
.breaktime-feature-interrupt_final_test
.seconds-feature-interrupt_final_test
.timelog-feature-interrupt_final_test
.breaktime-feature-interrupt_final_test
.seconds-feature-shortcuts
.timelog-feature-shortcuts
.breaktime-feature-shortcuts
.seconds-feature-test
.timelog-feature-test
.breaktime-feature-test
...@@ -11,5 +11,14 @@ Authors are (ordered by first commit date): ...@@ -11,5 +11,14 @@ Authors are (ordered by first commit date):
- Felipe Talavera - Felipe Talavera
- Guillaume-Jean Herbiet - Guillaume-Jean Herbiet
- Joseph A. Levin - Joseph A. Levin
- Jannis Leidel
- Konstantin Tjuterev
- Kiall Mac Innes
- Jon Bernard
- Olivier Mengué
- Emre Berge Ergenekon
- Eric Holmes
- Vedang Manerikar
- Myke Hines
Portions derived from other open source works are clearly marked. Portions derived from other open source works are clearly marked.
0.4.2:
-----
Release date: **not yet**
* `git flow init` now detects situations where origin already has gitflow
branches set up, and behaves accordingly (thanks Emre Berge Ergenekon).
* `git flow feature finish` can now be called without a feature branch
name(prefix) argument and will finish the current branch, if on any.
* `git flow feature pull` now has a `-r` flag, to support `pull --rebase`
semantics (thanks Vedang Manerikar).
* Various minor bug fixes related to internal argument passing.
* Improved some documentation.
* Better support for Windows and BSD users.
* Add package installer for the Windows platform.
0.4.1: 0.4.1:
----- -----
Release date: **2011/02/04** Release date: **2011/02/04**
...@@ -9,7 +30,7 @@ Release date: **2011/02/04** ...@@ -9,7 +30,7 @@ Release date: **2011/02/04**
* The parsing issues related to git-flow feature's flags are now dealt with on * The parsing issues related to git-flow feature's flags are now dealt with on
all known platforms. (Fixed #54, #62, #86, #97) all known platforms. (Fixed #54, #62, #86, #97)
* Escape queries for detecting branch/tag names. (Fixed #91) * Escape queries for detecting branch/tag names. (Fixed #91)
0.4: 0.4:
...@@ -34,36 +55,36 @@ Release date: **2010/10/18** ...@@ -34,36 +55,36 @@ Release date: **2010/10/18**
---- ----
Release date: **2010/07/22** Release date: **2010/07/22**
* New subcommands for `git flow feature`: * New subcommands for `git flow feature`:
- **checkout**: - **checkout**:
For easily checking out features by their short name. Even allows For easily checking out features by their short name. Even allows
unique prefixes as arguments (see below). unique prefixes as arguments (see below).
- **pull**: - **pull**:
This subcommand allows you to painlessly work on a feature branch This subcommand allows you to painlessly work on a feature branch
together with another peer. This is especially valuable for doing together with another peer. This is especially valuable for doing
peer reviews of other people's code. For more detailed info, see the peer reviews of other people's code. For more detailed info, see the
[commit log][1]. [commit log][1].
* Easier addressing of branch names by using name prefixes. * Easier addressing of branch names by using name prefixes.
For example, when using: For example, when using:
git flow feature finish fo git flow feature finish fo
this automatically finishes the feature branch `foobar` if that's the only this automatically finishes the feature branch `foobar` if that's the only
feature branch name starting with `fo`. feature branch name starting with `fo`.
* No force flag anymore for new feature branches * No force flag anymore for new feature branches
`git flow feature start` lost its `-f` (force) flag. You now don't `git flow feature start` lost its `-f` (force) flag. You now don't
have to be in a clean repo anymore to start a new feature branch. This have to be in a clean repo anymore to start a new feature branch. This
avoids the manual `git stash`, `git flow feature start`, `git stash avoids the manual `git stash`, `git flow feature start`, `git stash
pop` cycle. pop` cycle.
* You can use `git-flow` in stand-alone repo's now. * You can use `git-flow` in stand-alone repo's now.
This means it does not assume you have an `origin` repository. This means it does not assume you have an `origin` repository.
(Thanks [Mark][2].) (Thanks [Mark][2].)
* No commands fetch from `origin` by default anymore. * No commands fetch from `origin` by default anymore.
There were some issues related to disabling this flag on some platforms. There were some issues related to disabling this flag on some platforms.
* Init guesses branch names you may want to use for `develop` and `master`. * Init guesses branch names you may want to use for `develop` and `master`.
......
# #
# Copyright 2010 Vincent Driessen. All rights reserved. # Copyright 2010 Vincent Driessen. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
# #
# 1. Redistributions of source code must retain the above copyright notice, # 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. # this list of conditions and the following disclaimer.
# #
# 2. Redistributions in binary form must reproduce the above copyright # 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the # notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution. # documentation and/or other materials provided with the distribution.
# #
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR # THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, # EVENT SHALL VINCENT DRIESSEN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
# The views and conclusions contained in the software and documentation are # The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official # those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen. # policies, either expressed or implied, of Vincent Driessen.
# #
prefix=/usr/local
prefix=/usr/local
# files that need mode 755
EXEC_FILES=git-flow # files that need mode 755
EXEC_FILES=git-flow
# files that need mode 644
SCRIPT_FILES =git-flow-init # files that need mode 644
SCRIPT_FILES+=git-flow-feature SCRIPT_FILES =git-flow-init
SCRIPT_FILES+=git-flow-hotfix SCRIPT_FILES+=git-flow-feature
SCRIPT_FILES+=git-flow-release SCRIPT_FILES+=git-flow-hotfix
SCRIPT_FILES+=git-flow-support SCRIPT_FILES+=git-flow-release
SCRIPT_FILES+=git-flow-version SCRIPT_FILES+=git-flow-support
SCRIPT_FILES+=gitflow-common SCRIPT_FILES+=git-flow-version
SCRIPT_FILES+=gitflow-shFlags SCRIPT_FILES+=gitflow-common
SCRIPT_FILES+=gitflow-shFlags
all:
@echo "usage: make install" all:
@echo " make uninstall" @echo "usage: make install"
@echo " make uninstall"
install:
@test -f gitflow-shFlags || (echo "Run 'git submodule init && git submodule update' first." ; exit 1 ) install:
install -d -m 0755 $(prefix)/bin @test -f gitflow-shFlags || (echo "Run 'git submodule init && git submodule update' first." ; exit 1 )
install -m 0755 $(EXEC_FILES) $(prefix)/bin install -d -m 0755 $(prefix)/bin
install -m 0644 $(SCRIPT_FILES) $(prefix)/bin install -m 0755 $(EXEC_FILES) $(prefix)/bin
install -m 0644 $(SCRIPT_FILES) $(prefix)/bin
uninstall:
test -d $(prefix)/bin && \ uninstall:
cd $(prefix)/bin && \ test -d $(prefix)/bin && \
rm -f $(EXEC_FILES) $(SCRIPT_FILES) cd $(prefix)/bin && \
rm -f $(EXEC_FILES) $(SCRIPT_FILES)
This diff is collapsed.
#!/bin/sh #!/bin/bash
# git-flow make-less installer for *nix systems, by Rick Osborne # git-flow make-less installer for *nix systems, by Rick Osborne
# Based on the git-flow core Makefile: # Based on the git-flow core Makefile:
# http://github.com/nvie/gitflow/blob/master/Makefile # http://github.com/nvie/gitflow/blob/master/Makefile
# Licensed under the same restrictions as git-flow: # Licensed under the same restrictions as git-flow:
# http://github.com/nvie/gitflow/blob/develop/LICENSE # http://github.com/nvie/gitflow/blob/develop/LICENSE
# Does this need to be smarter for each host OS? # Does this need to be smarter for each host OS?
if [ -z "$INSTALL_PREFIX" ] ; then if [ -z "$INSTALL_PREFIX" ] ; then
INSTALL_PREFIX="/usr/local/bin" INSTALL_PREFIX="/usr/local/bin"
fi fi
if [ -z "$REPO_NAME" ] ; then if [ -z "$REPO_NAME" ] ; then
REPO_NAME="gitflow" REPO_NAME="gitflow"
fi fi
if [ -z "$REPO_HOME" ] ; then if [ -z "$REPO_HOME" ] ; then
REPO_HOME="http://github.com/nvie/gitflow.git" REPO_HOME="http://github.com/nvie/gitflow.git"
fi fi
EXEC_FILES="git-flow" EXEC_FILES="git-flow"
SCRIPT_FILES="git-flow-init git-flow-feature git-flow-hotfix git-flow-release git-flow-support git-flow-version gitflow-common gitflow-shFlags" SCRIPT_FILES="git-flow-init git-flow-feature git-flow-hotfix git-flow-release git-flow-support git-flow-version gitflow-common gitflow-shFlags"
SUBMODULE_FILE="gitflow-shFlags" SUBMODULE_FILE="gitflow-shFlags"
echo "### gitflow no-make installer ###" echo "### gitflow no-make installer ###"
case "$1" in case "$1" in
uninstall) uninstall)
echo "Uninstalling git-flow from $INSTALL_PREFIX" echo "Uninstalling git-flow from $INSTALL_PREFIX"
if [ -d "$INSTALL_PREFIX" ] ; then if [ -d "$INSTALL_PREFIX" ] ; then
for script_file in $SCRIPT_FILES $EXEC_FILES ; do for script_file in $SCRIPT_FILES $EXEC_FILES ; do
echo "rm -vf $INSTALL_PREFIX/$script_file" echo "rm -vf $INSTALL_PREFIX/$script_file"
rm -vf "$INSTALL_PREFIX/$script_file" rm -vf "$INSTALL_PREFIX/$script_file"
done done
else else
echo "The '$INSTALL_PREFIX' directory was not found." echo "The '$INSTALL_PREFIX' directory was not found."
echo "Do you need to set INSTALL_PREFIX ?" echo "Do you need to set INSTALL_PREFIX ?"
fi fi
exit exit
;; ;;
help) help)
echo "Usage: [environment] gitflow-installer.sh [install|uninstall]" echo "Usage: [environment] gitflow-installer.sh [install|uninstall]"
echo "Environment:" echo "Environment:"
echo " INSTALL_PREFIX=$INSTALL_PREFIX" echo " INSTALL_PREFIX=$INSTALL_PREFIX"
echo " REPO_HOME=$REPO_HOME" echo " REPO_HOME=$REPO_HOME"
echo " REPO_NAME=$REPO_NAME" echo " REPO_NAME=$REPO_NAME"
exit exit
;; ;;
*) *)
echo "Installing git-flow to $INSTALL_PREFIX" echo "Installing git-flow to $INSTALL_PREFIX"
if [[ -d "$REPO_NAME" && -d "$REPO_NAME/.git" ]] ; then if [ -d "$REPO_NAME" -a -d "$REPO_NAME/.git" ] ; then
echo "Using existing repo: $REPO_NAME" echo "Using existing repo: $REPO_NAME"
else else
echo "Cloning repo from GitHub to $REPO_NAME" echo "Cloning repo from GitHub to $REPO_NAME"
git clone "$REPO_HOME" "$REPO_NAME" git clone "$REPO_HOME" "$REPO_NAME"
fi fi
if [ -f "$REPO_NAME/$SUBMODULE_FILE" ] ; then if [ -f "$REPO_NAME/$SUBMODULE_FILE" ] ; then
echo "Submodules look up to date" echo "Submodules look up to date"
else else
echo "Updating submodules" echo "Updating submodules"
lastcwd=$PWD lastcwd=$PWD
cd "$REPO_NAME" cd "$REPO_NAME"
git submodule init git submodule init
git submodule update git submodule update
cd "$lastcwd" cd "$lastcwd"
fi fi
install -v -d -m 0755 "$INSTALL_PREFIX" install -v -d -m 0755 "$INSTALL_PREFIX"
for exec_file in $EXEC_FILES ; do for exec_file in $EXEC_FILES ; do
install -v -m 0755 "$REPO_NAME/$exec_file" "$INSTALL_PREFIX" install -v -m 0755 "$REPO_NAME/$exec_file" "$INSTALL_PREFIX"
done done
for script_file in $SCRIPT_FILES ; do for script_file in $SCRIPT_FILES ; do
install -v -m 0644 "$REPO_NAME/$script_file" "$INSTALL_PREFIX" install -v -m 0644 "$REPO_NAME/$script_file" "$INSTALL_PREFIX"
done done
exit exit
;; ;;
esac esac
@echo off
setlocal
if not "%~1"=="" set GIT_HOME=%~f1
if "%GIT_HOME%"=="" call :FindGitHome "git.cmd"
if exist "%GIT_HOME%" goto :GitHomeOK
echo MsysGit installation directory not found.>&2
echo Try to give the directory name on the command line:>&2
echo %0 "%ProgramFiles%\Git"
endlocal
exit /B 1
:GitHomeOK
set ERR=0
echo Installing gitflow into "%GIT_HOME%"...
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
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"
:Install
echo Copying files...
::goto :EOF
xcopy "%~dp0\..\git-flow" "%GIT_HOME%\bin" /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
if %ERR%==1 choice /T 30 /C Y /D Y /M "Some unexpected errors happened. Sorry, you'll have to fix them by yourself."
:End
endlocal & exit /B %ERR%
goto :EOF
:AccessDenied
set ERR=1
echo.
echo You should run this script with "Full Administrator" rights:>&2
echo - Right-click with Shift on the script from the Explorer>&2
echo - Select "Run as administrator">&2
choice /T 30 /C YN /D Y /N >nul
goto :End
:Abort
echo Installation canceled.>&2
set ERR=1
goto :End
:ChkGetopt
:: %1 is getopt.exe
if exist "%GIT_HOME%\bin\%1" goto :EOF
if exist "%USERPROFILE%\bin\%1" goto :EOF
if exist "%~f$PATH:1" goto :EOF
echo %GIT_HOME%\bin\%1 not found.>&2
echo You have to install this file manually. See the GitFlow README.
exit /B 1
:FindGitHome
setlocal
set GIT_CMD_DIR=%~dp$PATH:1
if "%GIT_CMD_DIR%"=="" endlocal & goto :EOF
endlocal & set GIT_HOME=%GIT_CMD_DIR:~0,-5%
goto :EOF
...@@ -10,17 +10,17 @@ ...@@ -10,17 +10,17 @@
# http://github.com/nvie/gitflow # http://github.com/nvie/gitflow
# #
# Copyright 2010 Vincent Driessen. All rights reserved. # Copyright 2010 Vincent Driessen. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
# #
# 1. Redistributions of source code must retain the above copyright notice, # 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. # this list of conditions and the following disclaimer.
# #
# 2. Redistributions in binary form must reproduce the above copyright # 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the # notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution. # documentation and/or other materials provided with the distribution.
# #
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR # THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
...@@ -31,18 +31,23 @@ ...@@ -31,18 +31,23 @@
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
# The views and conclusions contained in the software and documentation are # The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official # those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen. # policies, either expressed or implied, of Vincent Driessen.
# #
# set this to workaround expr problems in shFlags on freebsd
if uname -s | egrep -iq 'bsd'; then export EXPR_COMPAT=1; fi
# enable debug mode # enable debug mode
if [ "$DEBUG" = "yes" ]; then if [ "$DEBUG" = "yes" ]; then
set -x set -x
fi fi
export GITFLOW_DIR=$(dirname "$0") # The sed expression here replaces all backslashes by forward slashes.
# This helps our Windows users, while not bothering our Unix users.
export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
usage() { usage() {
echo "usage: git flow <subcommand>" echo "usage: git flow <subcommand>"
...@@ -75,6 +80,11 @@ main() { ...@@ -75,6 +80,11 @@ main() {
# use the shFlags project to parse the command line arguments # use the shFlags project to parse the command line arguments
. "$GITFLOW_DIR/gitflow-shFlags" . "$GITFLOW_DIR/gitflow-shFlags"
FLAGS_PARENT="git flow" FLAGS_PARENT="git flow"
# allow user to request git action logging
DEFINE_boolean show_commands false 'show actions taken (git commands)' g
# do actual parsing
FLAGS "$@" || exit $? FLAGS "$@" || exit $?
eval set -- "${FLAGS_ARGV}" eval set -- "${FLAGS_ARGV}"
...@@ -94,7 +104,7 @@ main() { ...@@ -94,7 +104,7 @@ main() {
# in that case, we interpret this arg as a flag for the default # in that case, we interpret this arg as a flag for the default
# command # command
SUBACTION="default" SUBACTION="default"
if [ "$1" != "" ] && ! echo "$1" | grep -q "^-"; then if [ "$1" != "" ] && { ! echo "$1" | grep -q "^-"; } then
SUBACTION="$1"; shift SUBACTION="$1"; shift
fi fi
if ! type "cmd_$SUBACTION" >/dev/null 2>&1; then if ! type "cmd_$SUBACTION" >/dev/null 2>&1; then
...@@ -104,7 +114,10 @@ main() { ...@@ -104,7 +114,10 @@ main() {
fi fi
# run the specified action # run the specified action
cmd_$SUBACTION "$@" if [ $SUBACTION != "help" ] && [ $SUBCOMMAND != "init" ] ; then
init
fi
cmd_$SUBACTION "$@"
} }
main "$@" main "$@"
This diff is collapsed.
...@@ -9,17 +9,17 @@ ...@@ -9,17 +9,17 @@
# http://github.com/nvie/gitflow # http://github.com/nvie/gitflow
# #
# Copyright 2010 Vincent Driessen. All rights reserved. # Copyright 2010 Vincent Driessen. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
# #
# 1. Redistributions of source code must retain the above copyright notice, # 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. # this list of conditions and the following disclaimer.
# #
# 2. Redistributions in binary form must reproduce the above copyright # 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the # notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution. # documentation and/or other materials provided with the distribution.
# #
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR # THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
...@@ -30,22 +30,26 @@ ...@@ -30,22 +30,26 @@
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
# The views and conclusions contained in the software and documentation are # The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official # those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen. # policies, either expressed or implied, of Vincent Driessen.
# #
require_git_repo init() {
require_gitflow_initialized require_git_repo
gitflow_load_settings require_gitflow_initialized
VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`") gitflow_load_settings
PREFIX=$(git config --get gitflow.prefix.hotfix) VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`")
PREFIX=$(git config --get gitflow.prefix.hotfix)
}
usage() { usage() {
echo "usage: git flow hotfix [list] [-v]" echo "usage: git flow hotfix [list] [-v]"
echo " git flow hotfix start [-F] <version> [<base>]" echo " git flow hotfix start [-F] <version> [<base>]"
echo " git flow hotfix finish [-Fsumpk] <version>" echo " git flow hotfix finish [-Fsumpk] <version>"
echo " git flow hotfix publish <version>"
echo " git flow hotfix track <version>"
} }
cmd_default() { cmd_default() {
...@@ -165,14 +169,14 @@ cmd_start() { ...@@ -165,14 +169,14 @@ cmd_start() {
require_branch_absent "$BRANCH" require_branch_absent "$BRANCH"
require_tag_absent "$VERSION_PREFIX$VERSION" require_tag_absent "$VERSION_PREFIX$VERSION"
if flag fetch; then if flag fetch; then
git fetch -q "$ORIGIN" "$MASTER_BRANCH" git_do fetch -q "$ORIGIN" "$MASTER_BRANCH"
fi fi
if has "$ORIGIN/$MASTER_BRANCH" "$(git_remote_branches)"; then if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH" require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi fi
# create branch # create branch
git checkout -b "$BRANCH" "$BASE" git_do checkout -b "$BRANCH" "$BASE"
echo echo
echo "Summary of actions:" echo "Summary of actions:"
...@@ -188,11 +192,59 @@ cmd_start() { ...@@ -188,11 +192,59 @@ cmd_start() {
echo echo
} }
cmd_publish() {
parse_args "$@"
require_version_arg
# sanity checks
require_clean_working_tree
require_branch "$BRANCH"
git_do fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH"
# create remote branch
git_do push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git_do fetch -q "$ORIGIN"
# configure remote tracking
git config "branch.$BRANCH.remote" "$ORIGIN"
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git_do checkout "$BRANCH"
echo
echo "Summary of actions:"
echo "- A new remote branch '$BRANCH' was created"
echo "- The local branch '$BRANCH' was configured to track the remote branch"
echo "- You are now on branch '$BRANCH'"
echo
}
cmd_track() {
parse_args "$@"
require_version_arg
# sanity checks
require_clean_working_tree
require_branch_absent "$BRANCH"
git_do fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
git_do checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo
echo "Summary of actions:"
echo "- A new remote tracking branch '$BRANCH' was created"
echo "- You are now on branch '$BRANCH'"
echo
}
cmd_finish() { cmd_finish() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
DEFINE_boolean sign false "sign the release tag cryptographically" s DEFINE_boolean sign false "sign the release tag cryptographically" s
DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
DEFINE_string message "" "use the given tag message" m DEFINE_string message "" "use the given tag message" m
DEFINE_string messagefile "" "use the contents of the given file as tag message" f
DEFINE_boolean push false "push to $ORIGIN after performing finish" p DEFINE_boolean push false "push to $ORIGIN after performing finish" p
DEFINE_boolean keep false "keep branch after performing finish" k DEFINE_boolean keep false "keep branch after performing finish" k
DEFINE_boolean notag false "don't tag this release" n DEFINE_boolean notag false "don't tag this release" n
...@@ -208,15 +260,15 @@ cmd_finish() { ...@@ -208,15 +260,15 @@ cmd_finish() {
require_branch "$BRANCH" require_branch "$BRANCH"
require_clean_working_tree require_clean_working_tree
if flag fetch; then if flag fetch; then
git fetch -q "$ORIGIN" "$MASTER_BRANCH" || \ git_do fetch -q "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not fetch $MASTER_BRANCH from $ORIGIN." die "Could not fetch $MASTER_BRANCH from $ORIGIN."
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \ git_do fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN." die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi fi
if has "$ORIGIN/$MASTER_BRANCH" "$(git_remote_branches)"; then if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH" require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi fi
if has "$ORIGIN/$DEVELOP_BRANCH" "$(git_remote_branches)"; then if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH" require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi fi
...@@ -224,9 +276,9 @@ cmd_finish() { ...@@ -224,9 +276,9 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed, # in case a previous attempt to finish this release branch has failed,
# but the merge into master was successful, we skip it now # but the merge into master was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
git checkout "$MASTER_BRANCH" || \ git_do checkout "$MASTER_BRANCH" || \
die "Could not check out $MASTER_BRANCH." die "Could not check out $MASTER_BRANCH."
git merge --no-ff "$BRANCH" || \ git_do merge --no-ff "$BRANCH" || \
die "There were merge conflicts." die "There were merge conflicts."
# TODO: What do we do now? # TODO: What do we do now?
fi fi
...@@ -241,7 +293,8 @@ cmd_finish() { ...@@ -241,7 +293,8 @@ cmd_finish() {
flag sign && opts="$opts -s" flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'" [ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'" [ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
git tag $opts "$VERSION_PREFIX$VERSION" || \ [ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git_do tag $opts "$VERSION_PREFIX$VERSION" "$BRANCH" || \
die "Tagging failed. Please run finish again to retry." die "Tagging failed. Please run finish again to retry."
fi fi
fi fi
...@@ -250,28 +303,28 @@ cmd_finish() { ...@@ -250,28 +303,28 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed, # in case a previous attempt to finish this release branch has failed,
# but the merge into develop was successful, we skip it now # but the merge into develop was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
git checkout "$DEVELOP_BRANCH" || \ git_do checkout "$DEVELOP_BRANCH" || \
die "Could not check out $DEVELOP_BRANCH." die "Could not check out $DEVELOP_BRANCH."
# TODO: Actually, accounting for 'git describe' pays, so we should # TODO: Actually, accounting for 'git describe' pays, so we should
# ideally git merge --no-ff $tagname here, instead! # ideally git merge --no-ff $tagname here, instead!
git merge --no-ff "$BRANCH" || \ git_do merge --no-ff "$BRANCH" || \
die "There were merge conflicts." die "There were merge conflicts."
# TODO: What do we do now? # TODO: What do we do now?
fi fi
# delete branch # delete branch
if noflag keep; then if noflag keep; then
git branch -d "$BRANCH" git_do branch -d "$BRANCH"
fi fi
if flag push; then if flag push; then
git push "$ORIGIN" "$DEVELOP_BRANCH" || \ git_do push "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not push to $DEVELOP_BRANCH from $ORIGIN." die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
git push "$ORIGIN" "$MASTER_BRANCH" || \ git_do push "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not push to $MASTER_BRANCH from $ORIGIN." die "Could not push to $MASTER_BRANCH from $ORIGIN."
if noflag notag; then if noflag notag; then
git push --tags "$ORIGIN" || \ git_do push --tags "$ORIGIN" || \
die "Could not push tags to $ORIGIN." die "Could not push tags to $ORIGIN."
fi fi
fi fi
......
...@@ -9,17 +9,17 @@ ...@@ -9,17 +9,17 @@
# http://github.com/nvie/gitflow # http://github.com/nvie/gitflow
# #
# Copyright 2010 Vincent Driessen. All rights reserved. # Copyright 2010 Vincent Driessen. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
# #
# 1. Redistributions of source code must retain the above copyright notice, # 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. # this list of conditions and the following disclaimer.
# #
# 2. Redistributions in binary form must reproduce the above copyright # 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the # notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution. # documentation and/or other materials provided with the distribution.
# #
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR # THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
# The views and conclusions contained in the software and documentation are # The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official # those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen. # policies, either expressed or implied, of Vincent Driessen.
...@@ -51,9 +51,11 @@ cmd_default() { ...@@ -51,9 +51,11 @@ cmd_default() {
DEFINE_boolean force false 'force setting of gitflow branches, even if already configured' f DEFINE_boolean force false 'force setting of gitflow branches, even if already configured' f
DEFINE_boolean defaults false 'use default branch naming conventions' d DEFINE_boolean defaults false 'use default branch naming conventions' d
parse_args "$@" parse_args "$@"
if ! git rev-parse --git-dir >/dev/null 2>&1; then if ! git rev-parse --git-dir >/dev/null 2>&1; then
git init git_do init
else else
# assure that we are not working in a repo with local changes # assure that we are not working in a repo with local changes
git_repo_is_headless || require_clean_working_tree git_repo_is_headless || require_clean_working_tree
...@@ -106,7 +108,7 @@ cmd_default() { ...@@ -106,7 +108,7 @@ cmd_default() {
fi fi
done done
fi fi
printf "Branch name for production releases: [$default_suggestion] " printf "Branch name for production releases: [$default_suggestion] "
if noflag defaults; then if noflag defaults; then
read answer read answer
...@@ -117,12 +119,18 @@ cmd_default() { ...@@ -117,12 +119,18 @@ cmd_default() {
# check existence in case of an already existing repo # check existence in case of an already existing repo
if [ "$should_check_existence" = "YES" ]; then if [ "$should_check_existence" = "YES" ]; then
git_local_branch_exists "$master_branch" || \ # if no local branch exists and a remote branch of the same
# name exists, checkout that branch and use it for master
if ! git_local_branch_exists "$master_branch" && \
git_remote_branch_exists "origin/$master_branch"; then
git_do branch "$master_branch" "origin/$master_branch" >/dev/null 2>&1
elif ! git_local_branch_exists "$master_branch"; then
die "Local branch '$master_branch' does not exist." die "Local branch '$master_branch' does not exist."
fi
fi fi
# store the name of the master branch # store the name of the master branch
git config gitflow.branch.master "$master_branch" git_do config gitflow.branch.master "$master_branch"
fi fi
# add a develop branch if no such branch exists yet # add a develop branch if no such branch exists yet
...@@ -147,11 +155,17 @@ cmd_default() { ...@@ -147,11 +155,17 @@ cmd_default() {
default_suggestion= default_suggestion=
for guess in $(git config --get gitflow.branch.develop) \ for guess in $(git config --get gitflow.branch.develop) \
'develop' 'int' 'integration' 'master'; do 'develop' 'int' 'integration' 'master'; do
if git_local_branch_exists "$guess"; then if git_local_branch_exists "$guess" && [ "$guess" != "$master_branch" ]; then
default_suggestion="$guess" default_suggestion="$guess"
break break
fi fi
done done
if [ -z $default_suggestion ]; then
should_check_existence=NO
default_suggestion=$(git config --get gitflow.branch.develop || echo develop)
fi
fi fi
printf "Branch name for \"next release\" development: [$default_suggestion] " printf "Branch name for \"next release\" development: [$default_suggestion] "
...@@ -173,7 +187,7 @@ cmd_default() { ...@@ -173,7 +187,7 @@ cmd_default() {
fi fi
# store the name of the develop branch # store the name of the develop branch
git config gitflow.branch.develop "$develop_branch" git_do config gitflow.branch.develop "$develop_branch"
fi fi
# Creation of HEAD # Creation of HEAD
...@@ -182,8 +196,8 @@ cmd_default() { ...@@ -182,8 +196,8 @@ cmd_default() {
# it to be able to create new branches. # it to be able to create new branches.
local created_gitflow_branch=0 local created_gitflow_branch=0
if ! git rev-parse --quiet --verify HEAD >/dev/null 2>&1; then if ! git rev-parse --quiet --verify HEAD >/dev/null 2>&1; then
git symbolic-ref HEAD "refs/heads/$master_branch" git_do symbolic-ref HEAD "refs/heads/$master_branch"
git commit --allow-empty --quiet -m "Initial commit" git_do commit --allow-empty --quiet -m "Initial commit"
created_gitflow_branch=1 created_gitflow_branch=1
fi fi
...@@ -200,7 +214,11 @@ cmd_default() { ...@@ -200,7 +214,11 @@ cmd_default() {
# default production branch and develop was "created". We should create # default production branch and develop was "created". We should create
# the develop branch now in that case (we base it on master, of course) # the develop branch now in that case (we base it on master, of course)
if ! git_local_branch_exists "$develop_branch"; then if ! git_local_branch_exists "$develop_branch"; then
git branch --no-track "$develop_branch" "$master_branch" if git_remote_branch_exists "origin/$develop_branch"; then
git_do branch "$develop_branch" "origin/$develop_branch" >/dev/null 2>&1
else
git_do branch --no-track "$develop_branch" "$master_branch"
fi
created_gitflow_branch=1 created_gitflow_branch=1
fi fi
...@@ -209,20 +227,31 @@ cmd_default() { ...@@ -209,20 +227,31 @@ cmd_default() {
# switch to develop branch if its newly created # switch to develop branch if its newly created
if [ $created_gitflow_branch -eq 1 ]; then if [ $created_gitflow_branch -eq 1 ]; then
git checkout -q "$develop_branch" git_do checkout -q "$develop_branch"
fi fi
# finally, ask the user for naming conventions (branch and tag prefixes) # finally, ask the user for naming conventions (branch and tag prefixes)
if flag force || \ if flag force || \
! git config --get gitflow.prefix.feature >/dev/null 2>&1 || ! git config --get gitflow.prefix.feature >/dev/null 2>&1 ||
! git config --get gitflow.prefix.release >/dev/null 2>&1 || ! git config --get gitflow.prefix.release >/dev/null 2>&1 ||
! git config --get gitflow.prefix.hotfix >/dev/null 2>&1 || ! git config --get gitflow.prefix.hotfix >/dev/null 2>&1 ||
! git config --get gitflow.prefix.support >/dev/null 2>&1 || ! git config --get gitflow.prefix.support >/dev/null 2>&1 ||
! git config --get gitflow.prefix.versiontag >/dev/null 2>&1; then ! git config --get gitflow.prefix.versiontag >/dev/null 2>&1; then
echo echo
echo "How to name your supporting branch prefixes?" echo "How to name your supporting branch prefixes?"
fi fi
git config --global alias.start 'flow feature start'
git config --global alias.finish 'flow feature finish'
git config --global alias.fin 'flow feature finish'
git config --global alias.stop 'flow feature finish'
git config --global alias.resume 'flow feature resume'
git config --global alias.res 'flow feature resume'
git config --global alias.interrupt 'flow feature interrupt'
git config --global alias.int 'flow feature interrupt'
git config --global alias.pause 'flow feature pause'
git config --global alias.p 'flow feature pause'
local prefix local prefix
# Feature branches # Feature branches
...@@ -235,7 +264,7 @@ cmd_default() { ...@@ -235,7 +264,7 @@ cmd_default() {
printf "\n" printf "\n"
fi fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion} [ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.feature "$prefix" git_do config gitflow.prefix.feature "$prefix"
fi fi
# Release branches # Release branches
...@@ -248,7 +277,7 @@ cmd_default() { ...@@ -248,7 +277,7 @@ cmd_default() {
printf "\n" printf "\n"
fi fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion} [ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.release "$prefix" git_do config gitflow.prefix.release "$prefix"
fi fi
...@@ -262,7 +291,7 @@ cmd_default() { ...@@ -262,7 +291,7 @@ cmd_default() {
printf "\n" printf "\n"
fi fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion} [ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.hotfix "$prefix" git_do config gitflow.prefix.hotfix "$prefix"
fi fi
...@@ -276,7 +305,7 @@ cmd_default() { ...@@ -276,7 +305,7 @@ cmd_default() {
printf "\n" printf "\n"
fi fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion} [ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.support "$prefix" git_do config gitflow.prefix.support "$prefix"
fi fi
...@@ -290,8 +319,13 @@ cmd_default() { ...@@ -290,8 +319,13 @@ cmd_default() {
printf "\n" printf "\n"
fi fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion} [ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.versiontag "$prefix" git_do config gitflow.prefix.versiontag "$prefix"
fi fi
mkdir -p "./.git/.gitflow"
git checkout --orphan flopharn
git rm * --quiet --ignore-unmatch
git commit --allow-empty -m "flopharn was created successfully"
git checkout $develop_branch
# TODO: what to do with origin? # TODO: what to do with origin?
......
...@@ -9,17 +9,17 @@ ...@@ -9,17 +9,17 @@
# http://github.com/nvie/gitflow # http://github.com/nvie/gitflow
# #
# Copyright 2010 Vincent Driessen. All rights reserved. # Copyright 2010 Vincent Driessen. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
# #
# 1. Redistributions of source code must retain the above copyright notice, # 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. # this list of conditions and the following disclaimer.
# #
# 2. Redistributions in binary form must reproduce the above copyright # 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the # notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution. # documentation and/or other materials provided with the distribution.
# #
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR # THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
...@@ -30,22 +30,24 @@ ...@@ -30,22 +30,24 @@
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
# The views and conclusions contained in the software and documentation are # The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official # those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen. # policies, either expressed or implied, of Vincent Driessen.
# #
require_git_repo init() {
require_gitflow_initialized require_git_repo
gitflow_load_settings require_gitflow_initialized
VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`") gitflow_load_settings
PREFIX=$(git config --get gitflow.prefix.release) VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`")
PREFIX=$(git config --get gitflow.prefix.release)
}
usage() { usage() {
echo "usage: git flow release [list] [-v]" echo "usage: git flow release [list] [-v]"
echo " git flow release start [-F] <version>" echo " git flow release start [-F] <version> [<base>]"
echo " git flow release finish [-Fsumpk] <version>" echo " git flow release finish [-FsumpkS] <version>"
echo " git flow release publish <name>" echo " git flow release publish <name>"
echo " git flow release track <name>" echo " git flow release track <name>"
} }
...@@ -134,7 +136,7 @@ require_version_arg() { ...@@ -134,7 +136,7 @@ require_version_arg() {
} }
require_base_is_on_develop() { require_base_is_on_develop() {
if ! git branch --no-color --contains "$BASE" 2>/dev/null \ if ! git_do branch --no-color --contains "$BASE" 2>/dev/null \
| sed 's/[* ] //g' \ | sed 's/[* ] //g' \
| grep -q "^$DEVELOP_BRANCH\$"; then | grep -q "^$DEVELOP_BRANCH\$"; then
die "fatal: Given base '$BASE' is not a valid commit on '$DEVELOP_BRANCH'." die "fatal: Given base '$BASE' is not a valid commit on '$DEVELOP_BRANCH'."
...@@ -162,14 +164,14 @@ cmd_start() { ...@@ -162,14 +164,14 @@ cmd_start() {
require_branch_absent "$BRANCH" require_branch_absent "$BRANCH"
require_tag_absent "$VERSION_PREFIX$VERSION" require_tag_absent "$VERSION_PREFIX$VERSION"
if flag fetch; then if flag fetch; then
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" git_do fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi fi
if has "$ORIGIN/$DEVELOP_BRANCH" "$(git_remote_branches)"; then if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH" require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi fi
# create branch # create branch
git checkout -b "$BRANCH" "$BASE" git_do checkout -b "$BRANCH" "$BASE"
echo echo
echo "Summary of actions:" echo "Summary of actions:"
...@@ -190,9 +192,11 @@ cmd_finish() { ...@@ -190,9 +192,11 @@ cmd_finish() {
DEFINE_boolean sign false "sign the release tag cryptographically" s DEFINE_boolean sign false "sign the release tag cryptographically" s
DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
DEFINE_string message "" "use the given tag message" m DEFINE_string message "" "use the given tag message" m
DEFINE_string messagefile "" "use the contents of the given file as a tag message" f
DEFINE_boolean push false "push to $ORIGIN after performing finish" p DEFINE_boolean push false "push to $ORIGIN after performing finish" p
DEFINE_boolean keep false "keep branch after performing finish" k DEFINE_boolean keep false "keep branch after performing finish" k
DEFINE_boolean notag false "don't tag this release" n DEFINE_boolean notag false "don't tag this release" n
DEFINE_boolean squash false "squash release during merge" S
parse_args "$@" parse_args "$@"
require_version_arg require_version_arg
...@@ -206,15 +210,15 @@ cmd_finish() { ...@@ -206,15 +210,15 @@ cmd_finish() {
require_branch "$BRANCH" require_branch "$BRANCH"
require_clean_working_tree require_clean_working_tree
if flag fetch; then if flag fetch; then
git fetch -q "$ORIGIN" "$MASTER_BRANCH" || \ git_do fetch -q "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not fetch $MASTER_BRANCH from $ORIGIN." die "Could not fetch $MASTER_BRANCH from $ORIGIN."
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \ git_do fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN." die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi fi
if has "$ORIGIN/$MASTER_BRANCH" "$(git_remote_branches)"; then if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH" require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi fi
if has "$ORIGIN/$DEVELOP_BRANCH" "$(git_remote_branches)"; then if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH" require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi fi
...@@ -222,11 +226,17 @@ cmd_finish() { ...@@ -222,11 +226,17 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed, # in case a previous attempt to finish this release branch has failed,
# but the merge into master was successful, we skip it now # but the merge into master was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
git checkout "$MASTER_BRANCH" || \ git_do checkout "$MASTER_BRANCH" || \
die "Could not check out $MASTER_BRANCH." die "Could not check out $MASTER_BRANCH."
git merge --no-ff "$BRANCH" || \ if noflag squash; then
die "There were merge conflicts." git_do merge --no-ff "$BRANCH" || \
# TODO: What do we do now? die "There were merge conflicts."
# TODO: What do we do now?
else
git_do merge --squash "$BRANCH" || \
die "There were merge conflicts."
git_do commit
fi
fi fi
if noflag notag; then if noflag notag; then
...@@ -239,7 +249,8 @@ cmd_finish() { ...@@ -239,7 +249,8 @@ cmd_finish() {
flag sign && opts="$opts -s" flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'" [ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'" [ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
git tag $opts "$tagname" || \ [ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git_do tag $opts "$tagname" "$BRANCH" || \
die "Tagging failed. Please run finish again to retry." die "Tagging failed. Please run finish again to retry."
fi fi
fi fi
...@@ -248,34 +259,41 @@ cmd_finish() { ...@@ -248,34 +259,41 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed, # in case a previous attempt to finish this release branch has failed,
# but the merge into develop was successful, we skip it now # but the merge into develop was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
git checkout "$DEVELOP_BRANCH" || \ git_do checkout "$DEVELOP_BRANCH" || \
die "Could not check out $DEVELOP_BRANCH." die "Could not check out $DEVELOP_BRANCH."
# TODO: Actually, accounting for 'git describe' pays, so we should # TODO: Actually, accounting for 'git describe' pays, so we should
# ideally git merge --no-ff $tagname here, instead! # ideally git merge --no-ff $tagname here, instead!
git merge --no-ff "$BRANCH" || \ if noflag squash; then
die "There were merge conflicts." git_do merge --no-ff "$BRANCH" || \
# TODO: What do we do now? die "There were merge conflicts."
# TODO: What do we do now?
else
git_do merge --squash "$BRANCH" || \
die "There were merge conflicts."
# TODO: What do we do now?
git_do commit
fi
fi fi
# delete branch # delete branch
if noflag keep; then if noflag keep; then
if [ "$BRANCH" = "$(git_current_branch)" ]; then if [ "$BRANCH" = "$(git_current_branch)" ]; then
git checkout "$MASTER_BRANCH" git_do checkout "$MASTER_BRANCH"
fi fi
git branch -d "$BRANCH" git_do branch -d "$BRANCH"
fi fi
if flag push; then if flag push; then
git push "$ORIGIN" "$DEVELOP_BRANCH" || \ git_do push "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not push to $DEVELOP_BRANCH from $ORIGIN." die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
git push "$ORIGIN" "$MASTER_BRANCH" || \ git_do push "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not push to $MASTER_BRANCH from $ORIGIN." die "Could not push to $MASTER_BRANCH from $ORIGIN."
if noflag notag; then if noflag notag; then
git push --tags "$ORIGIN" || \ git_do push --tags "$ORIGIN" || \
die "Could not push tags to $ORIGIN." die "Could not push tags to $ORIGIN."
fi fi
git push "$ORIGIN" :"$BRANCH" || \ git_do push "$ORIGIN" :"$BRANCH" || \
die "Could not delete the remote $BRANCH in $ORIGIN." die "Could not delete the remote $BRANCH in $ORIGIN."
fi fi
...@@ -306,17 +324,17 @@ cmd_publish() { ...@@ -306,17 +324,17 @@ cmd_publish() {
# sanity checks # sanity checks
require_clean_working_tree require_clean_working_tree
require_branch "$BRANCH" require_branch "$BRANCH"
git fetch -q "$ORIGIN" git_do fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH" require_branch_absent "$ORIGIN/$BRANCH"
# create remote branch # create remote branch
git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH" git_do push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git fetch -q "$ORIGIN" git_do fetch -q "$ORIGIN"
# configure remote tracking # configure remote tracking
git config "branch.$BRANCH.remote" "$ORIGIN" git_do config "branch.$BRANCH.remote" "$ORIGIN"
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH" git_do config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git checkout "$BRANCH" git_do checkout "$BRANCH"
echo echo
echo "Summary of actions:" echo "Summary of actions:"
...@@ -333,11 +351,11 @@ cmd_track() { ...@@ -333,11 +351,11 @@ cmd_track() {
# sanity checks # sanity checks
require_clean_working_tree require_clean_working_tree
require_branch_absent "$BRANCH" require_branch_absent "$BRANCH"
git fetch -q "$ORIGIN" git_do fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH" require_branch "$ORIGIN/$BRANCH"
# create tracking branch # create tracking branch
git checkout -b "$BRANCH" "$ORIGIN/$BRANCH" git_do checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo echo
echo "Summary of actions:" echo "Summary of actions:"
......
...@@ -9,17 +9,17 @@ ...@@ -9,17 +9,17 @@
# http://github.com/nvie/gitflow # http://github.com/nvie/gitflow
# #
# Copyright 2010 Vincent Driessen. All rights reserved. # Copyright 2010 Vincent Driessen. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
# #
# 1. Redistributions of source code must retain the above copyright notice, # 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. # this list of conditions and the following disclaimer.
# #
# 2. Redistributions in binary form must reproduce the above copyright # 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the # notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution. # documentation and/or other materials provided with the distribution.
# #
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR # THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
...@@ -30,17 +30,19 @@ ...@@ -30,17 +30,19 @@
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
# The views and conclusions contained in the software and documentation are # The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official # those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen. # policies, either expressed or implied, of Vincent Driessen.
# #
require_git_repo init() {
require_gitflow_initialized require_git_repo
gitflow_load_settings require_gitflow_initialized
VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`") gitflow_load_settings
PREFIX=$(git config --get gitflow.prefix.support) VERSION_PREFIX=$(eval "echo `git config --get gitflow.prefix.versiontag`")
PREFIX=$(git config --get gitflow.prefix.support)
}
warn "note: The support subcommand is still very EXPERIMENTAL!" warn "note: The support subcommand is still very EXPERIMENTAL!"
warn "note: DO NOT use it in a production situation." warn "note: DO NOT use it in a production situation."
...@@ -167,12 +169,12 @@ cmd_start() { ...@@ -167,12 +169,12 @@ cmd_start() {
# fetch remote changes # fetch remote changes
if flag fetch; then if flag fetch; then
git fetch -q "$ORIGIN" "$BASE" git_do fetch -q "$ORIGIN" "$BASE"
fi fi
require_branch_absent "$BRANCH" require_branch_absent "$BRANCH"
# create branch # create branch
git checkout -b "$BRANCH" "$BASE" git_do checkout -b "$BRANCH" "$BASE"
echo echo
echo "Summary of actions:" echo "Summary of actions:"
......
...@@ -9,17 +9,17 @@ ...@@ -9,17 +9,17 @@
# http://github.com/nvie/gitflow # http://github.com/nvie/gitflow
# #
# Copyright 2010 Vincent Driessen. All rights reserved. # Copyright 2010 Vincent Driessen. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
# #
# 1. Redistributions of source code must retain the above copyright notice, # 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. # this list of conditions and the following disclaimer.
# #
# 2. Redistributions in binary form must reproduce the above copyright # 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the # notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution. # documentation and/or other materials provided with the distribution.
# #
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR # THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
...@@ -30,20 +30,20 @@ ...@@ -30,20 +30,20 @@
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
# The views and conclusions contained in the software and documentation are # The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official # those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen. # policies, either expressed or implied, of Vincent Driessen.
# #
GITFLOW_VERSION=0.4.1 GITFLOW_VERSION=0.4.2-pre
usage() { usage() {
echo "usage: git flow version" echo "usage: git flow version"
} }
cmd_default() { cmd_default() {
echo "$GITFLOW_VERSION" echo "$GITFLOW_VERSION dreidev"
} }
cmd_help() { cmd_help() {
......
...@@ -9,17 +9,17 @@ ...@@ -9,17 +9,17 @@
# http://github.com/nvie/gitflow # http://github.com/nvie/gitflow
# #
# Copyright 2010 Vincent Driessen. All rights reserved. # Copyright 2010 Vincent Driessen. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
# #
# 1. Redistributions of source code must retain the above copyright notice, # 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer. # this list of conditions and the following disclaimer.
# #
# 2. Redistributions in binary form must reproduce the above copyright # 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the # notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution. # documentation and/or other materials provided with the distribution.
# #
# THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR # THIS SOFTWARE IS PROVIDED BY VINCENT DRIESSEN ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
# The views and conclusions contained in the software and documentation are # The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official # those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of Vincent Driessen. # policies, either expressed or implied, of Vincent Driessen.
...@@ -45,7 +45,7 @@ warn() { echo "$@" >&2; } ...@@ -45,7 +45,7 @@ warn() { echo "$@" >&2; }
die() { warn "$@"; exit 1; } die() { warn "$@"; exit 1; }
escape() { escape() {
echo "$1" | sed 's/\([\.\+\$\*]\)/\\\1/g' echo "$1" | sed 's/\([\.\$\*]\)/\\\1/g'
} }
# set logic # set logic
...@@ -70,6 +70,14 @@ noflag() { local FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -ne $FLAGS_TRUE ]; } ...@@ -70,6 +70,14 @@ noflag() { local FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -ne $FLAGS_TRUE ]; }
# Git specific common functionality # Git specific common functionality
# #
git_do() {
# equivalent to git, used to indicate actions that make modifications
if flag show_commands; then
echo "git $@" >&2
fi
git "$@"
}
git_local_branches() { git branch --no-color | sed 's/^[* ] //'; } git_local_branches() { git branch --no-color | sed 's/^[* ] //'; }
git_remote_branches() { git branch -r --no-color | sed 's/^[* ] //'; } git_remote_branches() { git branch -r --no-color | sed 's/^[* ] //'; }
git_all_branches() { ( git branch --no-color; git branch -r --no-color) | sed 's/^[* ] //'; } git_all_branches() { ( git branch --no-color; git branch -r --no-color) | sed 's/^[* ] //'; }
...@@ -97,6 +105,10 @@ git_local_branch_exists() { ...@@ -97,6 +105,10 @@ git_local_branch_exists() {
has $1 $(git_local_branches) has $1 $(git_local_branches)
} }
git_remote_branch_exists() {
has $1 $(git_remote_branches)
}
git_branch_exists() { git_branch_exists() {
has $1 $(git_all_branches) has $1 $(git_all_branches)
} }
...@@ -181,7 +193,7 @@ gitflow_is_initialized() { ...@@ -181,7 +193,7 @@ gitflow_is_initialized() {
# loading settings that can be overridden using git config # loading settings that can be overridden using git config
gitflow_load_settings() { gitflow_load_settings() {
export DOT_GIT_DIR=$(git rev-parse --git-dir >/dev/null 2>&1) export DOT_GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
export MASTER_BRANCH=$(git config --get gitflow.branch.master) export MASTER_BRANCH=$(git config --get gitflow.branch.master)
export DEVELOP_BRANCH=$(git config --get gitflow.branch.develop) export DEVELOP_BRANCH=$(git config --get gitflow.branch.develop)
export ORIGIN=$(git config --get gitflow.origin || echo origin) export ORIGIN=$(git config --get gitflow.origin || echo origin)
...@@ -288,9 +300,11 @@ require_branch_absent() { ...@@ -288,9 +300,11 @@ require_branch_absent() {
} }
require_tag_absent() { require_tag_absent() {
if has $1 $(git_all_tags); then for tag in $(git_all_tags); do
die "Tag '$1' already exists. Pick another name." if [ "$1" = "$tag" ]; then
fi die "Tag '$1' already exists. Pick another name."
fi
done
} }
require_branches_equal() { require_branches_equal() {
......
shFlags/src/shflags
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment