From bc24dc9365b8a2e1e31297cf3e5884bbe28e8f05 Mon Sep 17 00:00:00 2001 From: juanjp600 Date: Mon, 25 Mar 2019 10:58:15 -0300 Subject: [PATCH] (a123b392c) Fixes to pretty script --- git-strip-merge-pretty | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/git-strip-merge-pretty b/git-strip-merge-pretty index 50f715efc..aa64a262e 100644 --- a/git-strip-merge-pretty +++ b/git-strip-merge-pretty @@ -126,9 +126,15 @@ branchshortsha="${branchsha:0:7}" #assumes that the commit message starts with hash1...hash2 prevcommitmsg="$(git log -1 --pretty=%B)" prevcommitsha="${prevcommitmsg:10:7}" +firstmsgchar="${prevcommitmsg:1:1}" +if [ $firstmsgchar = "(" ]; then + prevcommitsha="${prevcommitmsg:1:7}" +fi +exit 1 #create a commit message for out new "merge commit" # hash1...hash2 + logs of the merged commits +echo "$prevcommitsha...$branchsha" logmsg="$(git log "$prevcommitsha"..."$branchsha" --pretty=oneline --abbrev-commit --reverse)" rm -rf temp.txt @@ -155,7 +161,7 @@ while read p; do git merge -m "$msgmerge" -X theirs "--squash" "$newsha" git checkout HEAD .gitignore - git commit -m "$currMsg" + git commit -m "($currHash) $currMsg" done < "temp.txt" rm -rf temp.txt