Skip to content

Commit d0690a0

Browse files
committed
nix-prefetch-darcs: use --repodir & remove now-unneeded cd
1 parent 555c1f0 commit d0690a0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pkgs/build-support/fetchdarcs/nix-prefetch-darcs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,16 @@ if [ -z "$final_path" ]; then
132132
else
133133
darcs clone $clone_args "$repository" "$name" >/dev/null
134134
fi
135-
cd "$tmp_clone/$name"
136135
# Will put the current Darcs context into the store.
137136
new_context="$tmp_clone/${name}-context.txt"
138-
darcs log --context > "$new_context"
137+
darcs log --repodir="$tmp_clone/$name" --context > "$new_context"
139138
final_context="$(nix-store --add-fixed "$hash_algo" "$new_context")"
140139
# Darcs has a weak hash using the XOR of the patch hashes which is useful
141140
# for other scripts
142141
# https://darcs.net/Internals/Hashes
143-
weak_hash="$(darcs show repo | awk '/^[[:space:]]*Weak Hash:/ { sub(/^[[:space:]]*Weak Hash:[[:space:]]*/, "", $0); printf $0 }')"
142+
weak_hash="$(darcs show repo --repodir="$tmp_clone/$name" | awk '/^[[:space:]]*Weak Hash:/ { sub(/^[[:space:]]*Weak Hash:[[:space:]]*/, "", $0); printf $0 }')"
144143
date="$(darcs log --repodir="$tmp_clone/$name" --max-count 1 | awk '/^Date:/ { sub(/^Date:[[:space:]]*/, "", $0); printf $0 }')"
145144
date="$(date -u -d "$date" "+%Y-%m-%dT%H:%M:%SZ")"
146-
cd - >/dev/null
147145
rm -rf "$tmp_clone/$name/_darcs"
148146

149147
hash="$(nix-hash --type "$hash_algo" "$hash_format" "$tmp_clone/$name")"

0 commit comments

Comments
 (0)