git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Philip Oakley <philipoakley@iee.email>
Cc: GitList <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>,
	Taylor Blau <me@ttaylorr.com>
Subject: Re: [RFC/PoC 1/5] doc: provide DocBundles design document
Date: Thu, 03 Nov 2022 21:36:10 +0100	[thread overview]
Message-ID: <221103.861qqj22bl.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <ab275fa0-2977-f880-cc33-836f667287bc@iee.email>


On Thu, Nov 03 2022, Philip Oakley wrote:

> Hi Ævar,
> Thanks for the review,
>
> On 03/11/2022 09:19, Ævar Arnfjörð Bjarmason wrote:

> My main point was that the examples need to be covered by the test
> suite, and that bundles were a simple way of capturing the tested setup.
> The GIT_BUNDLE_DIR was simply a way of collecting them in one place for
> ease of distribution with the documentation (as you mentioned that's a
> gap in the automation step)
>>  i.e. with a minor variation of that you can do this
>> in test-lib.sh:
>>
>> 	TEST_RESULTS_BDL_DIR="$TEST_RESULTS_DIR/$TEST_NAME.test-bdl"
>>
>> Then have a helper like:
>>
>> 	do_my_test_bundle_stuff () {
>> 		local name="$1" &&
>> 		shift &&
>> 		git bundle create "$TEST_RESULTS_BDL_DIR/$name.bdl" "$@"
>> 	}
> That would be a simplification

I forgot that there needs to be a "mkdir" of the "$TEST_RESULTS_BDL_DIR"
in there somewhere (see the *.leak dir setup), but other than that
that's pretty much all there's to it.

>> Then all you need to make these is:
>>
>> 	make test GIT_TEST_OPTS=--debug
>
> I didn't quite get the link in that step between the `--debug` and the
> bndl prep.

Sorry, I was misrecalling that we wiped away "test-results" except
without "--debug", which when I spend more than 2 seconds thinking about
it makes no sense, that's just for the trash directories. Nevermind.

>> And then:
>>
>> 	ls -l t/test-results/*.bdl/*
>>
>> Will give you all the bundles you want.
>>
>> We're then missing the "connect it with the docs" part, but that part
>> would be e.g.:
>>
>> - Have a validation target for it that depends on such a "make test" run
>> - Sanity check that we did create the ones the docs expect
>>
>> Anyway.
>>
>> I like the end-goals, but I can't help think that bundles are the wrong
>> direction to go in, as opposed to:
>>
>> 1. We could have "make install" ship test-lib{,-functions}.sh along
>>    with git itself
>> 2. Have e.g. t/doc-setup/*.sh with the snippets to set up these test
>>    demos, which we'd also ship.
>
> I'm not into the idea of shipping a load of extra `test` infrastructure
> with Git itself. We don't ship any in the Git for Windows install.

We don't ship in anywhere now, but presumably GfW has the required parts
to use it, since it has git-submodule.sh and other *.sh now?

Anyway....

> I'd viewed the bundles as an adjunct to the also independent manuals and
> documentation.

...yeah me too, I'm just wondering if we won't back ourselves into a
corner with some examples, where we'll want to hand the user more
complex state.

But maybe simpler is better, and it can just be a bundle plus "run these
commands manually". The bundle can also contain a script in-tree that
performs the finishing touches, if required (unless there's no 'sh' at
runtime in GfW?).

Anyway, *if* that's a good idea (and I've got no idea, just throwing it
out there) it doesn't need to be hindered by lack of 'sh', we could just
ship compiled C code that does the required run_command() sequences to
set up the desired state.

Then in the test suite we'd call that as a test helper, or a new
built-in helper,.

>>
>> And you'd then do e.g.:
>>
>> 	git test-case rebase/description-1
>>
>> Which would just be a thin wrapper around (pseudocode):
>>
>> 	dir=$(git test--helper get-tempdir) &&
>> 	(
>> 		cd "$dir" &&
>>                 # And whatever else we need to set up to say "use this local installed git"
>> 		GIT_TEST_INSTALLED=[...] &&
>> 		. "$(git --test-dir)"/test-lib.sh
>> 		. "$(git --test-dir)"/doc-setup/rebase-description-1.sh"
>>
>> 		# This would run test_commit, and any other arbitrary setup code
>> 		setup_rebase_description_1()
>> 	) &&
>> 	echo "Go play with '$dir', and have fun"
>>
>> The big advantage of that is:
>>
>>  1. It ships with git, so it works offline, and we won't get into the
>>     inevitable confusion of the user reading v2.40 docs locally, but the
>>     online url tracking a v2.50 example or whatever.
>
> Isn't this always a problem (lack of synchronisation between multiple
> sources). If the user has local documentation, it should have matching
> bundles locally, No?

Yes, I just didn't know if that was your plan, so if that's how it works
then no problem.

It's just a depressingly common pattern these days that manual pages are
"just read about it at this link", which inevitably links to some
out-of-date documentation, even some of GCC's docs are doing that these
days.

It's good that that's not the plan here.

>>  2. We can represent whatever arbitrary repo state, e.g. drop the user
>>     into a merge conflict that's already happening.
> Isn't the manual's example already meant to describe that? And the user
> then (hopefully) follows along in their throw-away copy of the repo bundle.

Yeah, maybe that's fine.

>>  3. We can also represent "repo-extra" state, e.g. imagine the
>>     "git-gc/git-repack" docs discussing loose objects, and wanting to
>>     get you into some arbitrary state with regards to your loose objects
>>     etc.
> That's a future option, but way past the initial concept for user
> on-boarding.

  reply	other threads:[~2022-11-03 20:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 22:48 [RFC/PoC 0/5] Provide example docbundles Philip Oakley
2022-11-02 22:48 ` [RFC/PoC 1/5] doc: provide DocBundles design document Philip Oakley
2022-11-03  9:19   ` Ævar Arnfjörð Bjarmason
2022-11-03 19:50     ` Philip Oakley
2022-11-03 20:36       ` Ævar Arnfjörð Bjarmason [this message]
2022-11-02 22:48 ` [RFC/PoC 2/5] Documentation Bundles: ignore artifact files from creating doc bundles Philip Oakley
2022-11-03  9:12   ` Ævar Arnfjörð Bjarmason
2022-11-03 19:50     ` Philip Oakley
2022-11-02 22:48 ` [RFC/PoC 3/5] test-lib: add GIT_BUNDLE_DIR setup Philip Oakley
2022-11-03  9:14   ` Ævar Arnfjörð Bjarmason
2022-11-03 19:50     ` Philip Oakley
2022-11-02 22:48 ` [RFC/PoC 4/5] Doc Bundles: add t6102 rev-list simple and pulls examples Philip Oakley
2022-11-02 22:48 ` [RFC/PoC 5/5] docbundle: provide the git-log History Simplification example Philip Oakley
2022-11-03  9:17   ` Ævar Arnfjörð Bjarmason
2022-11-03 19:50     ` Philip Oakley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=221103.861qqj22bl.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    --cc=philipoakley@iee.email \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).