Re: [PATCH 2/6] tree-walk.c: remove the_repo from fill_tree_descriptor()

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

 



On 6/24/2019 5:55 AM, Nguyễn Thái Ngọc Duy wrote:
> While at there, clean up the_repo usage in builtin/merge-tree.c a tiny
> bit.
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
> ---
>  builtin/merge-tree.c | 22 +++++++++++++---------
>  builtin/rebase.c     |  4 ++--
>  builtin/reset.c      |  4 ++--
>  notes.c              |  2 +-
>  sequencer.c          |  2 +-
>  tree-diff.c          |  4 ++--
>  tree-walk.c          |  6 ++++--
>  tree-walk.h          |  4 +++-
>  unpack-trees.c       |  2 +-
>  9 files changed, 29 insertions(+), 21 deletions(-)
> 
> diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
> index 34ca0258b1..97b54caeb9 100644
> --- a/builtin/merge-tree.c
> +++ b/builtin/merge-tree.c
> @@ -205,6 +205,7 @@ static void resolve(const struct traverse_info *info, struct name_entry *ours, s
>  static void unresolved_directory(const struct traverse_info *info,
>  				 struct name_entry n[3])
>  {
> +	struct repository *r = the_repository;

I like this trick to make the change below minimal:
> +	buf0 = fill_tree_descriptor(r, t + 0, ENTRY_OID(n + 0));
> +	buf1 = fill_tree_descriptor(r, t + 1, ENTRY_OID(n + 1));
> +	buf2 = fill_tree_descriptor(r, t + 2, ENTRY_OID(n + 2));

I wonder if _every_ conversion should include this trick,
so when we move to change that method we simply move the definition
from the method block to the prototype. (No need to adjust what you've
done already, just an idea for future conversions.)

Thanks,
-Stolee



[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