summaryrefslogtreecommitdiff
path: root/bin/git-merge-ff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-02-16 12:12:24 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-02-16 12:12:24 -0700
commit0ff66cd998f5fcaac2533e37881ccb5695307e75 (patch)
tree2c43208deb60d8fb0ded7cebd5af73148d383355 /bin/git-merge-ff
parent14a0aa01445f8f20f99bba31ebc520330eb47d6f (diff)
downloaddotfiles-0ff66cd998f5fcaac2533e37881ccb5695307e75.tar.gz
git-merge-ff doesn't output a diff when nothing changed
Diffstat (limited to 'bin/git-merge-ff')
-rwxr-xr-xbin/git-merge-ff9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/git-merge-ff b/bin/git-merge-ff
index d2179bc5..5640d513 100755
--- a/bin/git-merge-ff
+++ b/bin/git-merge-ff
@@ -5,6 +5,9 @@
# modified by spwhitton to default to $branch@{u} at the suggestion of
# orip on Stack Overflow
+# modified by spwhitton not to output a diff when the fast-forward
+# didn't change anything
+
_usage() {
echo "Usage: git merge-ff <branch> [<committish-to-merge>]" 1>&2
exit 1
@@ -33,6 +36,12 @@ _merge_ff() {
echo "Error: merging $commit into $branch would not be a fast-forward" 1>&2
exit 1
fi
+ if [ "$commit_orig_hash" = "$branch_orig_hash" ]; then
+ if [ -z $quiet ]; then
+ echo "Info: $branch already up-to-date"
+ fi
+ exit 0
+ fi
echo "Updating ${branch_orig_hash:0:7}..${commit_orig_hash:0:7}"
if git update-ref -m "merge $commit: Fast forward" "refs/heads/$branch" "$commit_orig_hash" "$branch_orig_hash"; then
if [ -z $quiet ]; then