git-wad

Manage files via git but not their content
git clone git://git.meso-star.fr/git-wad.git
Log | Files | Refs | README | LICENSE

commit faa5f7c7b7c37ffa8cc4e5b19c9afff868ddec4f
parent fe8cff6f9f7d4f8a410455043d60c767861f3524
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Sat, 13 Jan 2024 19:26:52 +0100

Add comments to make reading sources easier

Diffstat:
Mgit-wad | 17++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/git-wad b/git-wad @@ -38,10 +38,10 @@ fi synopsis() { >&2 printf "usage: git-wad checkout\n" + >&2 printf " git-wad fetch [--all]\n" >&2 printf " git-wad init\n" >&2 printf " git-wad pull [--all]\n" >&2 printf " git-wad push [--all]\n" - >&2 printf " git-wad fetch [--all]\n" } log() # str [, arg...] @@ -62,6 +62,7 @@ encode() # digest, size printf "%s %s %d" "${GIT_WAD_HEADER}" "$1" "$2" } +# List WAD objects from the current working tree wad_objects() # [--all] { rev="HEAD" @@ -147,7 +148,7 @@ restore() # WAD file } ######################################################################## -# Git filters +# Git filters (plumbing) ######################################################################## clean() # stdin { @@ -211,8 +212,9 @@ smudge() # stdin } ######################################################################## -# Sub commands +# Git sub commands (porcelain) ######################################################################## +# Setup git filters init() { if git config --get filter.wad.clean > /dev/null \ @@ -225,6 +227,7 @@ init() fi } +# Transfert WAD objects to remote server push() # [--all] { if [ -z "${GIT_WAD_REMOTE_PUSH}" ]; then @@ -237,6 +240,7 @@ push() # [--all] --files-from=- "${GIT_WAD_OBJDIR}" "${GIT_WAD_REMOTE_PUSH}" } +# Download WAD objects from remote server fetch() # [--all] { if [ -z "${GIT_WAD_REMOTE_FETCH}" ]; then @@ -249,6 +253,7 @@ fetch() # [--all] --files-from=- "${GIT_WAD_REMOTE_FETCH}" "${GIT_WAD_OBJDIR}" } +# Restore the content of WAD files checkout() { git ls-files \ @@ -258,6 +263,8 @@ checkout() done } +# Download WAD objects from remote server and restore the content of +# working WAD files. pull() # [--all] { fetch "$@" @@ -272,11 +279,11 @@ sub_cmd="$1" mkdir -p "${GIT_WAD_OBJDIR}" case "${sub_cmd}" in + "checkout") shift 1; checkout "$@" ;; + "fetch") shift 1; fetch "$@" ;; "filter-clean") shift 1; clean "$@" ;; "filter-smudge") shift 1; smudge "$@" ;; - "checkout") shift 1; checkout "$@" ;; "init") shift 1; init "$@" ;; - "fetch") shift 1; fetch "$@" ;; "push") shift 1; push "$@" ;; "pull") shift 1; pull "$@" ;; *) synopsis; exit 1 ;;