pull/1473/head
cornfeedhobo 2020-01-04 09:41:55 -08:00
parent 3923d2d74b
commit c8d59d7e2d
No known key found for this signature in database
GPG Key ID: 724357093F994B26
1 changed files with 40 additions and 47 deletions

View File

@ -159,22 +159,16 @@ _bash-it-update-repo() {
local remote="${3:-origin}" local remote="${3:-origin}"
local old_pwd="${PWD}" local old_pwd="${PWD}"
if [[ ! -d "${dir}" ]] ; then cd "${dir}" || return 1
return 1
else
cd "${dir}"
git fetch &> /dev/null git fetch &> /dev/null
declare status declare status
status="$(git rev-list master.."${remote}"/master 2> /dev/null)" status="$(git rev-list master.."${remote}/master" 2> /dev/null)"
if [[ -n "${status}" ]]; then if [[ -n "${status}" ]]; then
for i in $(git rev-list --merges --first-parent master.."${remote}"); do for i in $(git rev-list --merges --first-parent "master..${remote}"); do
num_of_lines=$(git log -1 --format=%B "$i" | awk 'NF' | wc -l) num_of_lines=$(git log -1 --format=%B "$i" | awk 'NF' | wc -l)
if [ "$num_of_lines" -eq 1 ]; then if [ "$num_of_lines" -eq 1 ]; then
description="%s" description="%s"
@ -184,7 +178,7 @@ _bash-it-update-repo() {
git --no-pager log --format="%h: $description (%an)" -1 "$i" git --no-pager log --format="%h: $description (%an)" -1 "$i"
done done
echo "" echo ""
read -e -n 1 -p "Would you like to update to $(git log -1 --format=%h origin/master)? [Y/n] " RESP read -e -n 1 -p "Would you like to update to $(git log -1 --format=%h "${remote}/master")? [Y/n] " RESP
case $RESP in case $RESP in
[yY]|"") [yY]|"")
@ -209,5 +203,4 @@ _bash-it-update-repo() {
cd "${old_pwd}" &> /dev/null || return 1 cd "${old_pwd}" &> /dev/null || return 1
fi
} }