From: Eric Sunshine <sunshine@sunshineco.com>
To: Mike Rappazzo <rappazzo@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
David Turner <dturner@twopensource.com>,
Git List <git@vger.kernel.org>
Subject: Re: [PATCH v7 2/3] worktree: move/refactor find_shared_symref from branch.c
Date: Wed, 16 Sep 2015 17:09:40 -0400 [thread overview]
Message-ID: <CAPig+cTP_Vgtm=D1ESrPMs=r44OpGNUdEBjYMQgnQrtG-WsiaQ@mail.gmail.com> (raw)
In-Reply-To: <CANoM8SVJr_B83vU43MFmDiL8phRcTqG3=5krk9iquuH3w5dN_Q@mail.gmail.com>
On Mon, Sep 14, 2015 at 1:44 PM, Mike Rappazzo <rappazzo@gmail.com> wrote:
> On Sat, Sep 12, 2015 at 11:19 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>> On Fri, Sep 4, 2015 at 5:39 PM, Michael Rappazzo <rappazzo@gmail.com> wrote:
>>> + while (!matched && worktree_list) {
>>> + if (strcmp("HEAD", symref)) {
>>> + strbuf_reset(&path);
>>> + strbuf_reset(&sb);
>>> + strbuf_addf(&path, "%s/%s", worktree_list->worktree->git_dir, symref);
>>> +
>>> + if (_parse_ref(path.buf, &sb, NULL)) {
>>> + continue;
>>> + }
>>> +
>>> + if (!strcmp(sb.buf, target))
>>> + matched = worktree_list->worktree;
>>
>> The original code in branch.c, which this patch removes, did not need
>> to make a special case of HEAD, so it's not immediately clear why this
>> replacement code does so. This is the sort of issue which argues in
>> favor of mutating the existing code (slowly) over the course of
>> several patches into the final form, rather than having the final form
>> come into existence out of thin air. When the changes are made
>> incrementally, it is easier for reviewers to understand why such
>> modifications are needed, which (hopefully) should lead to fewer
>> questions such as this one.
>
> I reversed the the check here; it is intended to check if the symref
> is _not_ the head, since the head
> ref has already been parsed. This is used in notes.c to find
> "NOTES_MERGE_REF".
I'm probably being dense, but I still don't understand why the code
now needs a special case for HEAD, whereas the original didn't. But,
my denseness my be indicative of this change not being well-described
(or described at all) by the commit message. Hopefully, when this is
refactored into finer changes, the purpose will become clear.
Thanks.
next prev parent reply other threads:[~2015-09-16 21:09 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-04 21:39 [PATCH v7 0/3] worktree: worktree.c functions and list builtin command Michael Rappazzo
2015-09-04 21:39 ` [PATCH v7 1/3] worktree: add top-level worktree.c Michael Rappazzo
2015-09-10 20:04 ` Junio C Hamano
2015-09-11 10:33 ` Mike Rappazzo
2015-09-13 2:39 ` Eric Sunshine
2015-09-13 6:27 ` Eric Sunshine
2015-09-14 12:20 ` Mike Rappazzo
2015-09-14 17:41 ` Junio C Hamano
2015-09-16 20:42 ` Eric Sunshine
2015-09-16 20:32 ` Eric Sunshine
2015-09-16 20:49 ` Mike Rappazzo
2015-09-22 1:05 ` Eric Sunshine
2015-09-22 1:17 ` Junio C Hamano
2015-09-04 21:39 ` [PATCH v7 2/3] worktree: move/refactor find_shared_symref from branch.c Michael Rappazzo
2015-09-11 16:16 ` Junio C Hamano
2015-09-11 21:43 ` Mike Rappazzo
2015-09-11 21:52 ` Junio C Hamano
2015-09-11 23:10 ` Eric Sunshine
2015-09-12 2:33 ` Mike Rappazzo
2015-09-13 3:19 ` Eric Sunshine
2015-09-14 17:44 ` Mike Rappazzo
2015-09-16 21:09 ` Eric Sunshine [this message]
2015-09-16 21:36 ` Mike Rappazzo
2015-09-22 1:07 ` Eric Sunshine
2015-09-04 21:39 ` [PATCH v7 3/3] worktree: add 'list' command Michael Rappazzo
2015-09-11 22:02 ` Junio C Hamano
2015-09-13 4:25 ` Eric Sunshine
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='CAPig+cTP_Vgtm=D1ESrPMs=r44OpGNUdEBjYMQgnQrtG-WsiaQ@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rappazzo@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).