aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xt/lib-commit-graph.sh16
1 files changed, 13 insertions, 3 deletions
diff --git a/t/lib-commit-graph.sh b/t/lib-commit-graph.sh
index 5d79e1a4e9..4d3e7f0623 100755
--- a/t/lib-commit-graph.sh
+++ b/t/lib-commit-graph.sh
@@ -32,6 +32,13 @@ graph_git_behavior() {
graph_read_expect() {
OPTIONAL=""
NUM_CHUNKS=3
+ DIR="."
+ if test "$1" = -C
+ then
+ shift
+ DIR="$1"
+ shift
+ fi
if test -n "$2"
then
OPTIONAL=" $2"
@@ -47,12 +54,15 @@ graph_read_expect() {
then
OPTIONS=" read_generation_data"
fi
- cat >expect <<- EOF
+ cat >"$DIR/expect" <<-EOF
header: 43475048 1 $(test_oid oid_version) $NUM_CHUNKS 0
num_commits: $1
chunks: oid_fanout oid_lookup commit_metadata$OPTIONAL
options:$OPTIONS
EOF
- test-tool read-graph >output &&
- test_cmp expect output
+ (
+ cd "$DIR" &&
+ test-tool read-graph >output &&
+ test_cmp expect output
+ )
}