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

Re: [PATCH 1/2] branch.c: remove explicit reference to the_repository

From
Duy Nguyen <pclouds@gmail.com>
Date
Aug 15, 2018, 17:43 UTC
Message-ID
<CACsJy8CE+TsE3kS+VCvxKGg6zHaDttTw+izkgveJ8qW=tSpTWA@mail.gmail.com>
In-Reply-To
<xmqqh8jvil8n.fsf@gitster-ct.c.googlers.com>
On Wed, Aug 15, 2018 at 7:38 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
>
> Duy Nguyen <pclouds@gmail.com> writes:
>
> >> 4) eventually (in the very long run), we'd change the signature of
> >>   all commands from cmd_foo(int argc, char argv, char *prefix)
> >>   to cmd_foo(int argc, char argv, struct repository *repo)
> >>
> >> you seem to be interested in removing the_repository from branch.c,
> >> but not as much from bultin/ for now, which is roughly step 2 in that plan?
> >
> > Yes. Though I think step 4 is to make setup_git_directory() and
> > enter_repo() return a 'struct repository *'. This means if you have
> > not called either function and not take the repo as an argument, you
> > do not have access to any repository.
>
> That part is understandable if somewhat hand-wavy, but it is not
> clear how you can lose the prefix and still keep things like
> OPT_FILENAME() working correctly.

I haven't worked it all out yet, but I think setup_git_directory() could still return it either as a separate argument or inside 'struct repository'. Then parse_options() still takes the prefix like now, or take the struct repository (the latter may be better because there's also other option callbacks that need struct repo).

-- 
Duy
Previous: Junio C HamanoNext: Junio C Hamano
Message 16 of 18 in “branch.c: remove explicit reference to the_repository”
  1. 1/2 branch.c: remove explicit reference to the_repositoryNguyễn Thái Ngọc Duy, Aug 15, 2018
  2. 2/2 cherry-pick: fix --quit not deleting CHERRY_PICK_HEADNguyễn Thái Ngọc Duy, Aug 15, 2018
  3. Stefan BellerAug 15, 2018
  4. Duy NguyenAug 15, 2018
  5. Stefan BellerAug 15, 2018
  6. Junio C HamanoAug 15, 2018
  7. Duy NguyenAug 15, 2018
  8. Junio C HamanoAug 15, 2018
  9. cherry-pick: fix --quit not deleting CHERRY_PICK_HEADNguyễn Thái Ngọc Duy, Aug 16, 2018
  10. Junio C HamanoAug 16, 2018
  11. Elijah NewrenAug 15, 2018
  12. Duy NguyenAug 15, 2018
  13. Stefan BellerAug 15, 2018
  14. Duy NguyenAug 15, 2018
  15. Junio C HamanoAug 15, 2018
  16. Duy NguyenAug 15, 2018
  17. Junio C HamanoAug 15, 2018
  18. Duy NguyenAug 15, 2018

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.