Re: [RFC/PoC 1/5] doc: provide DocBundles design document

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux