From: Vishal Verma <vishal@stellar.sh>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Rafael Ascensão" <rafa.almas@gmail.com>
Subject: Re: [PATCH] Documentation/merge-options: clarify --squash behavior
Date: Thu, 25 Apr 2019 10:26:26 -0600 [thread overview]
Message-ID: <dfc0a40233677ce0e1d9d073c41b6f0fea3bf746.camel@stellar.sh> (raw)
In-Reply-To: <xmqqr29qyb1i.fsf@gitster-ct.c.googlers.com>
On Thu, 2019-04-25 at 13:16 +0900, Junio C Hamano wrote:
>
> I think it is bad to silently ignore the option. With or without
> this documentation update, I think it is sensible to update the code
> so that it errors out when "--squash --commit" are both given at the
> same time, just like when "--squash --no-ff" is given.
Yes that makes sense.
> Or make it "just work" as you said. Using a boolean variable as
> tristate is something we do in many places and it by itself is not a
> rocket science. You initialize the variable to -1 (unset), let
> parse_options() to set it to 0/1 when "--[no-]commit" is seen, and
> inspect after parse_options() finishes. If the variable is still
> -1, you know the user wants "the default" behaviour.
Ah I see - I was conflating OPT_BOOL with the parameter being a boolean
as well without checking, but I see now that isn't the case.
>
> The "default" behaviour you are proposing would probably be
> something like
>
> if (option_commit < 0) {
> /*
> * default to record the result in a commit.
> * but --squash traditionally does not.
> */
> if (!squash)
> option_commit = 1;
> else
> option_commit = 0;
> }
>
> But I suspect that the option parsing part is the least difficult in
> the "make it just work" change. That is because I think that the
> machinery to record the result in a commit is not expecting to be
> asked to create a single-parent commit to record the result of the
> squashing, so there may be need for adjusting to how the result
> wants to be recorded before the code makes a commit.
Yes I was going to try to allow the commit option as an experiment, and
just see what happens. For now I'll send a v2 that has a doc update as
well as prints a warning using the above technique.
I'll dig more into what allowing --commit actually means (as time
allows) - I'm definitely a newbie with git internals, and indeed this is
my first posting here.
Thanks for the feedback!
-Vishal
next prev parent reply other threads:[~2019-04-25 16:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 21:22 [PATCH] Documentation/merge-options: clarify --squash behavior Vishal Verma
2019-04-25 4:16 ` Junio C Hamano
2019-04-25 16:26 ` Vishal Verma [this message]
2019-04-26 21:17 ` [PATCH v2] builtin/merges: clarify --squash behavior with --commit vishal
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=dfc0a40233677ce0e1d9d073c41b6f0fea3bf746.camel@stellar.sh \
--to=vishal@stellar.sh \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rafa.almas@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).