From 6f1a05813d2c565d9c7da75968652b372612e673 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Thu, 5 Aug 2010 08:08:49 -0700 Subject: [PATCH] Added git-changelog. Closes #1 --- History.md | 17 +++++++++++++++++ Makefile | 2 ++ Readme.md | 36 ++++++++++++++++++++++++++++++++++++ bin/git-changelog | 22 ++++++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100755 bin/git-changelog diff --git a/History.md b/History.md index e69de29bb..ede688dc3 100644 --- a/History.md +++ b/History.md @@ -0,0 +1,17 @@ + +0.0.1 / 2010-08-05 +================== + + * Docs for git-ignore. Closes #3 + * Merge branch 'ignore' + * Added git-ignore + * Readme typo + * Fixed in docs + * Install docs + * Merge branch 'release' + * Added git-release + * Fixed readme + * Readme + * Passing args to git shortlog + * Added --all support to git-count + * Initial commit diff --git a/Makefile b/Makefile index be910a63b..c3a5485b7 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ PREFIX = /usr/local BINS = bin/git-count \ bin/git-ignore \ + bin/git-changelog \ bin/git-release install: @@ -11,6 +12,7 @@ install: uninstall: rm -f $(PREFIX)/bin/git-count rm -f $(PREFIX)/bin/git-ignore + rm -f $(PREFIX)/bin/git-changelog rm -f $(PREFIX)/bin/git-release .PHONY: install uninstall \ No newline at end of file diff --git a/Readme.md b/Readme.md index ad2501ab4..efcefb8b0 100644 --- a/Readme.md +++ b/Readme.md @@ -60,3 +60,39 @@ ... added 'build' ... added '*.o' ... added '*.log' + +## git-changelog + + Populates the file named matching _change|history -i_ with the commits +since the previous tag or since the project began when no tags are present. Opens the changelog in **$EDITOR** when set. + + $ git changelog + + n.n.n / 2010-08-05 + ================== + + * Docs for git-ignore. Closes #3 + * Merge branch 'ignore' + * Added git-ignore + * Fixed in docs + * Install docs + * Merge branch 'release' + * Added git-release + * Passing args to git shortlog + * Added --all support to git-count + * Initial commit + + Listing commits: + + $ git changelog --list + + * Docs for git-ignore. Closes #3 + * Merge branch 'ignore' + * Added git-ignore + * Fixed in docs + * Install docs + * Merge branch 'release' + * Added git-release + * Passing args to git shortlog + * Added --all support to git-count + * Initial commit diff --git a/bin/git-changelog b/bin/git-changelog new file mode 100755 index 000000000..e1b786f49 --- /dev/null +++ b/bin/git-changelog @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +CHANGELOG=`ls | egrep 'change|history' -i` +DATE=`date +'%Y-%m-%d'` +HEAD="\nn.n.n / $DATE \n==================\n" + +if test "$1" = "--list"; then + version=`git tag | tail -n 1` + if test -z "$version"; then + git log --pretty="format: * %s" + else + git log --pretty="format: * %s" $version.. + fi +else + tmp="/tmp/changelog" + echo $HEAD > $tmp + git-changelog --list >> $tmp + echo '' >> $tmp + cat $CHANGELOG >> $tmp + mv $tmp $CHANGELOG + test -n "$EDITOR" && $EDITOR $CHANGELOG +fi \ No newline at end of file