From: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
To: Junio C Hamano <gitster@pobox.com>,
Alexandr Miloslavskiy via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/5] parse_branchname_arg(): fix dash_dash_pos, drop argcount
Date: Thu, 19 Dec 2019 19:03:20 +0100 [thread overview]
Message-ID: <807d4e5c-89b9-298b-c022-08d330fbd3c9@syntevo.com> (raw)
In-Reply-To: <xmqqk16tea9u.fsf@gitster-ct.c.googlers.com>
Thanks for having a look at my patches!
On 18.12.2019 19:52, Junio C Hamano wrote:
>> Simplify the code by dropping `argcount` and useless `argc` / `argv`
>> manipulations.
>
> I am not sure if this is a good change, though. It goes against the
> reasoning that makes the above "dash-dash-pos" change is a good one,
> doesn't it? When the code changes over time, wouldn't it make the
> code more clear to keep track of the count of args it saw in a
> separate variable, than relying on the invariant that currently
> happens to hold which is "if dash-dash is after the first argument,
> return 2 and otherwise return 1"?
My bad that I forgot to write a detailed explanation for that. In V3 in
other topic [2] I have separated this change as a separate commit with a
good message.
>> + if (opts->accept_pathspec) {
>> + if (dash_dash_pos == 0)
>> + return 1; /* case (2) */
>> + else if (dash_dash_pos == 1)
>> + has_dash_dash = 1; /* case (3) or (1) */
>> + else if (dash_dash_pos >= 2)
>> + die(_("only one reference expected, %d given."), dash_dash_pos);
>
> Non-standard indentation? In our code, a level of indent is another
> horizontal tab.
Sorry, my Visual Studio was acting up again. It's doing pretty weird
things when I have tab size 4 (due to other projects), which is
overridden by git repo settings to 8.
Fixed it in V3 in other topic [2]
----
[1] Commit 09ebad6f ("checkout: split off a function to peel away
branchname arg", 2011-02-08)
[2]
https://lore.kernel.org/git/pull.490.v3.git.1576778515.gitgitgadget@gmail.com/
next prev parent reply other threads:[~2019-12-19 18:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 19:32 [PATCH 0/5] parse_branchname_arg(): make code easier to understand Alexandr Miloslavskiy via GitGitGadget
2019-11-28 19:32 ` [PATCH 1/5] parse_branchname_arg(): fix dash_dash_pos, drop argcount Alexandr Miloslavskiy via GitGitGadget
2019-12-18 18:52 ` Junio C Hamano
2019-12-19 18:03 ` Alexandr Miloslavskiy [this message]
2019-11-28 19:32 ` [PATCH 2/5] parse_branchname_arg(): introduce expect_commit_only Alexandr Miloslavskiy via GitGitGadget
2019-12-18 19:18 ` Junio C Hamano
2019-12-19 18:03 ` Alexandr Miloslavskiy
2019-11-28 19:32 ` [PATCH 3/5] parse_branchname_arg(): update code comments Alexandr Miloslavskiy via GitGitGadget
2019-11-28 19:32 ` [PATCH 4/5] parse_branchname_arg(): refactor the decision making Alexandr Miloslavskiy via GitGitGadget
2019-11-28 19:32 ` [PATCH 5/5] t2024: cover more cases Alexandr Miloslavskiy via GitGitGadget
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=807d4e5c-89b9-298b-c022-08d330fbd3c9@syntevo.com \
--to=alexandr.miloslavskiy@syntevo.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.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).