support to tag more repositories
Petr Mladek <[email protected]> Tue, 31 Aug 2010 15:20:05 +0200
| Newsgroups | gmane.comp.gnome.ximian.openoffice |
|---|---|
| Message-ID | <[email protected]> |
--=-yNSfKvcyo5iufKQHHUIn
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
Hi Kendy,
I had to improve the "g" script to be able to tag the git repositories
and push the tags. Please, find the diff attached.
The changes are:
+ add quotes around the message string for commit command;
I wonder how it worked
+ git tag does not support --message=<msg>, so I had to pass
-m <msg> as a single paramete; I think that we could actually
use the same hack for "commit" as well
+ the extra parameter for "tag" is not file path
+ the new tag is not detected by "status", so I need to force
the "push"
Any comments before I commit it ;-)
Best Regards,
Petr
--=-yNSfKvcyo5iufKQHHUIn
Content-Disposition: attachment; filename="g-tag.diff"
Content-Type: text/x-patch; name="g-tag.diff"; charset="UTF-8"
Content-Transfer-Encoding: 7bit
diff --git a/bin/g b/bin/g
index 4e8e862..a2b091d 100755
--- a/bin/g
+++ b/bin/g
@@ -17,6 +17,7 @@ EXTRA=
COMMAND="$1"
PAGER=
RELATIVIZE=1
+ALWAYS_PUSH=
case "$COMMAND" in
apply)
@@ -46,7 +47,7 @@ while shift ; do
case "$PARAM" in
-m)
shift
- FILES[$FILESNUM]="--message=$1"
+ FILES[$FILESNUM]="--message=\"$1\""
FILESNUM=$(($FILESNUM+1))
;;
-am)
@@ -61,6 +62,32 @@ while shift ; do
FILESNUM=$(($FILESNUM+1))
;;
esac
+ elif [ "$COMMAND" = "push" ] ; then
+ # special handling of --tags
+ case "$PARAM" in
+ --tags)
+ ALWAYS_PUSH=1
+ FILES[$FILESNUM]="$PARAM"
+ FILESNUM=$(($FILESNUM+1))
+ ;;
+ *)
+ FILES[$FILESNUM]="$PARAM"
+ FILESNUM=$(($FILESNUM+1))
+ ;;
+ esac
+ elif [ "$COMMAND" = "tag" ] ; then
+ # special handling of -m
+ case "$PARAM" in
+ -m)
+ shift
+ FILES[$FILESNUM]="-m \"$1\""
+ FILESNUM=$(($FILESNUM+1))
+ ;;
+ *)
+ FILES[$FILESNUM]="$PARAM"
+ FILESNUM=$(($FILESNUM+1))
+ ;;
+ esac
else
FILES[$FILESNUM]="$PARAM"
FILESNUM=$(($FILESNUM+1))
@@ -77,7 +104,7 @@ while shift ; do
fi
FILES[$FILESNUM]=`readlink -n -e "$PARAM"`
if [ -z "${FILES[$FILESNUM]}" ] ; then
- if [ "$COMMAND" = "checkout" ] ; then
+ if [ "$COMMAND" = "checkout" -o "$COMMAND" = "tag" ] ; then
EXTRA="$EXTRA $PARAM"
else
echo "'$PARAM' not found in `pwd`."
@@ -134,7 +161,9 @@ for DIR in * ; do
git status | grep -qs '^nothing to commit' && exit 0
;;
push)
- git status | grep -qs '^# Your branch is ahead of' || exit 0
+ if [ "$ALWAYS_PUSH" != "1" ] ; then
+ git status | grep -qs '^# Your branch is ahead of' || exit 0
+ fi
;;
status)
AHEAD="`git status | grep '^# Your branch is ahead of'`"
--=-yNSfKvcyo5iufKQHHUIn
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline