git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/3] Resurrect "diff-lib.c: adjust position of i-t-a entries in diff"
Date: Wed, 28 Sep 2016 12:28:00 -0700	[thread overview]
Message-ID: <xmqqzimrj03j.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160928114348.1470-2-pclouds@gmail.com> ("Nguyễn Thái Ngọc Duy"'s message of "Wed, 28 Sep 2016 18:43:46 +0700")

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

> The original commit d95d728aba06a34394d15466045cbdabdada58a2 was
> reverted in commit 78cc1a540ba127b13f2f3fd531777b57f3a9cd46 because we
> were (and still are) not ready for a new world order. A lot more
> investigation must be done to see what is impacted. See the 78cc1a5 for
> details.
>
> This patch takes a smaller and safer step. The new behavior is
> controlled by shift_ita flag. We can gradually move more diff users to
> the new behavior after we are sure it's safe to do so. This flag is
> exposed to outside temporarily as "--shift-ita" for people who prefer
> "git diff [--cached] --stat" to "git status"

Let's stop advertising this as a resurrection of something else.
The original that was unconditional was simply broken.

It is very good to refer to it (and its reversion), when justifying
why this version takes the particular approach to introduce a new
optional behaviour that can be toggled on selectively, by explaining
why doing this unconditionally was a broken idea that needed to be
reverted later.

But you would need to explain what problem this patch attempts to
solve and how before even going into that.  The above two paragraphs
are backwards.

As I already said, --shift-ita is not quite descriptive and I think
it should be renamed to something else, but I kept that in the
following attempt to rewrite:

    Subject: diff-lib: allow ita entries treated as "not yet exist in index"

    When comparing the index and the working tree to show which
    paths are new, and comparing the tree recorded in the HEAD and
    the index to see if committing the contents recorded in the
    index would result in an empty commit, we would want the former
    comparison to say "these are new paths" and the latter to say
    "there is no change" for paths that are marked as intent-to-add.

    We made a similar attempt at d95d728a ("diff-lib.c: adjust
    position of i-t-a entries in diff", 2015-03-16), which redefined
    the semantics of these two comparison modes globally, which was
    a disastor and had to be reverted at 78cc1a54 ("Revert
    "diff-lib.c: adjust position of i-t-a entries in diff"",
    2015-06-23).  To make sure we do not repeat the same mistake,
    introduce a new internal diffopt option so that this different
    semantics can be asked for only by callers that ask it, while
    making sure other unaudited callers will get the same comparison
    result.  This internal option is also exposed temporarily as
    "--shift-ita" to help experiment.

After reading the three patches through, however, I do not think we
use the command line option anywhere.  I'm inclined to say that we
shouldn't add it at all.  Or at least do so in a separate follow-up
patch "now we have an internal mechanism, let's expose it anyway" at
the end.  Which means that the last sentence in my attempted rewrite
should go.

The patch to diff-lib.c machinery looks good.

Thanks.

  reply	other threads:[~2016-09-28 19:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28 11:43 [PATCH 0/3] i-t-a entries in git-status, and git-commit Nguyễn Thái Ngọc Duy
2016-09-28 11:43 ` [PATCH 1/3] Resurrect "diff-lib.c: adjust position of i-t-a entries in diff" Nguyễn Thái Ngọc Duy
2016-09-28 19:28   ` Junio C Hamano [this message]
2016-09-28 20:33     ` Junio C Hamano
2016-10-03 10:36     ` Duy Nguyen
2016-10-04 16:15       ` Junio C Hamano
2016-10-05  9:43         ` Duy Nguyen
2016-10-06 19:15           ` Junio C Hamano
2016-10-07 12:56             ` Duy Nguyen
2016-10-10 23:08               ` Junio C Hamano
2016-09-28 11:43 ` [PATCH 2/3] diff-lib.c: enable --shift-ita in index_differs_from() Nguyễn Thái Ngọc Duy
2016-09-28 18:49   ` Junio C Hamano
2016-09-28 11:43 ` [PATCH 3/3] commit: don't be fooled by ita entries when creating initial commit Nguyễn Thái Ngọc Duy
2016-09-28 11:51 ` [PATCH 0/3] i-t-a entries in git-status, and git-commit Duy Nguyen
2016-10-24 10:42 ` [PATCH 0/4] nd/ita-empty-commit update Nguyễn Thái Ngọc Duy
2016-10-24 10:42   ` [PATCH 1/4] diff-lib: allow ita entries treated as "not yet exist in index" Nguyễn Thái Ngọc Duy
2016-10-24 10:42   ` [PATCH 2/4] diff: add --ita-[in]visible-in-index Nguyễn Thái Ngọc Duy
2016-10-24 10:42   ` [PATCH 3/4] commit: fix empty commit creation when there's no changes but ita entries Nguyễn Thái Ngọc Duy
2016-10-24 10:42   ` [PATCH 4/4] commit: don't be fooled by ita entries when creating initial commit Nguyễn Thái Ngọc Duy
2016-10-24 17:58   ` [PATCH 0/4] nd/ita-empty-commit update Junio C Hamano
2016-10-25  9:34     ` Duy Nguyen

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=xmqqzimrj03j.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --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).