summaryrefslogtreecommitdiff
path: root/g
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-10-02 12:59:44 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2012-10-16 11:28:27 -0500
commita31714fb759a67a85a6007a70ba58f0530b24311 (patch)
treed9765ac0fdae4e91e398c474f99a1ab3a8128b69 /g
parent2c5cdc4d3e479576f13e4307f0be1c6170e34756 (diff)
add tag support to ./g, try to optimize pre->post submerge situation
Change-Id: I052817865da6df193c0451eccc3b8b6f507845a3
Diffstat (limited to 'g')
-rwxr-xr-xg36
1 files changed, 34 insertions, 2 deletions
diff --git a/g b/g
index 7c6551c892f6..f70cac1098ce 100755
--- a/g
+++ b/g
@@ -125,6 +125,31 @@ get_configured_submodules()
fi
}
+do_shortcut_update()
+{
+local module
+local repo
+
+ for module in $SUBMODULES_CONFIGURED ; do
+ if [ ! -d ${module?}/.git ] ; then
+ case "${module?}" in
+ helcontent2)
+ if [ -d clone/help/.git ] ; then
+ repo="clone/help/.git"
+ fi
+ ;;
+ *)
+ if [ -d clone/${module?}/.git ] ; then
+ repo="clone/${module?}/.git"
+ fi
+ ;;
+ esac
+ if [ -n "$repo" ] ; then
+ cp -r "${repo?}" "${module?}/."
+ fi
+ done
+}
+
do_git_cmd()
{
echo "cmd:$@"
@@ -147,11 +172,13 @@ local module
create_branch=1
elif [ "$create_branch" = "1" ] ; then
branch="$arg"
+ create_branch=0
fi
done
if [ -f .gitmodules ] ; then
+ git submodule update
if [ -n "$branch" ] ; then
- git submodules foreach git branch ${branch} HEAD || return $?
+ git submodules foreach git checkout -b ${branch} HEAD || return $?
fi
else
# now that is the nasty case we moved prior to submodules
@@ -189,6 +216,8 @@ do_init_modules()
local module
local configured
+ do_shortcut_update
+
for module in $SUBMODULES_CONFIGURED ; do
configured=$(git config --local --get submodule.${module}.url)
if [ -z "$configured" ] ; then
@@ -265,7 +294,7 @@ case "$COMMAND" in
do_git_cmd ${COMMAND} "$@"
;;
checkout)
- do_checkout "$@" && git submodule foreach git checkout "$@"
+ do_checkout "$@"
;;
clone)
do_init_modules && git submodule update && refresh_all_hooks
@@ -290,6 +319,9 @@ case "$COMMAND" in
reset)
do_reset
;;
+ tag)
+ do_git_cmd ${COMMAND} "$@"
+ ;;
*)
echo "./g does not support command:$COMMAND" 1>&2
exit 1;