Skip to content

Commit e4c9511

Browse files
committed
nix-prefetch-pijul: always show the state
As Pijul’s stable reference, downstream scripts *will* wish to have access to this value.
1 parent 8798c05 commit e4c9511

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pkgs/build-support/fetchpijul/nix-prefetch-pijul

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ if [ -z "$final_path" ]; then
100100

101101
cd "$tmp_clone"
102102
pijul clone $clone_args "$remote" "$name"
103+
# State is a stable reference is a stable reference for the patchset that
104+
# doesn't depend on patch order. As a result, it will always be included.
105+
if [ -z "$state" ]; then
106+
state="$(pijul log --repository "$tmp_clone/$name" --state --limit 1 | awk '/^State:/ {printf $2}')"
107+
fi
103108
rm -rf "$tmp_clone/$name/.pijul"
104109

105110
hash="$(nix-hash --type "$hash_algo" "$hash_format" "$tmp_clone/$name")"
@@ -125,10 +130,8 @@ EOF
125130
if [ -n "$change" ]; then cat <<EOF
126131
"change": $(json_escape "$change"),
127132
EOF
128-
elif [ -n "$state" ]; then cat <<EOF
129-
"state": $(json_escape "$state"),
130-
EOF
131133
fi; cat <<EOF
134+
"state": $(json_escape "$state"),
132135
"path": "$final_path",
133136
$(json_escape "$hash_algo"): $(json_escape "$hash"),
134137
"hash": "$(nix-hash --to-sri --type "$hash_algo" "$hash")"

pkgs/tools/package-management/nix-prefetch-scripts/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ rec {
8383
subversion
8484
];
8585
nix-prefetch-pijul = mkPrefetchScript "pijul" ../../../build-support/fetchpijul/nix-prefetch-pijul [
86+
gawk
8687
pijul
8788
cacert
8889
jq

0 commit comments

Comments
 (0)