aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/doc-diff
diff options
context:
space:
mode:
authorMartin Ågren <martin.agren@gmail.com>2019-03-17 19:36:01 +0100
committerJunio C Hamano <gitster@pobox.com>2019-03-18 15:54:17 +0900
commitbc71dc3fa1561c301098796b47cd7ef721cb68f9 (patch)
treebb324929d78b3d3114e8b88cdd1819fa606431df /Documentation/doc-diff
parent9a71722b4df993475553ea499fdf44dab5fed544 (diff)
downloadgit-bc71dc3fa1561c301098796b47cd7ef721cb68f9.tar.gz
doc-diff: let `render_tree()` take an explicit directory name
In `render_tree()`, `$1` is documented to be the commit-ish/oid and we use it as that with `git checkout`, but we mostly use it to form the name of various directories. To separate these concerns, and because we are about to construct the directory names a bit differently, take two distinct arguments instead. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/doc-diff')
-rwxr-xr-xDocumentation/doc-diff28
1 files changed, 17 insertions, 11 deletions
diff --git a/Documentation/doc-diff b/Documentation/doc-diff
index 32c83dd26f..3e975d3c5d 100755
--- a/Documentation/doc-diff
+++ b/Documentation/doc-diff
@@ -79,6 +79,9 @@ then
ln -s "$dots/config.mak" "$tmp/worktree/config.mak"
fi
+from_dir=$from_oid &&
+to_dir=$to_oid &&
+
# generate_render_makefile <srcdir> <dstdir>
generate_render_makefile () {
find "$1" -type f |
@@ -94,7 +97,7 @@ generate_render_makefile () {
done
}
-# render_tree <committish_oid>
+# render_tree <committish_oid> <directory_name>
render_tree () {
# Skip install-man entirely if we already have an installed directory.
# We can't rely on make here, since "install-man" unconditionally
@@ -102,28 +105,31 @@ render_tree () {
# we then can't rely on during the render step). We use "mv" to make
# sure we don't get confused by a previous run that failed partway
# through.
- if ! test -d "$tmp/installed/$1"
+ oid=$1 &&
+ dname=$2 &&
+ if ! test -d "$tmp/installed/$dname"
then
- git -C "$tmp/worktree" checkout --detach "$1" &&
+ git -C "$tmp/worktree" checkout --detach "$oid" &&
make -j$parallel -C "$tmp/worktree" \
GIT_VERSION=omitted \
SOURCE_DATE_EPOCH=0 \
- DESTDIR="$tmp/installed/$1+" \
+ DESTDIR="$tmp/installed/$dname+" \
install-man &&
- mv "$tmp/installed/$1+" "$tmp/installed/$1"
+ mv "$tmp/installed/$dname+" "$tmp/installed/$dname"
fi &&
# As with "installed" above, we skip the render if it's already been
# done. So using make here is primarily just about running in
# parallel.
- if ! test -d "$tmp/rendered/$1"
+ if ! test -d "$tmp/rendered/$dname"
then
- generate_render_makefile "$tmp/installed/$1" "$tmp/rendered/$1+" |
+ generate_render_makefile "$tmp/installed/$dname" \
+ "$tmp/rendered/$dname+" |
make -j$parallel -f - &&
- mv "$tmp/rendered/$1+" "$tmp/rendered/$1"
+ mv "$tmp/rendered/$dname+" "$tmp/rendered/$dname"
fi
}
-render_tree $from_oid &&
-render_tree $to_oid &&
-git -C $tmp/rendered diff --no-index "$@" $from_oid $to_oid
+render_tree $from_oid $from_dir &&
+render_tree $to_oid $to_dir &&
+git -C $tmp/rendered diff --no-index "$@" $from_dir $to_dir