aboutsummaryrefslogtreecommitdiff
path: root/comp2041/tigger/tigger-log
diff options
context:
space:
mode:
authorNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-13 18:00:17 +1100
committerNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-13 18:00:17 +1100
commit98cef5e9a772602d42acfcf233838c760424db9a (patch)
tree5277fa1d7cc0a69a0f166fcbf10fd320f345f049 /comp2041/tigger/tigger-log
initial commit
Diffstat (limited to 'comp2041/tigger/tigger-log')
-rwxr-xr-xcomp2041/tigger/tigger-log24
1 files changed, 24 insertions, 0 deletions
diff --git a/comp2041/tigger/tigger-log b/comp2041/tigger/tigger-log
new file mode 100755
index 0000000..5e269c2
--- /dev/null
+++ b/comp2041/tigger/tigger-log
@@ -0,0 +1,24 @@
+#!/bin/dash
+
+# Test if we have a valid repo before doing anything.
+if ! [ -d ".tigger/" ]; then
+ printf "tigger-add: error: tigger repository directory .tigger not found\n" >&2
+ exit 1
+fi
+
+# Get current branch.
+branch=$(cat .tigger/branch.tig)
+mkdir --parents ".tigger/$branch/"
+
+# Iterate through commits and print their message.
+for commit in $(find .tigger/"$branch"/* -maxdepth 0 -type d | grep -o -E "[\/][^\/]*$" | tr -d "/" | sort -r -n); do
+
+ # No message = we're working on it, so it's not considered here.
+ if ! [ -e .tigger/"$branch"/"$commit"/message.tig ]; then
+ continue
+ fi
+
+ printf "%s %s\n" "$commit" "$(cat .tigger/"$branch"/"$commit"/message.tig)"
+done
+
+exit 0