aboutsummaryrefslogtreecommitdiff
path: root/comp2041/tigger/tigger-log
blob: 5e269c21c9df345109f9fa5978371b5a54eedb1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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