git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 3, 2022, 20:36 UTC
Message-ID
<221103.861qqj22bl.gmgdl@evledraar.gmail.com>
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:
Show 18 quoted lines
> 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.

Show 6 quoted lines
>> 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.

Show 24 quoted lines
>> 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,.

Show 29 quoted lines
>>
>> 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.
Show 6 quoted lines
>>  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.
Previous: Philip OakleyNext: Philip Oakley
Message 8 of 15 in “[RFC/PoC 0/5] Provide example docbundles”
  1. Philip OakleyNov 2, 2022
  2. 2/5 Documentation Bundles: ignore artifact files from creating doc bundlesPhilip Oakley, Nov 2, 2022
  3. Ævar Arnfjörð BjarmasonNov 3, 2022
  4. Philip OakleyNov 3, 2022
  5. 1/5 doc: provide DocBundles design documentPhilip Oakley, Nov 2, 2022
  6. Ævar Arnfjörð BjarmasonNov 3, 2022
  7. Philip OakleyNov 3, 2022
  8. Ævar Arnfjörð BjarmasonNov 3, 2022
  9. 3/5 test-lib: add GIT_BUNDLE_DIR setupPhilip Oakley, Nov 2, 2022
  10. Ævar Arnfjörð BjarmasonNov 3, 2022
  11. Philip OakleyNov 3, 2022
  12. 4/5 Doc Bundles: add t6102 rev-list simple and pulls examplesPhilip Oakley, Nov 2, 2022
  13. 5/5 docbundle: provide the git-log History Simplification examplePhilip Oakley, Nov 2, 2022
  14. Ævar Arnfjörð BjarmasonNov 3, 2022
  15. Philip OakleyNov 3, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.