2010-11-16 08:00:48 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Wrapper for git to handle more subdirs at the same time
|
|
|
|
#
|
2010-11-22 03:11:56 -06:00
|
|
|
|
2012-10-01 23:48:10 -05:00
|
|
|
if [ -n "$g_debug" ] ; then
|
|
|
|
set -x
|
2010-11-16 08:00:48 -06:00
|
|
|
fi
|
|
|
|
|
2012-11-08 16:25:37 -06:00
|
|
|
SUBMODULES_ALL="dictionaries helpcontent2 translations"
|
2010-11-16 08:00:48 -06:00
|
|
|
|
2011-08-27 23:41:18 -05:00
|
|
|
pushd $(dirname $0) > /dev/null
|
2022-05-30 14:30:04 -05:00
|
|
|
if [ -f ${BUILDDIR}/config_host.mk ] ; then
|
|
|
|
# we are in the SRCDIR
|
|
|
|
SRC_ROOT=$(< ${BUILDDIR}/config_host.mk grep -a SRC_ROOT | sed -e "s/.*=//")
|
2012-12-11 07:49:24 -06:00
|
|
|
else
|
|
|
|
SRC_ROOT=$(pwd)
|
|
|
|
fi
|
2011-08-27 23:41:18 -05:00
|
|
|
popd > /dev/null
|
|
|
|
|
2012-12-11 07:49:24 -06:00
|
|
|
COREDIR="$SRC_ROOT"
|
|
|
|
|
2012-10-01 23:48:10 -05:00
|
|
|
usage()
|
|
|
|
{
|
|
|
|
git
|
|
|
|
echo
|
2022-01-02 10:33:27 -06:00
|
|
|
echo "Usage: g [options] [git (checkout|clone|fetch|gc|grep|pull|push|reset) [git options/args..]]"
|
2012-10-01 23:48:10 -05:00
|
|
|
echo ""
|
2012-10-16 19:43:21 -05:00
|
|
|
echo " -z restore the git hooks and do other sanity checks"
|
2012-10-01 23:48:10 -05:00
|
|
|
}
|
2012-07-10 05:57:01 -05:00
|
|
|
|
2024-11-28 07:49:08 -06:00
|
|
|
refresh_create_link()
|
|
|
|
{
|
|
|
|
local hook_name=$1
|
|
|
|
local hook=$2
|
|
|
|
local lnarg=$3
|
|
|
|
|
|
|
|
# if it doesn't exist or is neither a symlink nor sharing the same inode (hardlink)
|
|
|
|
if [ ! -e "${hook?}" ] || [ ! \( -L "${hook?}" -o "${hook_name}" -ef "${hook?}" \) ] ; then
|
|
|
|
rm -f "${hook?}"
|
|
|
|
ln -f $lnarg "${hook_name}" "${hook?}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-10-01 23:48:10 -05:00
|
|
|
refresh_submodule_hooks()
|
2010-11-24 17:13:14 -06:00
|
|
|
{
|
2018-07-02 11:11:22 -05:00
|
|
|
local repo=$1
|
2024-11-28 07:49:08 -06:00
|
|
|
local lnarg=$2
|
2018-07-02 11:11:22 -05:00
|
|
|
local hook
|
|
|
|
local hook_name
|
2012-10-01 23:48:10 -05:00
|
|
|
|
2017-04-27 04:46:47 -05:00
|
|
|
if [ -d "${repo?}"/.git ] ; then
|
2012-10-01 23:48:10 -05:00
|
|
|
# use core's hook by default
|
2018-07-02 11:11:22 -05:00
|
|
|
for hook_name in "${COREDIR?}/.git-hooks"/* ; do
|
2021-03-04 02:40:05 -06:00
|
|
|
if [ ! -e "${hook_name}" ] ; then
|
|
|
|
continue
|
|
|
|
fi
|
2017-04-15 10:35:17 -05:00
|
|
|
hook="${repo?}/.git/hooks/${hook_name##*/}"
|
2024-11-28 07:49:08 -06:00
|
|
|
refresh_create_link "${hook_name}" "${hook?}" "$lnarg"
|
2018-07-02 11:11:22 -05:00
|
|
|
done
|
2012-10-01 23:48:10 -05:00
|
|
|
# override if need be by the submodules' own hooks
|
2018-07-02 11:11:22 -05:00
|
|
|
for hook_name in "${COREDIR?}/${repo?}/.git-hooks"/* ; do
|
2021-03-04 02:40:05 -06:00
|
|
|
if [ ! -e "${hook_name}" ] ; then
|
|
|
|
continue
|
|
|
|
fi
|
2017-04-15 10:35:17 -05:00
|
|
|
hook="${repo?}/.git/hooks/${hook_name##*/}"
|
2024-11-28 07:49:08 -06:00
|
|
|
refresh_create_link "${hook_name}" "${hook?}" "$lnarg"
|
2018-07-02 11:11:22 -05:00
|
|
|
done
|
2017-04-27 04:46:47 -05:00
|
|
|
elif [ -d .git/modules/"${repo}"/hooks ] ; then
|
2018-07-02 11:11:22 -05:00
|
|
|
for hook_name in "${COREDIR?}/.git-hooks"/* ; do
|
2021-03-04 02:40:05 -06:00
|
|
|
if [ ! -e "${hook_name}" ] ; then
|
|
|
|
continue
|
|
|
|
fi
|
2017-04-15 10:35:17 -05:00
|
|
|
hook=".git/modules/${repo?}/hooks/${hook_name##*/}"
|
2024-11-28 07:49:08 -06:00
|
|
|
refresh_create_link "${hook_name}" "${hook?}" "$lnarg"
|
2018-07-02 11:11:22 -05:00
|
|
|
done
|
2012-12-21 04:33:20 -06:00
|
|
|
# override if need be by the submodules' own hooks
|
2018-07-02 11:11:22 -05:00
|
|
|
for hook_name in "${COREDIR?}/${repo?}/.git-hooks"/* ; do
|
2021-03-04 02:40:05 -06:00
|
|
|
if [ ! -e "${hook_name}" ] ; then
|
|
|
|
continue
|
|
|
|
fi
|
2017-04-15 10:35:17 -05:00
|
|
|
hook=".git/modules/${repo?}/hooks/${hook_name##*/}"
|
2024-11-28 07:49:08 -06:00
|
|
|
refresh_create_link "${hook_name}" "${hook?}" "$lnarg"
|
2018-07-02 11:11:22 -05:00
|
|
|
done
|
2012-10-01 23:48:10 -05:00
|
|
|
fi
|
2012-12-21 04:33:20 -06:00
|
|
|
|
2011-08-27 23:41:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
refresh_all_hooks()
|
|
|
|
{
|
2018-07-02 11:11:22 -05:00
|
|
|
local repo
|
|
|
|
local hook_name
|
|
|
|
local hook
|
2023-03-08 03:14:55 -06:00
|
|
|
local gitbash
|
2024-11-28 07:49:08 -06:00
|
|
|
local lnarg
|
2012-10-01 23:48:10 -05:00
|
|
|
|
2015-01-14 08:42:00 -06:00
|
|
|
pushd "${COREDIR?}" > /dev/null
|
2023-02-22 05:15:06 -06:00
|
|
|
|
2023-03-08 03:14:55 -06:00
|
|
|
# it is 'GIT for Windows'
|
|
|
|
gitbash=$(echo $OSTYPE | grep -ic msys)
|
2023-02-22 05:15:06 -06:00
|
|
|
|
2024-11-28 07:49:08 -06:00
|
|
|
# git-bash/MSYS doesn't create symlinks by default, and "real" symlinks are restricted to
|
|
|
|
# Admin-mode or when devmode is activated, junction points as fallback would work for bash/
|
|
|
|
# regular use but not when git tries to spawn them, similar for plain windows shortcuts (worse
|
|
|
|
# because running the hooks will fail silently/they'd be inactive)
|
|
|
|
# ln -s without setting MSYS to contain winsymlinks:{lnk,native,nativestrict,sys} to force one
|
|
|
|
# of the other modes described above will do plain copies.
|
|
|
|
# So in case of git-bash use hardlinks since those work just fine, everywhere else use symlinks
|
|
|
|
if [ $gitbash -ne 1 ]; then
|
|
|
|
lnarg="--symbolic"
|
2023-03-08 03:14:55 -06:00
|
|
|
fi
|
2024-11-28 07:49:08 -06:00
|
|
|
# There's no ".git" e.g. in a secondary worktree
|
|
|
|
if [ -d ".git" ]; then
|
|
|
|
for hook_name in "${COREDIR?}/.git-hooks"/* ; do
|
|
|
|
hook=".git/hooks/${hook_name##*/}"
|
|
|
|
refresh_create_link "${hook_name}" "${hook?}" "$lnarg"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
for repo in ${SUBMODULES_ALL?} ; do
|
|
|
|
refresh_submodule_hooks "$repo" "$lnarg"
|
|
|
|
done
|
2023-02-22 05:15:06 -06:00
|
|
|
|
2012-10-01 23:48:10 -05:00
|
|
|
popd > /dev/null
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
set_push_url()
|
|
|
|
{
|
2018-07-02 11:11:22 -05:00
|
|
|
local repo
|
2012-10-01 23:48:10 -05:00
|
|
|
|
|
|
|
repo="$1"
|
|
|
|
if [ -n "$repo" ] ; then
|
2018-07-02 11:11:22 -05:00
|
|
|
pushd "${COREDIR?}/${repo?}" > /dev/null
|
2012-10-01 23:48:10 -05:00
|
|
|
else
|
2018-07-02 11:11:22 -05:00
|
|
|
pushd "${COREDIR?}" > /dev/null
|
|
|
|
repo="core"
|
2012-10-01 23:48:10 -05:00
|
|
|
fi
|
|
|
|
echo "setting up push url for ${repo?}"
|
|
|
|
if [ "${repo?}" = "helpcontent2" ] ; then
|
2018-07-02 11:11:22 -05:00
|
|
|
git config remote.origin.pushurl "ssh://${PUSH_USER}logerrit/help"
|
2012-10-01 23:48:10 -05:00
|
|
|
else
|
2018-07-02 11:11:22 -05:00
|
|
|
git config remote.origin.pushurl "ssh://${PUSH_USER}logerrit/${repo?}"
|
2012-10-01 23:48:10 -05:00
|
|
|
fi
|
|
|
|
popd > /dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
set_push_urls()
|
|
|
|
{
|
|
|
|
PUSH_USER="$1"
|
|
|
|
set_push_url
|
|
|
|
for repo in ${SUBMODULES_ACTIVE?} ; do
|
2018-07-02 11:11:22 -05:00
|
|
|
set_push_url "${repo?}"
|
2012-10-01 23:48:10 -05:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
get_active_submodules()
|
|
|
|
{
|
2018-07-02 11:11:22 -05:00
|
|
|
SUBMODULES_ACTIVE=""
|
|
|
|
local repo
|
2012-10-01 23:48:10 -05:00
|
|
|
|
|
|
|
for repo in ${SUBMODULES_ALL?} ; do
|
2018-07-02 11:11:22 -05:00
|
|
|
if [ -d "${repo?}"/.git ] || [ -f "${repo?}"/.git ] ; then
|
|
|
|
SUBMODULES_ACTIVE="${repo?} ${SUBMODULES_ACTIVE?}"
|
|
|
|
fi
|
2010-11-24 17:13:14 -06:00
|
|
|
done
|
2011-08-27 23:41:18 -05:00
|
|
|
}
|
|
|
|
|
2012-10-01 23:48:10 -05:00
|
|
|
get_configured_submodules()
|
2011-08-27 23:41:18 -05:00
|
|
|
{
|
2012-10-01 23:48:10 -05:00
|
|
|
SUBMODULES_CONFIGURED=""
|
2022-05-30 14:30:04 -05:00
|
|
|
if [ -f ${BUILDDIR}/config_host.mk ] ; then
|
|
|
|
SUBMODULES_CONFIGURED=$(< ${BUILDDIR}/config_host.mk grep -a GIT_NEEDED_SUBMODULES | sed -e "s/.*=//")
|
2012-10-01 23:48:10 -05:00
|
|
|
else
|
2018-07-02 11:11:22 -05:00
|
|
|
# if we need the configured submodule before the configuration is done. we assumed you want them all
|
|
|
|
SUBMODULES_CONFIGURED=${SUBMODULES_ALL?}
|
2011-03-12 16:37:38 -06:00
|
|
|
fi
|
2012-10-01 23:48:10 -05:00
|
|
|
}
|
|
|
|
|
2013-02-09 12:09:32 -06:00
|
|
|
get_git_reference()
|
|
|
|
{
|
|
|
|
REFERENCED_GIT=""
|
2022-05-30 14:30:04 -05:00
|
|
|
if [ -f ${BUILDDIR}/config_host.mk ]; then
|
|
|
|
REFERENCED_GIT=$(< ${BUILDDIR}/config_host.mk grep -a GIT_REFERENCE_SRC | sed -e "s/.*=//")
|
2013-02-09 12:09:32 -06:00
|
|
|
fi
|
2013-06-21 06:31:37 -05:00
|
|
|
LINKED_GIT=""
|
2022-05-30 14:30:04 -05:00
|
|
|
if [ -f ${BUILDDIR}/config_host.mk ]; then
|
|
|
|
LINKED_GIT=$(< ${BUILDDIR}/config_host.mk grep -a GIT_LINK_SRC | sed -e "s/.*=//")
|
2013-06-21 06:31:37 -05:00
|
|
|
fi
|
2013-02-09 12:09:32 -06:00
|
|
|
}
|
|
|
|
|
2012-10-02 12:59:44 -05:00
|
|
|
do_shortcut_update()
|
|
|
|
{
|
2018-07-02 11:11:22 -05:00
|
|
|
local module
|
|
|
|
local repo
|
2012-10-02 12:59:44 -05:00
|
|
|
|
|
|
|
for module in $SUBMODULES_CONFIGURED ; do
|
2018-07-02 11:11:22 -05:00
|
|
|
if [ ! -d "${module?}"/.git ] ; then
|
|
|
|
case "${module?}" in
|
|
|
|
helpcontent2)
|
|
|
|
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
|
|
|
|
fi
|
2012-10-02 12:59:44 -05:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2012-10-01 23:48:10 -05:00
|
|
|
do_git_cmd()
|
|
|
|
{
|
2017-04-27 04:46:47 -05:00
|
|
|
echo "cmd:$*"
|
2012-10-01 23:48:10 -05:00
|
|
|
git "$@"
|
|
|
|
git submodule foreach git "$@" $KEEP_GOING
|
|
|
|
}
|
|
|
|
|
|
|
|
do_checkout()
|
|
|
|
{
|
2018-07-02 11:11:22 -05:00
|
|
|
local cmd
|
|
|
|
local create_branch="0"
|
|
|
|
local branch
|
|
|
|
local module
|
2012-10-01 23:48:10 -05:00
|
|
|
|
|
|
|
git checkout "$@" || return $?
|
|
|
|
for cmd in "$@" ; do
|
2018-07-02 11:11:22 -05:00
|
|
|
if [ "$cmd" = "-f" ]; then
|
2018-07-02 11:11:47 -05:00
|
|
|
continue
|
2018-07-02 11:11:22 -05:00
|
|
|
elif [ "$cmd" = "-b" ] ; then
|
|
|
|
create_branch=1
|
|
|
|
elif [ "$create_branch" = "1" ] ; then
|
|
|
|
branch="$cmd"
|
|
|
|
create_branch=0
|
|
|
|
fi
|
2012-10-01 23:48:10 -05:00
|
|
|
done
|
|
|
|
if [ -f .gitmodules ] ; then
|
2021-06-26 04:42:52 -05:00
|
|
|
git submodule update --progress
|
2018-07-02 11:11:22 -05:00
|
|
|
if [ -n "$branch" ] ; then
|
|
|
|
git submodule foreach git checkout -b "${branch}" HEAD || return $?
|
|
|
|
fi
|
2012-10-01 23:48:10 -05:00
|
|
|
else
|
2018-07-02 11:11:22 -05:00
|
|
|
# now that is the nasty case we moved prior to submodules
|
|
|
|
# delete the submodules left over if any
|
|
|
|
for module in $SUBMODULES_ALL ; do
|
|
|
|
echo "clean-up submodule $module"
|
|
|
|
rm -fr "${module}"
|
|
|
|
done
|
|
|
|
# make sure we have the needed repo in clone
|
|
|
|
./g clone && ./g -f checkout "$@" || return $?
|
2012-10-01 23:48:10 -05:00
|
|
|
fi
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
do_reset()
|
|
|
|
{
|
|
|
|
git reset "$@" || return $?
|
|
|
|
if [ -f .gitmodules ] ; then
|
2021-06-26 04:42:52 -05:00
|
|
|
git submodule update --progress || return $?
|
2012-10-01 23:48:10 -05:00
|
|
|
else
|
2018-07-02 11:11:22 -05:00
|
|
|
# now that is the nasty case we moved prior to submodules
|
|
|
|
# delete the submodules left over if any
|
|
|
|
for module in $SUBMODULES_ALL ; do
|
|
|
|
echo "clean-up submodule $module"
|
|
|
|
rm -fr "${module}"
|
|
|
|
done
|
|
|
|
# make sure we have the needed repo in clone
|
|
|
|
./g clone && ./g -f reset "$@"
|
2012-10-01 23:48:10 -05:00
|
|
|
fi
|
|
|
|
return $?;
|
|
|
|
}
|
|
|
|
|
|
|
|
do_init_modules()
|
|
|
|
{
|
2018-07-02 11:11:22 -05:00
|
|
|
local module
|
|
|
|
local configured
|
2011-08-27 23:41:18 -05:00
|
|
|
|
2012-10-02 12:59:44 -05:00
|
|
|
do_shortcut_update
|
|
|
|
|
2012-10-01 23:48:10 -05:00
|
|
|
for module in $SUBMODULES_CONFIGURED ; do
|
2018-07-02 11:11:22 -05:00
|
|
|
if [ -n "$LINKED_GIT" ] ; then
|
|
|
|
if ! [ -d ".git/modules/${module}" ]; then
|
|
|
|
./bin/git-new-module-workdir "${LINKED_GIT}/${module}" "${module}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
configured=$(git config --local --get submodule."${module}".url)
|
|
|
|
if [ -z "$configured" ] ; then
|
|
|
|
git submodule init "$module" || return $?
|
|
|
|
fi
|
2012-10-01 23:48:10 -05:00
|
|
|
done
|
2013-02-26 09:17:51 -06:00
|
|
|
for module in $SUBMODULES_CONFIGURED ; do
|
|
|
|
if [ -n "$REFERENCED_GIT" ] ; then
|
2021-06-26 04:42:52 -05:00
|
|
|
git submodule update --reference "$REFERENCED_GIT/.git/modules/$module" --progress "$module" || return $?
|
2013-02-26 09:17:51 -06:00
|
|
|
else
|
2021-06-26 04:42:52 -05:00
|
|
|
git submodule update --progress "$module" || return $?
|
2013-02-26 09:17:51 -06:00
|
|
|
fi
|
|
|
|
done
|
2012-10-01 23:48:10 -05:00
|
|
|
return 0
|
2010-11-24 17:13:14 -06:00
|
|
|
}
|
|
|
|
|
2012-10-01 23:48:10 -05:00
|
|
|
|
|
|
|
# no params, no action
|
|
|
|
if [ "$#" -eq "0" ] ; then
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
|
2023-02-22 05:15:06 -06:00
|
|
|
|
2023-03-08 03:14:55 -06:00
|
|
|
if [ ! "$(type -p git)" ]; then
|
2012-10-01 23:48:10 -05:00
|
|
|
echo "Cannot find the git binary! Is git installed and is in PATH?"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
get_active_submodules
|
|
|
|
get_configured_submodules
|
2013-02-09 12:09:32 -06:00
|
|
|
get_git_reference
|
2012-10-01 23:48:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-27 23:41:18 -05:00
|
|
|
|
2010-11-16 08:00:48 -06:00
|
|
|
# extra params for some commands, like log
|
|
|
|
EXTRA=
|
|
|
|
COMMAND="$1"
|
|
|
|
PAGER=
|
|
|
|
RELATIVIZE=1
|
|
|
|
PUSH_ALL=
|
2011-10-25 07:20:58 -05:00
|
|
|
PUSH_USER=
|
|
|
|
PUSH_NOTES=
|
|
|
|
LAST_WORKING=
|
|
|
|
SET_LAST_WORKING=
|
2010-11-16 08:00:48 -06:00
|
|
|
ALLOW_EMPTY=
|
2012-10-01 23:48:10 -05:00
|
|
|
KEEP_GOING=
|
2010-11-16 08:00:48 -06:00
|
|
|
REPORT_REPOS=1
|
2011-11-29 09:38:46 -06:00
|
|
|
REPORT_COMMANDS=0
|
2011-05-01 03:26:45 -05:00
|
|
|
REPORT_COMPACT=0
|
2011-08-27 23:41:18 -05:00
|
|
|
DO_HOOK_REFRESH=false
|
2023-02-22 05:15:06 -06:00
|
|
|
|
2010-11-16 08:00:48 -06:00
|
|
|
|
|
|
|
while [ "${COMMAND:0:1}" = "-" ] ; do
|
|
|
|
case "$COMMAND" in
|
2012-10-01 23:48:10 -05:00
|
|
|
-f )KEEP_GOING="||:"
|
2011-11-03 15:56:21 -05:00
|
|
|
;;
|
|
|
|
-z)
|
2018-07-02 11:11:22 -05:00
|
|
|
refresh_all_hooks
|
|
|
|
exit 0;
|
|
|
|
;;
|
|
|
|
--set-push-urls)
|
|
|
|
shift
|
|
|
|
PUSH_USER="$1"
|
|
|
|
if [ -n "${PUSH_USER}" ] ; then
|
|
|
|
PUSH_USER="${PUSH_USER}@"
|
|
|
|
fi
|
|
|
|
set_push_urls "$PUSH_USER"
|
|
|
|
exit 0;
|
2011-05-01 03:26:45 -05:00
|
|
|
;;
|
2018-07-02 11:11:22 -05:00
|
|
|
-*)
|
|
|
|
echo "option: $COMMAND not supported" 1>&2
|
|
|
|
exit 1
|
2010-11-16 08:00:48 -06:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
COMMAND="$1"
|
|
|
|
done
|
|
|
|
|
2012-10-01 23:48:10 -05:00
|
|
|
shift
|
|
|
|
|
2010-11-16 08:00:48 -06:00
|
|
|
case "$COMMAND" in
|
2012-10-01 23:48:10 -05:00
|
|
|
branch)
|
2018-07-02 11:11:22 -05:00
|
|
|
do_git_cmd "${COMMAND}" "$@"
|
|
|
|
;;
|
2012-10-01 23:48:10 -05:00
|
|
|
checkout)
|
2018-07-02 11:11:22 -05:00
|
|
|
do_checkout "$@"
|
|
|
|
;;
|
2012-10-01 23:48:10 -05:00
|
|
|
clone)
|
2018-07-02 11:11:22 -05:00
|
|
|
do_init_modules && refresh_all_hooks
|
2010-11-16 08:00:48 -06:00
|
|
|
;;
|
2012-10-01 23:48:10 -05:00
|
|
|
fetch)
|
2021-06-26 04:42:52 -05:00
|
|
|
(git fetch "$@" && git submodule foreach git fetch "$@" ) && git submodule update --progress
|
2012-10-01 23:48:10 -05:00
|
|
|
|
2018-07-02 11:11:22 -05:00
|
|
|
;;
|
2022-01-02 10:33:27 -06:00
|
|
|
gc)
|
|
|
|
(git gc "$@" && git submodule foreach git gc "$@" )
|
|
|
|
;;
|
2012-10-01 23:48:10 -05:00
|
|
|
grep)
|
|
|
|
KEEP_GOING="||:"
|
2018-07-02 11:11:22 -05:00
|
|
|
do_git_cmd "${COMMAND}" "$@"
|
|
|
|
;;
|
2012-10-01 23:48:10 -05:00
|
|
|
pull)
|
2021-06-26 04:42:52 -05:00
|
|
|
git pull "$@" && git submodule update --progress && refresh_all_hooks
|
2018-07-02 11:11:22 -05:00
|
|
|
;;
|
2010-11-16 08:00:48 -06:00
|
|
|
push)
|
2018-07-02 11:11:22 -05:00
|
|
|
git submodule foreach git push "$@"
|
|
|
|
if [ "$?" = "0" ] ; then
|
|
|
|
git push "$@"
|
|
|
|
fi
|
|
|
|
;;
|
2012-10-01 23:48:10 -05:00
|
|
|
reset)
|
2018-07-02 11:11:22 -05:00
|
|
|
do_reset
|
|
|
|
;;
|
2012-10-02 12:59:44 -05:00
|
|
|
tag)
|
2018-07-02 11:11:22 -05:00
|
|
|
do_git_cmd "${COMMAND}" "$@"
|
|
|
|
;;
|
|
|
|
"")
|
|
|
|
;;
|
2012-10-01 23:48:10 -05:00
|
|
|
*)
|
2018-07-02 11:11:22 -05:00
|
|
|
echo "./g does not support command: $COMMAND" 1>&2
|
|
|
|
exit 1;
|
2010-11-16 08:00:48 -06:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-10-01 23:48:10 -05:00
|
|
|
exit $?
|
2011-08-27 23:41:18 -05:00
|
|
|
|
2010-11-16 08:00:48 -06:00
|
|
|
# vi:set shiftwidth=4 expandtab:
|