Re: [PATCH v2] t: make many tests depend less on the refs being files
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- May 25, 2018, 09:05 UTC
- Message-ID
- <CAMy9T_E_wO-XKn-BoVpnoUn8cGsmE4z11AzbqW+7Ppo=P9zcDg@mail.gmail.com>
- In-Reply-To
- <20180525085906.GA2948@sigill.intra.peff.net>
On Fri, May 25, 2018 at 10:59 AM, Jeff King <peff@peff.net> wrote:
Show 24 quoted lines
> On Fri, May 25, 2018 at 10:48:04AM +0200, Michael Haggerty wrote: > >> > test_expect_success "multi-fetch works off a 'clean' repository" ' >> > - rm -r "$GIT_DIR/svn" "$GIT_DIR/refs/remotes" "$GIT_DIR/logs" && >> > + rm -rf "$GIT_DIR/svn" "$GIT_DIR/refs/remotes" && >> > + git reflog expire --all --expire=all && >> > mkdir "$GIT_DIR/svn" && >> > git svn multi-fetch >> > ' >> > >> >> `rm -rf "$GIT_DIR/refs/remotes"` is not kosher. I think it can be written >> >> printf 'option no-deref\ndelete %s\n' $(git for-each-ref >> --format='%(refname)' refs/remotes) | git update-ref --stdin >> >> as long as the number of references doesn't exceed command-line limits. >> This will also take care of the reflogs. Another alternative would be to >> write it as a loop. > > Perhaps: > > git for-each-ref --format="option no-deref%0adelete %(refname)" refs/remotes | > git update-ref --stdin
Ah yes, that's nicer. I tried with `\n`, but that's not supported (wouldn't it be nice if it were?). I didn't think to try `%0a` (let alone look in the documentation!)
Michael