mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
Merge pull request #1 from spacewander/better-changelog-fixes
Add support for git version below 2.2.0
This commit is contained in:
commit
fcbb25a882
|
|
@ -195,17 +195,17 @@ commitList() {
|
|||
#
|
||||
# Tags look like this:
|
||||
#
|
||||
# >git log --tags --simplify-by-decoration --date="short" --pretty="format:%h$%x09%ad$%x09%D"
|
||||
# >git log --tags --simplify-by-decoration --date="short" --pretty="format:%h$%x09%ad$%x09%d"
|
||||
#
|
||||
# ecf1f2b$ 2015-03-15$ HEAD, tag: v1.0.1, origin/master, origin/HEAD, master, hotfix/1.0.2
|
||||
# a473e9c$ 2015-03-04$ tag: v1.0.0
|
||||
# f2cb562$ 2015-02-19$ tag: v0.9.2
|
||||
# 6197c2b$ 2015-02-19$ tag: v0.9.1
|
||||
# 1e5f5e6$ 2015-02-16$ tag: v0.9.0
|
||||
# 3de8ab5$ 2015-02-11$ origin/feature/restore-auto
|
||||
# a15afd1$ 2015-02-02$ origin/feature/versionable
|
||||
# 38a44e0$ 2015-02-02$ origin/feature/save-auto
|
||||
# 3244b80$ 2015-01-16$ origin/feature/silent-history, upstream
|
||||
# ecf1f2b$ 2015-03-15$ (HEAD, tag: v1.0.1, origin/master, origin/HEAD, master, hotfix/1.0.2)
|
||||
# a473e9c$ 2015-03-04$ (tag: v1.0.0)
|
||||
# f2cb562$ 2015-02-19$ (tag: v0.9.2)
|
||||
# 6197c2b$ 2015-02-19$ (tag: v0.9.1)
|
||||
# 1e5f5e6$ 2015-02-16$ (tag: v0.9.0)
|
||||
# 3de8ab5$ 2015-02-11$ (origin/feature/restore-auto)
|
||||
# a15afd1$ 2015-02-02$ (origin/feature/versionable)
|
||||
# 38a44e0$ 2015-02-02$ (origin/feature/save-auto)
|
||||
# 3244b80$ 2015-01-16$ (origin/feature/silent-history, upstream)
|
||||
# 85e45f8$ 2014-08-25$
|
||||
#
|
||||
# The most-recent tag will be preceded by "HEAD, " if there have been zero
|
||||
|
|
@ -217,6 +217,9 @@ commitList() {
|
|||
local _tag_regex='^[[:alnum:][:blank:][:punct:]]+/.*'
|
||||
while IFS=$'\t' read _ref _date _tag; do
|
||||
[[ -z "${_tag}" ]] && continue
|
||||
# strip out tags form ()
|
||||
# git v2.2.0+ supports '%D', like '%d' without the " (", ")" wrapping. One day we should use it instead.
|
||||
_tag="${_tag:2:-1}"
|
||||
# trap tag if it points to last commit (HEAD)
|
||||
_tag="${_tag##HEAD, }"
|
||||
# strip out any additional tags pointing to same commit, remove tag label
|
||||
|
|
@ -226,7 +229,7 @@ commitList() {
|
|||
# add tag to assoc array; copy tag to tag_list_keys for ordered iteration
|
||||
tags_list+=( "${_tag}:${_ref}=>${_date}" )
|
||||
tags_list_keys+=( "${_tag}" )
|
||||
done <<< "$(git log --tags --simplify-by-decoration --date="short" --pretty="format:%h${_tab}%ad${_tab}%D")"
|
||||
done <<< "$(git log --tags --simplify-by-decoration --date="short" --pretty="format:%h${_tab}%ad${_tab}%d")"
|
||||
IFS="$defaultIFS"
|
||||
unset _tag_regex
|
||||
unset _ref _date _tag _tab
|
||||
|
|
|
|||
Loading…
Reference in a new issue