I want to execute the following command on a remote server:
git archive --prefix="$tag/" --remote="ssh://$gitserver/var/git/$repo" "$tag" | tar -xvf-
The problem is I don't know what $tag
is. It should be the output of git describe --abbrev=0
on an up-to-date clone, but I don't know how to get that information without making a local clone of the repository. Is it possible to do this without making a local clone?
#!/usr/bin/awk -f
BEGIN {
FS = "[ /^]+"
while ("git ls-remote " ARGV[1] "| sort -Vk2" | getline) {
if (!sha)
sha = substr($0, 1, 7)
tag = $3
}
while ("curl -s " ARGV[1] "/releases/tag/" tag | getline)
if ($3 ~ "commits")
com = $2
printf com ? "%s-%s-g%s\n" : "%s\n", tag, com, sha
}
Sample output
$ git-describe-remote.awk https://github.com/stedolan/jq
jq-1.4-148-g89791a0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With