git log出力をasciidoc形式の変更ログにフォーマットしようとしています。私はgit log --formatを使ってこれを行っています。次に、件名にコミットメッセージのバグ番号を追加する必要があります。私は、これはAwkのを使用して行うことができるかどうかを知りたい後続の行マッチパターンのときに2行を結合する
* This is subject without issue number
+
There will be multiple lines of text and multiple paragraphs.
2nd paragraph of the commit message.
* This is commit with issue number
+
There can be multiple lines of comment message.
2nd paragraph of the commit message. A line with Bug: issue ###
will be the last line. I need to combine the issue ### with
the subject line.
Bug: issue 1234
* This is commit with issue number in Issue: 1235 format
+
There can be multiple lines of comment message.
2nd paragraph of the commit message. A line with Issue: ###
will be the last line. I need to combine the issue ### with
the subject line.
Issue: 1235
予想される出力
* This is subject without issue number
+
There will be multiple lines of text and multiple paragraphs.
2nd paragraph of the commit message.
* issue 1234 This is commit with issue number
+
There can be multiple lines of comment message.
2nd paragraph of the commit message. A line with Bug: issue ###
will be the last line. I need to combine the issue ### with
the subject line.
* issue 1235 This is commit with issue number in Issue: 1235 format
+
There can be multiple lines of comment message.
2nd paragraph of the commit message. A line with Issue: ###
will be the last line. I need to combine the issue ### with
the subject line.
:以下
入力は
git log --reverse --no-merges $1..$2 --format='* %s%n+%n%b' | \
sed -e '/^Change-Id:.*$/d' | sed -e '/^Signed-off-by:.*$/d'
入力例を使用して生成されます。あなたは上記を達成できるAwkコードを提供できますか?他のオプションは何ですか?私は、希望の出力を生成するシェルスクリプトを作成したいと思います。
ありがとう!これは非常に素晴らしい解決策です。私はこれに最初の部分をパイプするときに動作します。ただし、スクリプトは各件名の下に余分な空白行を生成します。別の条件を追加することはできますか?バグ情報はIssue:###の行に記述することができます。私はちょうど私が投稿した後にその事件を見つけた – DeenSeth