git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>, git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/6] tree-walk.c: remove the_repo from fill_tree_descriptor()
Date: Mon, 24 Jun 2019 09:30:14 -0400	[thread overview]
Message-ID: <a2d91c63-86ca-90e7-0087-09df269d3865@gmail.com> (raw)
In-Reply-To: <20190624095533.22162-3-pclouds@gmail.com>

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

  reply	other threads:[~2019-06-24 13:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24  9:55 [PATCH 0/6] Kill the_repository in tree-walk.c Nguyễn Thái Ngọc Duy
2019-06-24  9:55 ` [PATCH 1/6] sha1-file.c: remove the_repo from read_object_with_reference() Nguyễn Thái Ngọc Duy
2019-06-27 12:54   ` Johannes Schindelin
2019-06-27 13:12     ` Duy Nguyen
2019-06-24  9:55 ` [PATCH 2/6] tree-walk.c: remove the_repo from fill_tree_descriptor() Nguyễn Thái Ngọc Duy
2019-06-24 13:30   ` Derrick Stolee [this message]
2019-06-26 16:27     ` Junio C Hamano
2019-06-26 16:47       ` Derrick Stolee
2019-06-24  9:55 ` [PATCH 3/6] tree-walk.c: remove the_repo from get_tree_entry() Nguyễn Thái Ngọc Duy
2019-06-24 14:20   ` Derrick Stolee
2019-06-24 14:55     ` Duy Nguyen
2019-06-24  9:55 ` [PATCH 4/6] tree-walk.c: remove the_repo from get_tree_entry_follow_symlinks() Nguyễn Thái Ngọc Duy
2019-06-24  9:55 ` [PATCH 5/6] match-trees.c: remove the_repo from shift_tree*() Nguyễn Thái Ngọc Duy
2019-06-24  9:55 ` [PATCH 6/6] Use the right 'struct repository' instead of the_repository Nguyễn Thái Ngọc Duy
2019-06-24 14:24   ` Derrick Stolee
2019-06-24 14:45     ` Duy Nguyen
2019-06-27  9:06   ` Johannes Schindelin
2019-06-26 17:20 ` [PATCH 0/6] Kill the_repository in tree-walk.c Junio C Hamano
2019-06-27 13:04   ` Johannes Schindelin
2019-06-27 17:09     ` Derrick Stolee
2019-06-27  9:28 ` [PATCH v2 " Nguyễn Thái Ngọc Duy
2019-06-27  9:28   ` [PATCH v2 1/6] sha1-file.c: remove the_repo from read_object_with_reference() Nguyễn Thái Ngọc Duy
2019-06-28 12:46     ` Johannes Schindelin
2019-06-27  9:28   ` [PATCH v2 2/6] tree-walk.c: remove the_repo from fill_tree_descriptor() Nguyễn Thái Ngọc Duy
2019-06-27  9:28   ` [PATCH v2 3/6] tree-walk.c: remove the_repo from get_tree_entry() Nguyễn Thái Ngọc Duy
2019-06-27  9:28   ` [PATCH v2 4/6] tree-walk.c: remove the_repo from get_tree_entry_follow_symlinks() Nguyễn Thái Ngọc Duy
2019-06-27  9:28   ` [PATCH v2 5/6] match-trees.c: remove the_repo from shift_tree*() Nguyễn Thái Ngọc Duy
2019-06-27  9:28   ` [PATCH v2 6/6] Use the right 'struct repository' instead of the_repository Nguyễn Thái Ngọc Duy
2019-06-27 19:44   ` [PATCH v2 0/6] Kill the_repository in tree-walk.c Junio C Hamano
2019-06-28  9:35   ` [PATCH v2 7/6] t7814: do not generate same commits in different repos Nguyễn Thái Ngọc Duy
2019-06-28 16:17     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2d91c63-86ca-90e7-0087-09df269d3865@gmail.com \
    --to=stolee@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).