diff options
author | Karel Kočí <cynerd@email.cz> | 2020-11-26 12:24:29 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2020-11-26 12:24:29 +0100 |
commit | 254e1f09f97bfdf5e117a95103dad3fcd8b3eb5e (patch) | |
tree | 6cb4896c85b3608efae3160a215df158b0422734 /shellrc.d/git | |
parent | d348447017a03d2b5c267b4b3db67fb6931ee741 (diff) | |
download | shellrc-254e1f09f97bfdf5e117a95103dad3fcd8b3eb5e.tar.gz shellrc-254e1f09f97bfdf5e117a95103dad3fcd8b3eb5e.tar.bz2 shellrc-254e1f09f97bfdf5e117a95103dad3fcd8b3eb5e.zip |
git: protect against self-merge
Diffstat (limited to 'shellrc.d/git')
-rw-r--r-- | shellrc.d/git | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/shellrc.d/git b/shellrc.d/git index 3cf6117..7c34846 100644 --- a/shellrc.d/git +++ b/shellrc.d/git @@ -13,11 +13,15 @@ _gitbworktree() { gitbmerge() ( set -e [ -z "$(git log --grep="^fixup\!" HEAD.."$1")" ] || { - echo "First squash fixups!" + echo "First squash fixups!" >&2 return 1 } [ -z "$(git log --grep="^Apply .* suggestion(s) to " HEAD.."$1")" ] || { - echo "First squash suggestions!" + echo "First squash suggestions!" >&2 + return 1 + } + [ "$(git rev-parse HEAD)" != "$(git rev-parse "$1")" ] || { + echo "Nothing to merge! 🤷" >&2 return 1 } local wt |