git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH 2/6] tree-walk.c: remove the_repo from fill_tree_descriptor()
Date: Wed, 26 Jun 2019 12:47:25 -0400	[thread overview]
Message-ID: <2f4c3024-d787-6865-f3f9-a3f43a27a94f@gmail.com> (raw)
In-Reply-To: <xmqqblyke2hx.fsf@gitster-ct.c.googlers.com>

On 6/26/2019 12:27 PM, Junio C Hamano wrote:
> Derrick Stolee <stolee@gmail.com> writes:
> 
>>> 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.)
> 
> Hmm, interesting.  So those callers in builtin/rebase.c::reset_head()
> and other places that adds the_repository as the new first parameter
> can take a local variable "r" (or perhaps a bit more descriptive,
> e.g. "repo") that is initialized to "the_repository" (and never
> reassigned at least at this step) in this same patch?

Yes, that is what I was thinking. It means that we can stop munging
the function calls for the method that is converted. When the caller
is updated, the call site already uses "r" but we change how "r" is
initialized (as a parameter instead of a local variable).

Thanks,
-Stolee

  reply	other threads:[~2019-06-26 16:47 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
2019-06-26 16:27     ` Junio C Hamano
2019-06-26 16:47       ` Derrick Stolee [this message]
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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=2f4c3024-d787-6865-f3f9-a3f43a27a94f@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).