Hi, > > tar_file=$(realpath "$1") > > -list_file="${tar_file}.list" > > -vroot_dir="${tar_file}.vroot" > > +sub_file=$(mktemp "${tar_file%.tar}.sub.XXXXXXXX.tar") > > +sub_tdir=$(mktemp -d "${tar_file%.tar}.sub.XXXXXXXX") > > mktemp is not specified by POSIX; and FreeBSD man pages for mktemp > suggest that if you don't use XXXXXX as the suffix that you are not > guaranteed correct behavior. Are you sure this is portable enough? Do > you need both a temp file and dir, or can you create the file name of > your choice inside a temp dir, where only the dir has to have a > randomized name?
Yes, storing temp tar in the temp dir should work. > > + status="$(git submodule status "$sm")" > > + smhash="${status# }" > > + smhash="${smhash#+}" > > + smhash="${smhash#-}" > > These three lines can be consolidated into one: > smhash=${status#[ +-]} Ah, cool. Learned a new trick. > > + smdir="$sub_tdir/$sm" > > + smurl="$(git config -f .gitmodules submodule.${sm}.url)" > > + echo "NOTICE: using temporary clone for submodule $sm" > > + git clone "$smurl" "$smdir" > > + test $? -ne 0 && error "failed to clone submodule $sm" > > I know we don't want to affect the developer's normal checkout, but is > it worth storing the temporary clone in a specifically-named > subdirectory of their checkout instead Hmm, we could do "git submodule init + git archive + git submodule deinit". With git storing a bare repo in .git/modules/$submodule these days (and not deleting it on deinit) that'll effectively cache things. It's a (temporary) modification of the checkout though. Alternatively we could clone to $HOME/.cache/$somewhere, similar to the vm tests which store downloads (and soon vm images too) below $HOME/.cache/qemu-vm/. cheers, Gerd