Debian Codegraph @

tools/describegitannex

raw
1 #!/bin/bash
2
3 commit="$1"
4
5 : ${GIT_ANNEX_SRCPATH:=~/proj/git-annex}
6 : ${GIT_ANNEX_USER:=yarikoptic}
7
8 function indent() {
9 sed -e 's,^, ,g'
10 }
11
12 function pull() {
13 echo "I: pull --rebase"
14 git pull --rebase 2>&1 | indent
15 }
16
17 set -eu
18 builtin cd "$GIT_ANNEX_SRCPATH"
19
20 if [[ -z "$commit" ]]; then
21 pull
22 echo "I: Differences from Joey:"
23 git diff origin/master.. 2>&1 | indent
24 # life is too short to discover correct way
25 commit=$(git show | head -n1 | awk '{print $2;}')
26 fi
27
28 echo "I: Head of the last commit:"
29 { git show "$commit" | head -n 10 || { echo "not found; fetching"; pull; git show "$commit" | head -n 10; } } | indent
30
31 desc=$(git describe "$commit")
32 desc_contains=$(git describe --contains "$commit" 2>/dev/null || echo '')
33
34 if [[ ! -z "$desc_contains" ]]; then
35 desc_contains=" AKA $desc_contains"
36 fi
37
38 md="[$desc$desc_contains](https://git.kitenet.net/index.cgi/git-annex.git/commit/?id=$commit)"
39 echo
40 echo "I: Markdown links to the commit"
41 echo " $md"
42 echo " > fixed in $md --[[$GIT_ANNEX_USER]]"