Update git-changed to better recognize single commits

This commit is contained in:
ViViDboarder 2013-07-03 11:19:13 -07:00
parent 7dcfe1e2d9
commit c43853e2fe
1 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,13 @@
# Description: Simple command to generate lists of
# changed files. Designed to work with AbuseTheForce
###############################
gitismerge () {
local sha=$1
msha=$(git rev-list --merges ${sha}...${sha}~1)
# If commit returned is the one passed it, it is a merge
[ -z "$msha" ] && return 1
return 0
}
if [ -z "$1" ]; then
@ -21,7 +28,7 @@ if [ -z "$1" ]; then
fi
# If there is only one parameter, return the files changed in that commit
if [ -z "$2" ]; then
if [ -z "$2" ] && gitismerge $1; then
git diff-tree --no-commit-id --name-only $1
else
git diff --no-commit-id --name-only $1 $2