Skip to content

Commit

Permalink
HBASE-15725 make_patch.sh should add the branch name when -b is passed.
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottneilclark committed May 13, 2016
1 parent b353e38 commit 0e281e1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions dev-support/make_patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ while getopts "ahd:b:" opt; do
case "$opt" in
a) addendum='-addendum'
;;
d)
d)
patch_dir=$OPTARG
;;
b)
Expand Down Expand Up @@ -52,7 +52,7 @@ fi
# Exit if git status is dirty
git_dirty=$(git diff --shortstat 2> /dev/null | wc -l|awk {'print $1'})
echo "git_dirty is $git_dirty"
if [ "$git_dirty" -ne 0 ]; then
if [ "$git_dirty" -ne 0 ]; then
echo "Git status is dirty. Commit locally first.">&2
exit 1
fi
Expand Down Expand Up @@ -117,8 +117,15 @@ elif [ "$status" -ge 1 ]; then
fi
done
fi
# If this is against a tracking branch other than master
# include it in the patch name
tracking_suffix=""
if [[ $tracking_branch != "origin/master" \
&& $tracking_branch != "master" ]]; then
tracking_suffix="-${tracking_branch#origin/}"
fi

patch_name="$branch$prefix$addendum.patch"
patch_name="$branch$prefix$addendum$tracking_suffix.patch"

# Do we need to make a diff?
git diff --quiet $tracking_branch
Expand All @@ -134,10 +141,10 @@ local_commits=$(git log $tracking_branch..$branch|grep 'Author:'|wc -l|awk {'pri
if [ "$local_commits" -gt 1 ]; then
read -p "$local_commits commits exist only in your local branch. Interactive rebase?" yn
case $yn in
[Yy]* )
[Yy]* )
git rebase -i $tracking_branch
;;
[Nn]* )
[Nn]* )
echo "Creating $patch_dir/$patch_name using git diff."
git diff $tracking_branch > $patch_dir/$patch_name
exit 0
Expand All @@ -147,5 +154,3 @@ fi

echo "Creating patch $patch_dir/$patch_name using git format-patch"
git format-patch --stdout $tracking_branch > $patch_dir/$patch_name


0 comments on commit 0e281e1

Please sign in to comment.