Skip to content

Instantly share code, notes, and snippets.

@anton-rudeshko
Last active August 30, 2021 20:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anton-rudeshko/d7975ec95415442845091b9400d1055b to your computer and use it in GitHub Desktop.
Save anton-rudeshko/d7975ec95415442845091b9400d1055b to your computer and use it in GitHub Desktop.
Convert `git lfs --debug` output to json.
# Usage: git lfs ls-files -d | awk -f git-lfs-to-json.awk > lfs-files.json
BEGIN {
RS = ""
FS = "\n"
print "["
}
{
split($1, filepath, ": ")
split($2, size, ": ")
printf "%s { \"filepath\": \"%s\", \"size\": %s }", separator, filepath[2], size[2]
separator = ",\n"
}
END {
print "\n]"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment