Commit 5474e46a authored by Vincent Driessen's avatar Vincent Driessen

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.
parent 010252a8
...@@ -358,11 +358,20 @@ cmd_track() { ...@@ -358,11 +358,20 @@ cmd_track() {
cmd_diff() { cmd_diff() {
parse_args "$@" parse_args "$@"
expand_name_arg_prefix_or_current
# TODO: if this feature has been based on a non-develop branch, we really if [ "$NAME" != "" ]; then
# should not be comparing to $DEVELOP. How to deal with this? expand_name_arg_prefix_or_current
git diff $DEVELOP_BRANCH..$BRANCH 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() { cmd_rebase() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment