diff --git a/git-quick-stats.1 b/git-quick-stats.1 index 417432e..55a05f6 100644 --- a/git-quick-stats.1 +++ b/git-quick-stats.1 @@ -1,4 +1,4 @@ -.TH git-quick-stats "1" "June 2021" "git-quick-stats" "User Commands" +.TH git-quick-stats "1" "April 2024" "git-quick-stats" "User Commands" .SH NAME .B git\-quick\-stats \- Simple and efficient way to access various stats in a git repository. @@ -95,7 +95,7 @@ displays a list of commits per year displays a list of commits per weekday .HP .PP -\fB\-W\fR, \fB\-\-commits\-by\author\-by\-weekday\fR +\fB\-W\fR, \fB\-\-commits\-by\-author\-by\-weekday\fR .IP displays a list of commits per weekday by author .HP diff --git a/tests/commands_test.sh b/tests/commands_test.sh index 456698e..bd55765 100755 --- a/tests/commands_test.sh +++ b/tests/commands_test.sh @@ -1,5 +1,13 @@ #!/bin/bash +# Verify we are in a git repo. Create one if not +# FIXME: All the paths are hardcoded currently and will break if anything +# in this chain moves or gets executed elsewhere. Adjust all of these so +# pathing does not matter as much such as creating a TOP variable that +# does something like TOP=$(cd "$(dirname "$0")" || exit ; pwd -P) +# or maybe leverages Make to handle these as test targets +./tests/test-git/resetgit + . tests/assert.sh -v src="./git-quick-stats" diff --git a/tests/test-git/resetgit b/tests/test-git/resetgit index 1a1da35..3e13b0a 100755 --- a/tests/test-git/resetgit +++ b/tests/test-git/resetgit @@ -1,17 +1,16 @@ #!/bin/sh -# Initialises a new local Git repo for test purpose. -if test -d ../test-git/.git; then rm -Rf ../test-git/.git; fi -#mkdir test-git -cd ../test-git -git init -git config user.name "$(printf %s 'Test Git,\nfor test purpose')" -git config user.email "TestGit\o/@example.org" +# Initialises a new local Git repo for test purpose if one does not exist already +if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + { + git init + git config user.name "$(printf %s 'Test Git,\nfor test purpose')" + git config user.email "TestGit\o/@example.org" -#printf '\n[user]\nname = test-git\nemail = test-git@example.org\n'> .git/config -printf 'test-git\n========\n' > README.md -git add README.md -git commit -m 'added readme (o\w/o)' -m 'in markdown, no \r\n, only \n' -m 'a very "simple" readme' -testChars="$(printf 'tab [%b] form feed [%b] line feed [%b] carriage return [%b]' '\x09' '\x0C' '\x0A' '\x0D')" -#printf '# testChars [%s]\n' "$testChars">&2 -git notes add -m 'Some notes' -m 'out of ascii: été au cœur' -m "$testChars" -git log + printf 'test-git\n========\n' > README.md + git add README.md + git commit -m 'added readme (o\w/o)' -m 'in markdown, no \r\n, only \n' -m 'a very "simple" readme' + testChars="$(printf 'tab [%b] form feed [%b] line feed [%b] carriage return [%b]' '\x09' '\x0C' '\x0A' '\x0D')" + git notes add -m 'Some notes' -m 'out of ascii: été au cœur' -m "$testChars" + git log + } >/dev/null 2>&1 +fi