Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

shortlog > bbcode

all credit to haste
  • Loading branch information...
commit 2eaa5c5731741eb09f0d1a8af12c9984db187bc5 1 parent 429f538
@p3lim authored
Showing with 53 additions and 0 deletions.
  1. +2 −0  .gitconfig
  2. +51 −0 etc/shortlog
View
2  .gitconfig
@@ -11,3 +11,5 @@
interactive = true
[pack]
packSizeLimit = 2g
+[alias]
+ hist = !lua /etc/shortlog > changelog.txt
View
51 etc/shortlog
@@ -0,0 +1,51 @@
+local tags = {}
+do
+ for tag in io.popen('git tag'):lines() do
+ local split = tag:gmatch('[^.]+')
+ local major, minor = split(), split():gmatch('[^-]+')()
+
+ table.insert(tags, {
+ tag = tag,
+ major = major,
+ minor = minor
+ })
+ end
+
+ table.sort(tags, function(a, b)
+ a = a.major + a.minor
+ b = b.major + b.minor
+ return a > b
+ end)
+end
+
+local function GenerateLog(previous, current)
+ local insert = table.insert
+ local format = string.format
+
+ local out = {}
+
+ insert(out, format('[b]Changes in %s:[/b]', current))
+ insert(out, '[list]')
+
+ for line in io.popen(format('git shortlog %s..%s', previous, current)):lines() do
+ if(line:sub(1, 6) == ' ') then
+ local offset = line:match('() ', 7)
+ if(offset) then
+ line = line:sub(7, offset - 1)
+ else
+ line = line:sub(7)
+ end
+
+ insert(out, format(' [*] %s', line))
+ end
+ end
+
+ insert(out, '[/list]')
+
+ return table.concat(out, '\n')
+end
+
+for index = 2, #tags do
+ local current, previous = tags[index - 1], tags[index]
+ print(GenerateLog(previous.tag, current.tag))
+end
Please sign in to comment.
Something went wrong with that request. Please try again.