Make git-flow-version a first-class citizen amongst the other subcommands.
diff --git a/bump-version b/bump-version
index f8ae3de..f7494c9 100755
--- a/bump-version
+++ b/bump-version
@@ -8,6 +8,11 @@
exit 1
fi
-echo "GITFLOW_VERSION=$1" > git-flow-version
+if ! sed 's/^GITFLOW_VERSION=.*$/GITFLOW_VERSION='$1'/g' git-flow-version > .git-flow-version.new; then
+ echo "Could not replace GITFLOW_VERSION variable." >&2
+ exit 2
+fi
+
+mv .git-flow-version.new git-flow-version
git add git-flow-version
git commit -m "Bumped version number to $1" git-flow-version
diff --git a/git-flow b/git-flow
index 09a1b13..de8d9a1 100755
--- a/git-flow
+++ b/git-flow
@@ -33,9 +33,6 @@
}
usage() {
- . "$GITFLOW_DIR/git-flow-version"
- echo "git-flow, version $GITFLOW_VERSION"
- echo
echo "usage: git flow <subcommand>"
echo
echo "Available subcommands are:"
@@ -44,6 +41,7 @@
echo " release Manage your release branches."
echo " hotfix Manage your hotfix branches."
echo " support Manage your support branches."
+ echo " version Shows version information."
echo
echo "Try 'git flow <subcommand> help' for details."
}
diff --git a/git-flow-version b/git-flow-version
index ae551c6..cbb66b6 100644
--- a/git-flow-version
+++ b/git-flow-version
@@ -1 +1,27 @@
+#
+# git-flow -- A collection of Git extensions to provide high-level
+# repository operations for Vincent Driessen's branching model.
+#
+# Original blog post presenting this model is found at:
+# http://nvie.com/archives/323
+#
+# Feel free to contribute to this project at:
+# http://github.com/nvie/gitflow
+#
+# Copyright (c) 2010 by Vincent Driessen
+# Copyright (c) 2010 by Benedikt Böhm
+#
GITFLOW_VERSION=0.2-dirty
+
+usage() {
+ echo "usage: git flow version"
+}
+
+cmd_help() {
+ usage
+ exit 0
+}
+
+cmd_default() {
+ echo "$GITFLOW_VERSION"
+}