IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Git Source Tree
Root/
Source at commit d7d95ff2da07c37cd95d5466d7cd2b775c771ec8 created 13 years 7 months ago. By Werner Almesberger, Allow schhist2web and friends to run from a directory outside the working tree. | |
---|---|
1 | #!/bin/sh |
2 | # |
3 | # gitenealogy - Trace the ancestry of a file in git across renames |
4 | # |
5 | # Written 2010 by Werner Almesberger |
6 | # Copyright 2010 Werner Almesberger |
7 | # |
8 | # This program is free software; you can redistribute it and/or modify |
9 | # it under the terms of the GNU General Public License as published by |
10 | # the Free Software Foundation; either version 2 of the License, or |
11 | # (at your option) any later version. |
12 | # |
13 | |
14 | |
15 | usage() |
16 | { |
17 | cat <<EOF 2>&1 |
18 | usage: $0 repo-dir path |
19 | |
20 | The file to trace must be at repo-dir/path |
21 | EOF |
22 | exit 1 |
23 | } |
24 | |
25 | |
26 | if [ -z "$2" -o ! -z "$3" ]; then |
27 | usage |
28 | fi |
29 | |
30 | if [ ! -d "$1" -o ! -d "$1/.git" ]; then |
31 | echo "no git repository at $1" 1>&2 |
32 | exit 1 |
33 | fi |
34 | if [ ! -f "$1/$2" ]; then |
35 | echo "cannot find $2" 2>&1 |
36 | exit 1 |
37 | fi |
38 | |
39 | cd "$1" || exit |
40 | git log --follow --name-status "$2" | |
41 | awk ' |
42 | /^commit /{ if (c) print c, n; c = $2 } |
43 | { if (NF) n = $(NF) } |
44 | END { if (c) print c, n; }' |
45 |