-
Notifications
You must be signed in to change notification settings - Fork 5
/
git-case-list
executable file
·35 lines (29 loc) · 1.33 KB
/
git-case-list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
#
# Assumptions:
# - in a git repository
# - the branch defined by GIT_CASE_HEAD exists (see git-case-common)
source $(dirname $0)/git-case-common
ACTIVE_ID=$(cat "$GIT_CASE_ACTIVE" 2>/dev/null || true)
git ls-tree $GIT_CASE_HEAD -- . | while read mode type object file ; do
if test $type = tree ; then
short=$(gen_short_case_id $file)
desc=$(git show $GIT_CASE_HEAD:$file/description 2>/dev/null | head -n1)
ctype=$(git show "$GIT_CASE_HEAD:$file/type" 2>/dev/null || true)
state=$(git show "$GIT_CASE_HEAD:$file/state" 2>/dev/null || true)
assig=$(git show "$GIT_CASE_HEAD:$file/assigned" 2>/dev/null || true)
mine=""
if test "$assig" = "$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" \
-o "$assig" = "$GIT_COMMITTER_EMAIL" ; then
mine="$bold$blue"
elif test -z "$assig" ; then
mine="$bold$black"
fi
cur=" "
if test "$file" = "$ACTIVE_ID" ; then
cur="$bold$red**$reset"
fi
state_type="[$state] [$ctype]"
printf "$cur $mine%6s$reset %-20s $mine%s$reset\n" "$short" "$state_type" "${desc:0:50}"
fi
done