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 6e9c787537b3a4859e460c3e753fa47305d2e1e1
parent 950ad9e21b18129bfdea2fc9cf6a30778469b2b4
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Sat, 25 Nov 2023 19:28:50 +0100

Add the init subcommand

It configures git wad filters if necessary

Diffstat:
MREADME.md | 5-----
Mgit-wad | 18+++++++++++++++++-
2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md @@ -7,11 +7,6 @@ Git filters used to manage files based on their digest. - POSIX shell - sha256sum -## Configure repository - - git config --local filter.wad.clean "git-wad filter-clean" - git config --local filter.wad.smudge "git-wad filter-smudge" - ## License Copyright (C) 2023 |Méso|Star> (contact@meso-star.com) diff --git a/git-wad b/git-wad @@ -27,7 +27,7 @@ GIT_WAD_VERBOSE=1 ######################################################################## synopsis() { - >&2 printf "usage: git-wad\n" + >&2 printf "usage: git-wad init\n" } log() # str [, arg...] @@ -112,6 +112,21 @@ smudge() # stdin } ######################################################################## +# Sub commands +######################################################################## +init() +{ + if git config --get filter.wad.clean > /dev/null \ + && git config --get filter.wad.smudge > /dev/null; then + log "git-wad is already initialized (check .git/config)\n" + else + git config filter.wad.clean "git-wad filter-clean" + git config filter.wad.smudge "git-wad filter-smudge" + log "git-wad is initialized\n" + fi +} + +######################################################################## # The command ######################################################################## sub_cmd="$1" @@ -123,5 +138,6 @@ fi case "${sub_cmd}" in "filter-clean") shift 1; clean "$@" ;; "filter-smudge") shift 1; smudge "$@" ;; + "init") shift 1; init ;; *) synopsis; exit 1 ;; esac