Allow showing git diff interactively to inspect release commits.

This commit is contained in:
Matt Keeler 2018-06-20 16:06:43 -04:00
parent 74fe2fae8b
commit a127f167ee
2 changed files with 39 additions and 1 deletions

View File

@ -319,6 +319,39 @@ function git_log_summary {
return $ret
}
function git_diff {
# Arguments:
# $1 - Path to the git repo (optional - assumes pwd is git repo otherwise)
# $2 .. $N - Optional path specification
#
# Returns:
# 0 - success
# * - failure
#
local gdir="$(pwd)"
if test -d "$1"
then
gdir="$1"
fi
shift
pushd "${gdir}" > /dev/null
local ret=0
local head=$(git_branch) || ret=1
local upstream=$(git_upstream) || ret=1
if test ${ret} -eq 0
then
status "Git Diff - Paths: $@"
git diff ${HEAD} ${upstream} -- "$@" || ret=1
fi
return $ret
}
function normalize_git_url {
url="${1#https://}"
url="${url#git@}"

View File

@ -97,8 +97,13 @@ function confirm_git_push_changes {
ret=1
break
;;
?)
# bindata_assetfs.go will make these meaningless
git_diff "$(pwd)" ":!agent/bindata_assetfs.go"|| ret 1
answer=""
;;
* )
read -p "Are these changes correct? [y/n]: " answer
read -p "Are these changes correct? [y/n] (or type ? to show the diff output): " answer
;;
esac
done