Skip to content

Commit

Permalink
fix: multi-line tag message when using -m
Browse files Browse the repository at this point in the history
* fix: multi-line tag message when using -m

Gitflow release finish and hotfix finish allow for a tag message to be
entered from the command line. Currently only the last messeage is read
by git flow if multiple messages are passed in on the command line.

The git binary does not allow for the use of the \n escape sequence when
entering a message from the command line via -m. As a result multiple
invocations of the option must be used for a multi-line commit message.

As a workaround when using the git binary directly we can use printf
inside of the commit message to properly handle \n escape codes. This
allows for a single invocation of -m. To use this workaround inside of
the double quotes we use $(printf 'line of text with \n escape codes
placed as needed for proper formating of the message')

This commit will add the above workaround when entering a tag message
from the command line for release finish and hotfix finish.

* docs: add snapshot release to changelog

* chore: bump version to snapshot release
  • Loading branch information
ChrisJStone authored Jun 30, 2023
1 parent eca1cb9 commit 8124333
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

#### 2.1.0-SNAPSHOT
* fix: multi-line tag message when using -m

**NOTE:** The format for a multi-line tag message is now "$(printf 'line of text with \n escape codes placed as needed for proper formating of the message')"


#### 2.0.1
* fix incorrect version identification along with updating source repository in gitflow-installer. Corrections pointed out by [bobstuart](https://github.com/bobstuart)

Expand Down
2 changes: 1 addition & 1 deletion git-flow-hotfix
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ T,tagname! Use given tag name
opts="$opts -m '$FLAGS_message'"
fi
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git_do tag $opts "$VERSION_PREFIX$TAGNAME" || die "Tagging failed. Please run finish again to retry."
eval git_do tag "$opts" "$VERSION_PREFIX$TAGNAME" || die "Tagging failed. Please run finish again to retry."
fi
fi

Expand Down
6 changes: 3 additions & 3 deletions git-flow-release
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ _finish_from_develop() {
opts="$opts -m $VERSION_PREFIX$TAGNAME"
fi
fi
eval git_do tag $opts "$VERSION_PREFIX$TAGNAME" || die "Tagging failed. Please run finish again to retry."
eval git_do tag "$opts" "$VERSION_PREFIX$TAGNAME" || die "Tagging failed. Please run finish again to retry."
fi
fi

Expand Down Expand Up @@ -342,7 +342,7 @@ _finish_base() {
opts="$opts -m $VERSION_PREFIX$TAGNAME"
fi
fi
eval git_do tag $opts "$VERSION_PREFIX$TAGNAME" || die "Tagging failed. Please run finish again to retry."
eval git_do tag "$opts" "$VERSION_PREFIX$TAGNAME" || die "Tagging failed. Please run finish again to retry."
fi
fi

Expand Down Expand Up @@ -889,7 +889,7 @@ S,[no]squash Squash release during merge
opts="$opts -m '$FLAGS_message'"
fi
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git_do tag $opts "$VERSION_PREFIX$VERSION" || die "Tagging failed. Please run finish again to retry."
eval git_do tag "$opts" "$VERSION_PREFIX$VERSION" || die "Tagging failed. Please run finish again to retry."
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion git-flow-version
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#


GITFLOW_VERSION=2.0.1
GITFLOW_VERSION=2.1.0-SNAPSHOT

initialize() {
# A function can not be empty. Comments count as empty.
Expand Down

0 comments on commit 8124333

Please sign in to comment.