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

Re: [PATCH 8/9] builtin: check pager.<cmd> configuration if RUN_SETUP_GENTLY is used

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Apr 15, 2010, 17:43 UTC
Message-ID
<q2rfcaeb9bf1004151043v5a8e5634z159b6fa01f859f7e@mail.gmail.com>
In-Reply-To
<20100415084925.GA14660@progeny.tock>
On Thu, Apr 15, 2010 at 10:49 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 14 quoted lines
> FWIW, my latest is at
>
>  git://repo.or.cz/git/jrn nd/setup/chapter-one
>
> Changes since the last series I sent to the list:
>
>  - test cleanups, after Junio’s feedback
>  - clarified commit messages, I hope
>
> If you’ve already started cleaning up or if something in the diff looks
> iffy, feel free to carry on with what you have.  I don’t want the test
> changes to interfere with more productive work.
>
> Looking forward to watching this evolve,

OK. Here is the topic breakdown into 11 sub-topics, after rebasing on setup/chapter-one. Patches 1, 2-3, 4-5, 8-9, 10-12, 13-18 can go as separate independent sub-topics, given that chapter-one is accepted. The rest must go in sequence because they will need some of previous groups. Commit messages aren't cleaned up yet, just the idea of grouping.

Patches available at git://repo.or.cz/git/pclouds.git tp/setup
     1	rev-parse --git-dir: print relative gitdir correctly

