From bda4633633a0701bbd2f7861674a8e612d961fb7 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sat, 5 Dec 2015 00:37:31 +0100 Subject: [PATCH] improvements: - nicer file list. - relative urls, dont use base href. - add link to plain files, files should be checked out in "file" dir. - strip .git from bare repos. - simplify part of commit per file, just link to commit + file anchor (WIP). --- urmoms | 74 ++++++++++++++++++++++++++++++++------------------------------------------ 1 file changed, 32 insertions(+), 42 deletions(-) diff --git a/urmoms b/urmoms index dceb941..4243687 100755 --- a/urmoms +++ b/urmoms @@ -16,18 +16,17 @@ header() { ${name} - ${description} -
-

${name}

+

${name}

${description}
-Log | -Files | -Stats | -README | -LICENSE +Log | +Files | +Stats | +README | +LICENSE

@@ -37,8 +36,6 @@ header() {
 footer() {
 	cat <
-
-
Powered by urmoms vibrator
!__EOF__ @@ -56,58 +53,49 @@ mkdir -p "${htmldir}" # repodir must be a directory to go to. cd "$1" || usage -# project name -# TODO: if bare repo just remove .git suffix? -name=$(basename "$(pwd)") +# default index page (symlink). +indexpage="log.html" + +# project name, if bare repo remove .git suffix. +name=$(basename "$(pwd)" ".git") # read .git/description. description="" test -f ".git/description" && description="$(cat '.git/description')" -# TODO: make configurable. -baseurl="http://cow.codemadness.org/gitlog/" - -indexpage="log.html" - -firstcommit=$(git log | grep '^commit ' | tail -n 1 | cut -f 2 -d ' ') - -# make log per file. -# TODO: just link to commit/commit? save some space and time? -git ls-tree -r --name-only master | while read -r file; do - test -e "${htmldir}/file/${file}.html" && continue - - d=$(dirname "${file}") - mkdir -p "${htmldir}/file/${d}" - - header > "${htmldir}/file/${file}.html" - git show "${firstcommit}"...master "${file}" | \ - sed -E 's@^commit (.*)$@commit \1@g' >> "${htmldir}/file/${file}.html" - footer >> "${htmldir}/file/${file}.html" -done - -# make log with all commits. -header > "${htmldir}/log.html" -printf '' >> "${htmldir}/log.html" -git log --pretty='' >> "${htmldir}/log.html" -printf '
%cD%H%an%s
' >> "${htmldir}/log.html" -footer >> "${htmldir}/log.html" - # make diff for each commit (all files). +relpath="../" mkdir -p "${htmldir}/commit" git log --pretty='%H' | while read -r commit; do test -e "${htmldir}/commit/${commit}.html" && continue + header > "${htmldir}/commit/${commit}.html" - git show "${commit}" >> "${htmldir}/commit/${commit}.html" + git show --pretty=full "${commit}" | \ + sed -E 's@^commit (.*)$@commit \1@g' >> "${htmldir}/commit/${commit}.html" footer >> "${htmldir}/commit/${commit}.html" done +# make log with all commits. +relpath="" +header > "${htmldir}/log.html" +printf '' >> "${htmldir}/log.html" +git log --pretty='' >> "${htmldir}/log.html" +printf '
%cr%H%an%s
' >> "${htmldir}/log.html" +footer >> "${htmldir}/log.html" + # make index with file links. +relpath="" header >> "${htmldir}/files.html" -git ls-tree -r master | sed -E 's@ (.*)$@ \1@g' >> "${htmldir}/files.html" +printf '' >> "${htmldir}/files.html" +git ls-tree -r -l master | while read -r mode type object size file; do + git log -1 --pretty='' "${file}" +done >> "${htmldir}/files.html" +printf '
ModeNameSize
'${mode}''${file}''${size}'[plain]
' >> "${htmldir}/files.html" footer >> "${htmldir}/files.html" # readme page # find README file. +relpath="" readme="" for f in README README.md readme.md; do test -e "${f}" && readme="${f}" @@ -123,6 +111,7 @@ footer >> "${htmldir}/readme.html" # license page # find LICENSE file. +relpath="" license="" for f in LICENSE LICENSE.md; do test -e "${f}" && license="${f}" @@ -137,6 +126,7 @@ fi footer >> "${htmldir}/license.html" # stats (authors). +relpath="" header > "${htmldir}/stats.html" git shortlog -n -s >> "${htmldir}/stats.html" footer >> "${htmldir}/stats.html" -- libgit2 1.1.1