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

Re: [PATCH 0/9] remove unnecessary if statement

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 18, 2025, 20:21 UTC
Message-ID
<xmqqmsdi144i.fsf@gitster.g>
In-Reply-To
<20250318115912.2978992-1-usmanakinyemi202@gmail.com>
Usman Akinyemi <usmanakinyemi202@gmail.com> writes:
Show 7 quoted lines
> In an earlier patch[1] which has been merged to the master,
> We checked `repo` is not NULL before making call to `repo_config()`.
> Later, in another patch series[2] which has been merged to next,
> `repo_config()` was taught to allow `repo` to be NULL.
>
> So there is not need for checking if the `repo` is NULL before calling
> repo_config() in the earlier patch.
OK, that sounds good.

Are we confident that our half-hearted choice of "there is no repo, so just do a very-early-config thing" is appropriate for any code paths?

At least we should be perfectly happy with that choice applied to all of these code paths touched by this series.

> Note, I have already sent the first 8 patches in [2] but, the 9th
> patch depends on the first patch of that series. 
So, is this [v2 0/9] of ua/some-builtins-wo-the-repository?

I think that topic has long been merged to 'next', and it is way too late to do a wholesale replacement like this.

Show 32 quoted lines
> [1] https://public-inbox.org/git/20250210181103.3609495-1-usmanakinyemi202@gmail.com/
> [2] https://public-inbox.org/git/20250307233543.1721552-1-usmanakinyemi202@gmail.com/
>
> Usman Akinyemi (9):
>   config: teach repo_config to allow `repo` to be NULL
>   builtin/verify-tag: stop using `the_repository`
>   builtin/verify-commit: stop using `the_repository`
>   builtin/send-pack: stop using `the_repository`
>   builtin/pack-refs: stop using `the_repository`
>   builtin/ls-files: stop using `the_repository`
>   builtin/for-each-ref: stop using `the_repository`
>   builtin/checkout-index: stop using `the_repository`
>   builtin/update-server-info: remove unnecessary if statement
>
>  builtin/checkout-index.c        | 43 ++++++++++++++++-----------------
>  builtin/for-each-ref.c          |  5 ++--
>  builtin/ls-files.c              | 32 ++++++++++++------------
>  builtin/pack-refs.c             |  8 +++---
>  builtin/send-pack.c             |  7 +++---
>  builtin/update-server-info.c    |  4 +--
>  builtin/verify-commit.c         | 13 +++++-----
>  builtin/verify-tag.c            |  7 +++---
>  config.c                        |  4 +++
>  config.h                        |  9 +++++++
>  t/t0610-reftable-basics.sh      |  7 ++++++
>  t/t2006-checkout-index-basic.sh |  7 ++++++
>  t/t3004-ls-files-basic.sh       |  7 ++++++
>  t/t5400-send-pack.sh            |  7 ++++++
>  t/t6300-for-each-ref.sh         |  7 ++++++
>  t/t7030-verify-tag.sh           |  7 ++++++
>  t/t7510-signed-commit.sh        |  7 ++++++
>  17 files changed, 118 insertions(+), 63 deletions(-)
Previous: Usman AkinyemiNext: Usman Akinyemi
Message 16 of 17 in “remove unnecessary if statement”
  1. 0/9 remove unnecessary if statementUsman Akinyemi, Mar 18, 2025
  2. 1/9 config: teach repo_config to allow `repo` to be NULLUsman Akinyemi, Mar 18, 2025
  3. Patrick SteinhardtMar 20, 2025
  4. Usman AkinyemiMar 21, 2025
  5. 2/9 builtin/verify-tag: stop using `the_repository`Usman Akinyemi, Mar 18, 2025
  6. Patrick SteinhardtMar 20, 2025
  7. 3/9 builtin/verify-commit: stop using `the_repository`Usman Akinyemi, Mar 18, 2025
  8. 4/9 builtin/send-pack: stop using `the_repository`Usman Akinyemi, Mar 18, 2025
  9. 5/9 builtin/pack-refs: stop using `the_repository`Usman Akinyemi, Mar 18, 2025
  10. 6/9 builtin/ls-files: stop using `the_repository`Usman Akinyemi, Mar 18, 2025
  11. 7/9 builtin/for-each-ref: stop using `the_repository`Usman Akinyemi, Mar 18, 2025
  12. 8/9 builtin/checkout-index: stop using `the_repository`Usman Akinyemi, Mar 18, 2025
  13. 9/9 builtin/update-server-info: remove unnecessary if statementUsman Akinyemi, Mar 18, 2025
  14. Patrick SteinhardtMar 20, 2025
  15. Usman AkinyemiMar 21, 2025
  16. Junio C HamanoMar 18, 2025
  17. Usman AkinyemiMar 19, 2025

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.