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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

> @@ -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.

> 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux