diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-16 12:12:24 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-16 12:12:24 -0700 |
commit | 0ff66cd998f5fcaac2533e37881ccb5695307e75 (patch) | |
tree | 2c43208deb60d8fb0ded7cebd5af73148d383355 /bin/git-merge-ff | |
parent | 14a0aa01445f8f20f99bba31ebc520330eb47d6f (diff) | |
download | dotfiles-0ff66cd998f5fcaac2533e37881ccb5695307e75.tar.gz |
git-merge-ff doesn't output a diff when nothing changed
Diffstat (limited to 'bin/git-merge-ff')
-rwxr-xr-x | bin/git-merge-ff | 9 |
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 |