Merge pull request #813 from spacewander/release-fix

some fixes before release
This commit is contained in:
罗泽轩 2019-12-21 13:42:51 +08:00 committed by GitHub
commit 2c689db6d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 23 deletions

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
inverse=$(tput rev)
reset=$(tput sgr0)
txtbld=$(tput bold)
bldred=${txtbld}$(tput setaf 1)
txtbld=$(tput bold)
bldred=${txtbld}$(tput setaf 1)
# default option settings
guardedmode=false
@ -25,13 +25,23 @@ usage() {
function addworkspace {
git config --global bulkworkspaces."$wsname" "$wsdir";
if [ ! -z "$source" ]; then
if ! cd "$wsdir" 2>/dev/null; then echo "Path of workspace doesn't exist, make it first."; exit 1; fi
regex='http(s)?://|ssh://|(git@)?.*:.*/.*'
if [[ "$source" =~ $regex ]]; then git clone "$source";
elif [ -f "$source" ]; then while read line; do git clone "$line"; done < "$source";
else echo 1>&2 "format of URL or file unknown";
fi
fi
if [ ! -d "$wsdir" ]; then echo "Path of workspace doesn't exist, make it first."; exit 1; fi
regex='http(s)?://|ssh://|(git@)?.*:.*/.*'
if [[ "$source" =~ $regex ]]; then
pushd "$wsdir" > /dev/null
git clone "$source"
popd > /dev/null
else
source=$(realpath "$source" 2>/dev/null)
if [ -f "$source" ]; then
pushd "$wsdir" > /dev/null
while read -r line; do git clone "$line"; done < "$source";
popd > /dev/null
else
echo 1>&2 "format of URL or file unknown"
fi
fi
fi
}
# add current directory
@ -82,7 +92,7 @@ function checkWSName () {
if [[ $rwsname == "$wsname" ]]; then return; fi
done <<< "$(echo "$(listall)")"
# when here the ws name was not found
usage && echo "error: unknown workspace name: $wsname" && exit 1
usage && echo "error: unknown workspace name: $wsname" && exit 1
}
# parse out wsname from workspacespec
@ -109,7 +119,7 @@ function allowedargcount () {
if [ $paramcount -ne $1 ] && [ $paramcount -ne $2 ]; then
echo 1>&2 "error: wrong number of arguments" && usage;
exit 1;
fi
fi
}
# execute the bulk operation
@ -130,8 +140,8 @@ function executBulkOp () {
echo "Current repository: ${leadingpath%/*}/${bldred}${curdir##*/}${reset}"
guardedExecution
eval cd "\"$rwsdir\"" # back to origin location of last find command
done
done
done
done
}
paramcount="${#}"
@ -145,19 +155,19 @@ while [ "${#}" -ge 1 ] ; do
--listall|--purge)
butilcommand="${1:2}" && break ;;
--removeworkspace|--addcurrent|--addworkspace)
butilcommand="${1:2}" && wsname="$2" && wsdir="$3" && if [ "$4"=="--from" ]; then source="$5"; fi && break ;;
-a)
butilcommand="${1:2}" && wsname="$2" && wsdir="$3" && if [ "$4" == "--from" ]; then source="$5"; fi && break ;;
-a)
allwsmode=true ;;
-g)
-g)
guardedmode=true ;;
-w)
-w)
singlemode=true && shift && wsname="$1" && checkWSName ;;
-*)
-*)
usage && echo 1>&2 "error: unknown argument $1" && exit 1 ;;
--*)
--*)
usage && echo 1>&2 "error: unknown argument $1" && exit 1 ;;
*) # git core commands
butilcommand="executBulkOp" && corecommand="$1" && gitcommand="$@" && break ;;
butilcommand="executBulkOp" && corecommand="$1" && gitcommand="$*" && break ;;
esac && shift
done
@ -165,7 +175,7 @@ done
if $allwsmode && $singlemode; then echo 1>&2 "error: options -w and -a are incompatible" && exit 1; fi
# if single mode check the supplied workspace name
if $singlemode; then echo "Selected single workspace mode in workspace: $wsname" && checkWSName; fi
if $singlemode; then echo "Selected single workspace mode in workspace: $wsname" && checkWSName; fi
# check right number of arguments
case $butilcommand in

View file

@ -9,7 +9,7 @@ test -z "$coauthor" && echo "co-author required." 1>&2 && exit 1
test -z "$email" && echo "co-author email required." 1>&2 && exit 1
old_message="$(git log --format=%B -n1)"
if [[ $old_message == *"Co-authored-by:"* ]]; then
if [[ "$old_message" == *"Co-authored-by:"* ]]; then
git commit --amend -m "$old_message
Co-authored-by: $coauthor <$email>"
else

View file

@ -1,5 +1,11 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if ! command -v pastebinit >/dev/null 2>&1; then
echo >&2 "To run 'git paste', you need to install pastebinit in your system"
exit 1
fi
test $# -ne 0 || set -- '@{u}'
git format-patch --stdout "$@" | pastebinit -f diff

View file

@ -7,7 +7,8 @@ usage() {
Usage:
git standup [-a <author name>] [-w <weekstart-weekend>] [-d <days-ago>] [-m <max-dir-depth>] [-g] [-h] [-f] [-B] [-n <number-of-commits]
-a - Specify author to restrict search to
-a - Specify author to restrict search to, default to current git user.
Use "-a all" if you don't want the restriction.
-w - Specify weekday range to limit search to
-m - Specify the depth of recursive directory search
-L - Toggle inclusion of symbolic links in recursive directory search