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

Re: [PATCH 3/3] add: pass in repo variable instead of global the_repository

From
Patrick Steinhardt <ps@pks.im>
Date
Sep 6, 2024, 10:46 UTC
Message-ID
<ZtrdnFjFeWG7asio@pks.im>
In-Reply-To
<bc9090469340fe2bead812918d149287dcda5609.1725555468.git.gitgitgadget@gmail.com>
On Thu, Sep 05, 2024 at 04:57:47PM +0000, John Cai via GitGitGadget wrote:
> Fr> diff --git a/builtin/add.c b/builtin/add.c
> index dac832df3e7..a68fd7c8313 100644
> --- a/builtin/add.c
> +++ b/builtin/add.c

One thing I'm missing in this patch is it getting rid of `USE_THE_REPOSITORY_VARIABLE`. Without that change it is impossible to see whether we are now free of `the_repository` in this file.

Show 10 quoted lines
> @@ -36,24 +36,27 @@ static int pathspec_file_nul;
>  static int include_sparse;
>  static const char *pathspec_from_file;
>  
> -static int chmod_pathspec(struct pathspec *pathspec, char flip, int show_only)
> +static int chmod_pathspec(struct pathspec *pathspec,
> +			  char flip,
> +			  int show_only,
> +			  struct repository *repo)
>  {
Nit: We typically tend to pass the repository as first argument. Also
applies to all the other functions.
Show 12 quoted lines
> diff --git a/commit.h b/commit.h
> index 0e5fce543c2..92fef717be1 100644
> --- a/commit.h
> +++ b/commit.h
> @@ -2,6 +2,7 @@
>  #define COMMIT_H
>  
>  #include "object.h"
> +#include "repository.h"
>  
>  struct signature_check;
>  struct strbuf;

There is no need for the include here, let's instead add a forward declaration.

Patrick
Previous: John Cai via GitGitGadgetNext: Junio C Hamano
Message 10 of 32 in “Add repository parameter to builtins”
  1. 0/3 Add repository parameter to builtinsJohn Cai via GitGitGadget, Sep 5, 2024
  2. 2/3 builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.hJohn Cai via GitGitGadget, Sep 5, 2024
  3. Junio C HamanoSep 5, 2024
  4. Patrick SteinhardtSep 6, 2024
  5. Junio C HamanoSep 6, 2024
  6. 1/3 builtin: add a repository parameter for builtin functionsJohn Cai via GitGitGadget, Sep 5, 2024
  7. Patrick SteinhardtSep 6, 2024
  8. John CaiSep 9, 2024
  9. 3/3 add: pass in repo variable instead of global the_repositoryJohn Cai via GitGitGadget, Sep 5, 2024
  10. Patrick SteinhardtSep 6, 2024
  11. Junio C HamanoSep 5, 2024
  12. 0/3 Add repository parameter to builtinsJohn Cai via GitGitGadget, Sep 10, 2024
  13. 3/3 add: pass in repo variable instead of global the_repositoryJohn Cai via GitGitGadget, Sep 10, 2024
  14. Junio C HamanoSep 11, 2024
  15. 2/3 builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.hJohn Cai via GitGitGadget, Sep 10, 2024
  16. Junio C HamanoSep 11, 2024
  17. John CaiSep 13, 2024
  18. 1/3 builtin: add a repository parameter for builtin functionsJohn Cai via GitGitGadget, Sep 10, 2024
  19. Junio C HamanoSep 10, 2024
  20. Junio C HamanoSep 11, 2024
  21. Patrick SteinhardtSep 12, 2024
  22. Jeff KingSep 12, 2024
  23. Jeff KingSep 12, 2024
  24. Patrick SteinhardtSep 12, 2024
  25. John CaiSep 13, 2024
  26. 0/4 Add repository parameter to builtinsJohn Cai via GitGitGadget, Sep 13, 2024
  27. 1/4 builtin: add a repository parameter for builtin functionsJohn Cai via GitGitGadget, Sep 13, 2024
  28. 3/4 builtin: remove USE_THE_REPOSITORY for those without the_repositoryJohn Cai via GitGitGadget, Sep 13, 2024
  29. 2/4 builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.hJohn Cai via GitGitGadget, Sep 13, 2024
  30. Junio C HamanoSep 13, 2024
  31. 4/4 add: pass in repo variable instead of global the_repositoryJohn Cai via GitGitGadget, Sep 13, 2024
  32. Junio C HamanoSep 13, 2024

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.