[git] shellcheck, minor changes
This commit is contained in:
parent
849f7d29fa
commit
81b60c133a
|
@ -43,21 +43,21 @@ if [ "$HEADER" != "" ] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for TAG in $(git tag -l | sort -r) ; do
|
for TAG in $(git tag -l | sort -r) ; do
|
||||||
if echo $TAG | egrep '^v[0-9]+(\.[0-9]+)+$' >/dev/null ; then
|
if echo "$TAG" | grep -Eq '^v[0-9]+(\.[0-9]+)+$' ; then
|
||||||
# Display current tag's name
|
# Display current tag's name
|
||||||
echo $TAG >&2
|
echo "$TAG" >&2
|
||||||
|
|
||||||
# Print empty lines if needed
|
# Print empty lines if needed
|
||||||
if [ $PRINTNL -eq 1 ] ; then
|
if [ $PRINTNL -eq 1 ] ; then
|
||||||
i=0
|
i=0
|
||||||
while [ $i -lt $NEWLINES ] ; do
|
while [ $i -lt $NEWLINES ] ; do
|
||||||
echo
|
echo
|
||||||
i=`expr $i + 1`
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Print the tag message
|
# Print the tag message
|
||||||
git tag -l $TAG -n$NBLINES | sed 's/ \+$//'
|
git tag -l "$TAG" -n$NBLINES | sed 's/ \+$//'
|
||||||
|
|
||||||
PRINTNL=1
|
PRINTNL=1
|
||||||
else
|
else
|
||||||
|
|
|
@ -11,9 +11,16 @@
|
||||||
# This script moves a commit from a branch head to another. It is
|
# This script moves a commit from a branch head to another. It is
|
||||||
# the equivalent of git cherry-pick followed by git reset.
|
# the equivalent of git cherry-pick followed by git reset.
|
||||||
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
USAGE=$(cat <<EOF
|
||||||
|
Usage:
|
||||||
|
$0 <src-branch> <dst-branch> [ reset-arg ]
|
||||||
|
|
||||||
|
'reset-arg' is passed to the final reset (can be --hard for example).
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
assert_branch_exists()
|
assert_branch_exists()
|
||||||
{
|
{
|
||||||
if ! git for-each-ref refs/heads | grep "/${1}$" >/dev/null ; then
|
if ! git for-each-ref refs/heads | grep "/${1}$" >/dev/null ; then
|
||||||
|
@ -23,14 +30,10 @@ assert_branch_exists()
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -lt 2 ] ; then
|
if [ $# -lt 2 ] ; then
|
||||||
echo "Usage:"
|
printf '%s\n' "$USAGE" >&2
|
||||||
echo " $0 <src-branch> <dst-branch> [ reset-arg ]"
|
|
||||||
echo -n "'reset-arg' is passed to the final reset"
|
|
||||||
echo " (can be --hard for example)."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
assert_branch_exists "$1"
|
assert_branch_exists "$1"
|
||||||
SRC="$1"
|
SRC="$1"
|
||||||
shift
|
shift
|
||||||
|
@ -43,4 +46,4 @@ shift
|
||||||
git checkout "$DST"
|
git checkout "$DST"
|
||||||
git cherry-pick "$SRC"
|
git cherry-pick "$SRC"
|
||||||
git checkout "$SRC"
|
git checkout "$SRC"
|
||||||
git reset $1 HEAD^
|
git reset "$1" HEAD^
|
||||||
|
|
|
@ -16,9 +16,16 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
USAGE=$(cat <<EOF
|
||||||
|
Usage:
|
||||||
|
$0 <main_branch> <topic_branch>"
|
||||||
|
|
||||||
|
<main_branch> will be fast-forwarded to <topic_branch> if possible."
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
if [ $# -ne 2 ] ; then
|
if [ $# -ne 2 ] ; then
|
||||||
echo "Usage: $0 <main_branch> <topic_branch>"
|
printf '%s\n' "$USAGE" >&2
|
||||||
echo "<main_branch> will be fast-forwarded to <topic_branch> if possible."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -29,10 +36,10 @@ echo "Trying to merge $TOPIC_BRANCH into $MAIN_BRANCH..."
|
||||||
|
|
||||||
DIFF="$(git rev-list "$TOPIC_BRANCH".."$MAIN_BRANCH")"
|
DIFF="$(git rev-list "$TOPIC_BRANCH".."$MAIN_BRANCH")"
|
||||||
if [ -z "$DIFF" ] ; then
|
if [ -z "$DIFF" ] ; then
|
||||||
echo "$TOPIC_BRANCH contains all the commits of $MAIN_BRANCH."
|
echo -- "$TOPIC_BRANCH contains all the commits of $MAIN_BRANCH."
|
||||||
echo "Fast-forwarding $MAIN_BRANCH to $TOPIC_BRANCH."
|
echo "Fast-forwarding $MAIN_BRANCH to $TOPIC_BRANCH."
|
||||||
git branch -f "$MAIN_BRANCH" "$TOPIC_BRANCH"
|
git branch -f "$MAIN_BRANCH" "$TOPIC_BRANCH"
|
||||||
else
|
else
|
||||||
echo "$TOPIC_BRANCH does not contain all the commits of $MAIN_BRANCH."
|
echo -- "$TOPIC_BRANCH does not contain all the commits of $MAIN_BRANCH."
|
||||||
echo "Fast-forward impossible, aborting."
|
echo "Fast-forward impossible, aborting."
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -17,16 +17,21 @@ set -e
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
if [ $# -ne 1 ] ; then
|
if [ $# -ne 1 ] ; then
|
||||||
echo "Usage: $0 <tag-name>"
|
echo "Usage: $0 <tag-name>" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TAG=$1
|
commiter_date()
|
||||||
|
{
|
||||||
|
git tag -v "$TAG" 2>/dev/null | grep ^tagger | cut -f5- -d' '
|
||||||
|
}
|
||||||
|
|
||||||
GIT_COMMITTER_DATE="$(git tag -v $TAG 2>/dev/null|grep ^tagger | cut -f5- -d' ')"
|
TAG="$1"
|
||||||
|
|
||||||
|
GIT_COMMITTER_DATE="$(commiter_date)"
|
||||||
export GIT_COMMITTER_DATE
|
export GIT_COMMITTER_DATE
|
||||||
git tag -sf $TAG $TAG
|
git tag -sf "$TAG" "$TAG"
|
||||||
|
|
||||||
echo "Old tag commiter date: $GIT_COMMITTER_DATE"
|
echo "Old tag commiter date: $GIT_COMMITTER_DATE"
|
||||||
GIT_COMMITTER_DATE="$(git tag -v $TAG 2>/dev/null|grep ^tagger | cut -f5- -d' ')"
|
GIT_COMMITTER_DATE="$(commiter_date)"
|
||||||
echo "New tag commiter date: $GIT_COMMITTER_DATE"
|
echo "New tag commiter date: $GIT_COMMITTER_DATE"
|
||||||
|
|
Loading…
Reference in New Issue