12
doc-diff [options] <from> <to> [-- <diff-options>]
13
doc-diff (-c|--clean)
14
--
15
-j=n parallel argument to pass to make
16
-f force rebuild; do not rely on cached results
17
-c,clean cleanup temporary working files
15
+j=n parallel argument to pass to make
16
+f force rebuild; do not rely on cached results
17
+c,clean cleanup temporary working files
18
+from-asciidoc use asciidoc with the 'from'-commit
19
+from-asciidoctor use asciidoctor with the 'from'-commit
20
+asciidoc use asciidoc with both commits
21
+to-asciidoc use asciidoc with the 'to'-commit
22
+to-asciidoctor use asciidoctor with the 'to'-commit
23
+asciidoctor use asciidoctor with both commits
24
"
25
SUBDIRECTORY_OK=1
26
. "$(git --exec-path)/git-sh-setup"
28
parallel=
29
force=
30
clean=
31
+from_program=
32
+to_program=
33
while test $# -gt 0
34
do
35
case "$1" in
39
clean=t ;;
40
-f)
41
force=t ;;
42
+ --from-asciidoctor)
43
+ from_program=-asciidoctor ;;
44
+ --to-asciidoctor)
45
+ to_program=-asciidoctor ;;
46
+ --asciidoctor)
47
+ from_program=-asciidoctor
48
+ to_program=-asciidoctor ;;
49
+ --from-asciidoc)
50
+ from_program=-asciidoc ;;
51
+ --to-asciidoc)
52
+ to_program=-asciidoc ;;
53
+ --asciidoc)
54
+ from_program=-asciidoc
55
+ to_program=-asciidoc ;;
56
--)
57
shift; break ;;
58
*)
101
ln -s "$dots/config.mak" "$tmp/worktree/config.mak"
102
fi
103
82
-from_dir=$from_oid &&
83
-to_dir=$to_oid &&
104
+construct_makemanflags () {
105
+ if test "$1" = "-asciidoc"
106
+ then
107
+ echo USE_ASCIIDOCTOR=
108
+ elif test "$1" = "-asciidoctor"
109
+ then
110
+ echo USE_ASCIIDOCTOR=YesPlease
111
+ fi
112
+}
113
+
114
+from_makemanflags=$(construct_makemanflags "$from_program") &&
115
+to_makemanflags=$(construct_makemanflags "$to_program") &&
116
+
117
+from_dir=$from_oid$from_program &&
118
+to_dir=$to_oid$to_program &&
119
120
# generate_render_makefile <srcdir> <dstdir>
121
generate_render_makefile () {
132
done
133
}
134
100
-# render_tree <committish_oid> <directory_name>
135
+# render_tree <committish_oid> <directory_name> <makemanflags>
136
render_tree () {
137
# Skip install-man entirely if we already have an installed directory.
138
# We can't rely on make here, since "install-man" unconditionally
142
# through.
143
oid=$1 &&
144
dname=$2 &&
145
+ makemanflags=$3 &&
146
if ! test -d "$tmp/installed/$dname"
147
then
148
git -C "$tmp/worktree" checkout --detach "$oid" &&
149
make -j$parallel -C "$tmp/worktree" \
150
+ $makemanflags \
151
GIT_VERSION=omitted \
152
SOURCE_DATE_EPOCH=0 \
153
DESTDIR="$tmp/installed/$dname+" \
167
fi
168
}
169
133
-render_tree $from_oid $from_dir &&
134
-render_tree $to_oid $to_dir &&
170
+render_tree $from_oid $from_dir $from_makemanflags &&
171
+render_tree $to_oid $to_dir $to_makemanflags &&
172
git -C $tmp/rendered diff --no-index "$@" $from_dir $to_dir