If feature diff is called without arguments, compare the changes made in
this feature branch *including* the changes in the current working tree. If an explicit feature branch is named (may be a prefix of a branch name), the diff shows only changes that are already committed.
This commit is contained in:
parent
010252a8a9
commit
5474e46a73
1 changed files with 13 additions and 4 deletions
|
@ -358,11 +358,20 @@ cmd_track() {
|
|||
|
||||
cmd_diff() {
|
||||
parse_args "$@"
|
||||
expand_name_arg_prefix_or_current
|
||||
|
||||
# TODO: if this feature has been based on a non-develop branch, we really
|
||||
# should not be comparing to $DEVELOP. How to deal with this?
|
||||
git diff $DEVELOP_BRANCH..$BRANCH
|
||||
if [ "$NAME" != "" ]; then
|
||||
expand_name_arg_prefix_or_current
|
||||
BASE=$(git merge-base $DEVELOP_BRANCH $BRANCH)
|
||||
git diff $BASE..$BRANCH
|
||||
else
|
||||
CURRENT_BRANCH=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
|
||||
if ! echo "$CURRENT_BRANCH" | grep -q "^$PREFIX"; then
|
||||
die "Not on a feature branch. Name one explicitly."
|
||||
fi
|
||||
|
||||
BASE=$(git merge-base $DEVELOP_BRANCH HEAD)
|
||||
git diff $BASE
|
||||
fi
|
||||
}
|
||||
|
||||
cmd_rebase() {
|
||||
|
|
Loading…
Reference in a new issue