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 e76dcc7a18f9265c93afb069869f4022ea0758ab
parent 0e64d3696e7b202ecca1c766a1183daac1145849
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed,  5 Feb 2025 14:51:30 +0100

Fix of fetch/pull/prune subcommands

The command is based on xargs whose string replacement (-I option) must
not be used on a subshell: the replacement may not work as expected.
Instead, the replaced string is supplied as an input argument to the
subshell.

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

diff --git a/git-wad b/git-wad @@ -234,7 +234,7 @@ objects_to_push() # [-1a] wad_objects "$@" > "${wads}" xargs -I {} sh -c \ - "if [ -f \"${GIT_WAD_OBJDIR}/{}\" ]; then echo \"{}\"; fi" \ + "if [ -f \"${GIT_WAD_OBJDIR}/\$1\" ]; then echo \"\$1\"; fi" -- {} \ < "${wads}" } @@ -245,7 +245,8 @@ objects_to_fetch() # [-1a] wad_objects "$@" > "${wads}" xargs -I {} sh -c \ - "if [ ! -f \"${GIT_WAD_OBJDIR}/{}\" ]; then echo \"{}\"; fi" < "${wads}" + "if [ ! -f \"${GIT_WAD_OBJDIR}/\$1\" ]; then echo \"\$1\"; fi" -- {} \ + < "${wads}" } # Build the next_timestamp command, which returns the timestamp one @@ -582,8 +583,8 @@ prune() # [-1a] unreferenced_objects "$@" > "${unreferenced}" xargs -I {} sh -c \ - ">&2 printf \"Removing %s\n\" \"${GIT_WAD_OBJDIR}/{}\"; \ - rm -f \"${GIT_WAD_OBJDIR}/{}\"" < "${unreferenced}" + ">&2 printf \"Removing %s\n\" \"${GIT_WAD_OBJDIR}/\$1\"; \ + rm -f \"${GIT_WAD_OBJDIR}/\$1\"" -- {} < "${unreferenced}" } # Print WAD management status