Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-07-01 Thread Junio C Hamano
SZEDER Gábor writes: >> I recall the discussion around the meaning of `-C ""` when that >> command line option was introduced. The conclusion was that the >> zero-length argument should mean "this directory" since that's how `cd >> ""` behaves. However, I don't think that behavior ever got docum

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-29 Thread SZEDER Gábor
On Fri, Jun 28, 2019 at 07:46:02PM -0400, Eric Sunshine wrote: > On Fri, Jun 28, 2019 at 7:04 PM SZEDER Gábor wrote: > > On Fri, Jun 28, 2019 at 05:32:35PM -0400, Eric Sunshine wrote: > > > On Fri, Jun 28, 2019 at 5:39 AM Jeff King wrote: > > > > + in_dir=${indir:+-C "$indir"} > > > > > > D

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Jeff King
On Fri, Jun 28, 2019 at 05:32:35PM -0400, Eric Sunshine wrote: > > +# The message, filename, and contents strings are evaluated by the shell > > inside > > +# double-quotes, with $n set to the current commit number. So you can do: > > +# > > +# test_commit_bulk --filename=file --contents='modif

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Jeff King
On Fri, Jun 28, 2019 at 07:46:02PM -0400, Eric Sunshine wrote: > On Fri, Jun 28, 2019 at 7:04 PM SZEDER Gábor wrote: > > On Fri, Jun 28, 2019 at 05:32:35PM -0400, Eric Sunshine wrote: > > > On Fri, Jun 28, 2019 at 5:39 AM Jeff King wrote: > > > > + in_dir=${indir:+-C "$indir"} > > > > > >

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Jeff King
On Fri, Jun 28, 2019 at 08:44:38PM +0200, Ævar Arnfjörð Bjarmason wrote: > > +# Similar to test_commit, but efficiently create commits, each with a > > +# unique number $n (from 1 to by default) in the commit message. > > Is it intentional not to follow test_commit's convention of creating a >

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Jeff King
On Fri, Jun 28, 2019 at 10:53:41AM -0700, Junio C Hamano wrote: > > + in_dir=${indir:+-C "$indir"} > > I thought that this assignment to $in_dir would be unnecessary if we > parsed -C directly into it, i.e. Heh, sorry for the confusion. That in_dir is leftover cruft. I was trying to see if I c

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Jeff King
On Fri, Jun 28, 2019 at 08:35:28AM -0400, Derrick Stolee wrote: > > + while test "$total" -gt 0 > > + do > > + echo "commit $ref" && > > + printf 'author %s <%s> %s\n' \ > > + "$GIT_AUTHOR_NAME" \ > > +

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Eric Sunshine
On Fri, Jun 28, 2019 at 7:04 PM SZEDER Gábor wrote: > On Fri, Jun 28, 2019 at 05:32:35PM -0400, Eric Sunshine wrote: > > On Fri, Jun 28, 2019 at 5:39 AM Jeff King wrote: > > > + in_dir=${indir:+-C "$indir"} > > > > Doesn't this suffer the problem in which some older/broken > > shells[1][2][

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread SZEDER Gábor
On Fri, Jun 28, 2019 at 05:32:35PM -0400, Eric Sunshine wrote: > On Fri, Jun 28, 2019 at 5:39 AM Jeff King wrote: > > +# to have every commit touch the same file, but with unique content. > > Spaces are > > +# OK, but you must escape any metacharacters (like backslashes or > > +# double-quotes)

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Eric Sunshine
On Fri, Jun 28, 2019 at 5:39 AM Jeff King wrote: > [...] > For bulk creation, we can do much better by using fast-import, but it's > often a pain to generate the input. Let's provide a helper to do so. > [...] > Signed-off-by: Jeff King > --- > diff --git a/t/test-lib-functions.sh b/t/test-lib-fu

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Ævar Arnfjörð Bjarmason
On Fri, Jun 28 2019, Jeff King wrote: > Some tests need to create a string of commits. Doing this with > test_commit is very heavy-weight, as it needs at least one process per > commit (and in fact, uses several). > > For bulk creation, we can do much better by using fast-import, but it's > ofte

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Junio C Hamano
Derrick Stolee writes: > way to do this loop. The top thing on my mind are the 'eval "echo X"' > lines. If they start processes, then we can improve the performance. > If not, then it may not be worth it. Sigh. Do you mean 'echo' run inside 'eval' is one extra process? In most modern shells,

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Junio C Hamano
Jeff King writes: > +# The message, filename, and contents strings are evaluated by the shell > inside > +# double-quotes, with $n set to the current commit number. So you can do: > +# > +# test_commit_bulk --filename=file --contents='modification $n' > +# > +# to have every commit touch the s

Re: [PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Derrick Stolee
On 6/28/2019 5:39 AM, Jeff King wrote: > Some tests need to create a string of commits. Doing this with > test_commit is very heavy-weight, as it needs at least one process per > commit (and in fact, uses several). > > For bulk creation, we can do much better by using fast-import, but it's > often

[PATCH 1/6] test-lib: introduce test_commit_bulk

2019-06-28 Thread Jeff King
Some tests need to create a string of commits. Doing this with test_commit is very heavy-weight, as it needs at least one process per commit (and in fact, uses several). For bulk creation, we can do much better by using fast-import, but it's often a pain to generate the input. Let's provide a help