|
|
4debce |
#!/bin/bash
|
|
|
4debce |
#
|
|
|
3b9515 |
# git.sh -- This function standardizes Git tasks inside the
|
|
|
4debce |
# repository.
|
|
|
4debce |
#
|
|
|
e6bbbf |
# Copyright (C) 2009-2013 The CentOS Project
|
|
|
4debce |
#
|
|
|
4debce |
# This program is free software; you can redistribute it and/or modify
|
|
|
4debce |
# it under the terms of the GNU General Public License as published by
|
|
|
4debce |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
4debce |
# your option) any later version.
|
|
|
4debce |
#
|
|
|
4debce |
# This program is distributed in the hope that it will be useful, but
|
|
|
4debce |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4debce |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
4debce |
# General Public License for more details.
|
|
|
4debce |
#
|
|
|
4debce |
# You should have received a copy of the GNU General Public License
|
|
|
4debce |
# along with this program; if not, write to the Free Software
|
|
|
4debce |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
4debce |
#
|
|
|
4debce |
# ----------------------------------------------------------------------
|
|
|
4debce |
# $Id$
|
|
|
4debce |
# ----------------------------------------------------------------------
|
|
|
4debce |
|
|
|
3b9515 |
function git {
|
|
|
4debce |
|
|
|
384602 |
# Redefine positional parameters using ARGUMENTS. At this point,
|
|
|
384602 |
# option arguments have been removed from ARGUMENTS variable and
|
|
|
384602 |
# only non-option arguments remain in it.
|
|
|
384602 |
eval set -- "$ARGUMENTS"
|
|
|
384602 |
|
|
|
67fdb3 |
# Don't realize action value verification here. There are actions
|
|
|
67fdb3 |
# like `copy' and `rename' that require two arguments from which
|
|
|
67fdb3 |
# the last one doesn't exist at the moment of executing the
|
|
|
67fdb3 |
# command. This will provoke the second action value verification
|
|
|
67fdb3 |
# to fail when indeed is should not. Thus, go to action names
|
|
|
67fdb3 |
# processing directly.
|
|
|
67fdb3 |
|
|
|
de6ddf |
# All git actions will be performed against the working copy.
|
|
|
de6ddf |
# Otherwise, errors like `fatal: Not a git repository (or any of
|
|
|
de6ddf |
# the parent directories): .git' or `Unable to determine absolute
|
|
|
de6ddf |
# path of git directory' might occur. So, move from whenever you
|
|
|
de6ddf |
# be right now up to the git working copy.
|
|
|
de6ddf |
pushd ${TCAR_WORKDIR} > /dev/null
|
|
|
de6ddf |
|
|
|
67fdb3 |
# Execute action names. This is required in order to realize
|
|
|
67fdb3 |
# actions like copy and rename which need two values as argument.
|
|
|
67fdb3 |
# Otherwise, it wouldn't be possible to execute them because
|
|
|
67fdb3 |
# action values would be processed one a time. Thus, lets work
|
|
|
67fdb3 |
# with `$@' instead.
|
|
|
67fdb3 |
for ACTIONNAM in $ACTIONNAMS;do
|
|
|
67fdb3 |
$ACTIONNAM "$@"
|
|
|
384602 |
done
|
|
|
4debce |
|
|
|
de6ddf |
# Return to the place you were initially.
|
|
|
de6ddf |
popd > /dev/null
|
|
|
de6ddf |
|
|
|
4debce |
}
|