This will become a problem when patches 37-43 (let's name it "unset_git_directory") is merged. Other than that, it's can go alone.

     2	worktree setup: calculate prefix even if no worktree is found
     3	index-pack: trust the prefix returned by setup_git_directory_gently()

This is debatable, as you pointed out, because it changes "git rev-parse --show-prefix" behavior. This is a prerequisite for 19-36 (run-setup-gently)

     4	Move enter_repo() to setup.c
     5	enter_repo(): initialize other variables as
setup_git_directory_gently() does
Good thing. Quite simple. Prerequisite for 6-7 (have_run_setup)
     6	builtin: remember whether repository has been searched for
     7	builtins: setup repository before print unknown command error

Introduce startup_info->have_run_setup_gitdir, and a guard in command error printing.

     8	setup: save prefix (original cwd relative to toplevel) in startup_info
     9	builtin: remove prefix variable from run_builtin()

Introduce startup_info->prefix. Will be needed for 47-48 (alias fix) because setup_git_dir may be called in one place, and unset_git_dir is called in another place.

    10	run_builtin(): save "-h" detection result for later use
    11	builtins: utilize startup_info->help where possible
    12	builtins: check for startup_info->help, print and exit early

Fix "git cmd -h" shortcut. There will be warnings from git_config() once the old "guard unallowed access" patch is in. It will be fixed in patch 45.

    13	init/clone: turn on startup->have_repository properly
    14	t7002: test git grep --no-index from a bare repository
    15	Do not read .git/info/exclude if there is no repository
    16	Do not read .git/info/attributes if there is no repository
    17	apply: do not check sha1 if there is no repository
    18	config: do not read .git/config if there is no repository

Assorted fixes wrt unconditional access to .git/. All these patches simple add "if (have_repository)" or so.

    19	t0001: test git init when run via an alias
    20	t5512: test that ls-remote does not require a git repository
    21	t7006: expose test_terminal() for use by other tests
    22	help: note why it is appropriate for this command not to use
RUN_SETUP_GENTLY
    23	hash-object: use RUN_SETUP_GENTLY
    24	shortlog: use RUN_SETUP_GENTLY
    25	grep: use RUN_SETUP_GENTLY
    26	archive: use RUN_SETUP_GENTLY
    27	mailinfo: use RUN_SETUP_GENTLY
    28	check-ref-format: use RUN_SETUP_GENTLY
    29	verify-pack: use RUN_SETUP_GENTLY
    30	apply: use RUN_SETUP_GENTLY
    31	bundle: use RUN_SETUP_GENTLY
    32	diff: use RUN_SETUP_GENTLY
    33	ls-remote: use RUN_SETUP_GENTLY
    34	var: use RUN_SETUP_GENTLY
    35	merge-file: use RUN_SETUP_GENTLY
    36	index-pack: use RUN_SETUP_GENTLY

The RUN_SETUP_GENTLY series. Of course these will need to be reviewed, some commands might need finer-grain setup.

    37	Add git_config_early()
    38	t1300: test that scripted commands do not respect stray .git/config
    39	git_config(): do not read .git/config if there is no repository
    40	Use git_config_early() instead of git_config() during repo setup
    41	worktree setup: call set_git_dir explicitly
    42	worktree setup: restore original state when things go wrong
    43	Allow to undo setup_git_directory_gently() gracefully (and fix
alias code)
The unset_git_directory series. Make setup_git_directory() work right.
    44	Guard unallowed access to repository when it's not set up
    45	run_builtin: do now raise alarms
    46	setup_work_tree: do not raise alarm
Put unallowed access warnings in place. Also fixes false alarms.
    47	alias: keep repository found while collecting aliases as long as possible
    48	run_builtin: respect have_run_setup_gitdir
Fix alias related setup problem.
Insane?
-- 
Duy
Previous: Jonathan Nieder
Message 30 of 30 in “Setup cleanup, chapter one”
  1. 0/9 Setup cleanup, chapter oneJonathan Nieder, Apr 13, 2010
  2. 1/9 t7006: GIT_DIR/config should be honored in subdirs of toplevelJonathan Nieder, Apr 13, 2010
  3. Junio C HamanoApr 14, 2010
  4. t7006: guard cleanup with test_expect_successJonathan Nieder, Apr 15, 2010
  5. Junio C HamanoApr 15, 2010
  6. Jonathan NiederApr 15, 2010
  7. 2/9 t7006: test pager configuration for several git commandsJonathan Nieder, Apr 13, 2010
  8. Johannes SixtApr 13, 2010
  9. Jonathan NiederApr 13, 2010
  10. 2/9 t7006: test pager configuration for several git commandsJonathan Nieder, Apr 14, 2010
  11. 3/9 builtins: do not commit pager choice earlyJonathan Nieder, Apr 13, 2010
  12. 3/9 builtins: do not commit pager choice earlyJonathan Nieder, Apr 14, 2010
  13. 4/9 t7006: test pager.<cmd> configurationJonathan Nieder, Apr 13, 2010
  14. 4/9 t7006: test pager.<cmd> configurationJonathan Nieder, Apr 14, 2010
  15. 5/9 builtin: introduce startup_info structJonathan Nieder, Apr 13, 2010
  16. 6/9 builtin: remember whether repository was foundJonathan Nieder, Apr 13, 2010
  17. 7/9 builtin: Support RUN_SETUP_GENTLY to set up repository early if foundJonathan Nieder, Apr 13, 2010
  18. 8/9 builtin: check pager.<cmd> configuration if RUN_SETUP_GENTLY is usedJonathan Nieder, Apr 13, 2010
  19. Nguyen Thai Ngoc DuyApr 13, 2010
  20. Jonathan NiederApr 14, 2010
  21. Nguyen Thai Ngoc DuyApr 13, 2010
  22. Jonathan NiederApr 14, 2010
  23. Nguyen Thai Ngoc DuyApr 15, 2010
  24. 9/9 config: run setup before commiting pager choiceJonathan Nieder, Apr 13, 2010
  25. 9/9 config: run setup before commiting pager choiceJonathan Nieder, Apr 14, 2010
  26. 00/46 nd/setup remainder for convenient referenceJonathan Nieder, Apr 13, 2010
  27. Nguyen Thai Ngoc DuyApr 14, 2010
  28. Junio C HamanoApr 14, 2010
  29. Jonathan NiederApr 15, 2010
  30. Nguyen Thai Ngoc DuyApr 15, 2010

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.