# hashrepo.fish -rw-r--r-- 475 bytes View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# licensed GPL-3.0-only

function hashrepo
        set dir "$PWD"
        if test -z "$argv[1]"
                echo "No git repo provided." >&2
                return 1
        end
        git clone "$argv[1]" "/tmp/hashrepo_tmp-$argv[1]" > /dev/null
        cd "/tmp/hashrepo_tmp-$argv[1]"
        if test -n "$argv[2]"
                git checkout "$argv[2]" > /dev/null
        end
        guix hash -rx .
        cd "$dir"
        rm -rf "/tmp/hashrepo_tmp-$argv[1]"
end