git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Thomas Braun <thomas.braun@virtuell-zuhause.de>
Subject: Re: [PATCH 2/4] Resurrect "diff-lib.c: adjust position of i-t-a entries in diff"
Date: Tue, 7 Jun 2016 19:04:26 +0700	[thread overview]
Message-ID: <CACsJy8DO+KU59LbQ0ZtTax6DZKqYmZVT6MHLmNK73GkO9qHf_w@mail.gmail.com> (raw)
In-Reply-To: <xmqqtwh6uk0k.fsf@gitster.mtv.corp.google.com>

On Tue, Jun 7, 2016 at 3:42 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> +--shift-ita::
>> +     By default entries added by "git add -N" appear as an existing
>> +     empty file in "git diff" and a new file in "git diff --cached".
>> +     This option makes the entry appear as a new file in "git diff"
>> +     and non-existent in "git diff --cached".
>
> I do not think this should exist at the UI level,

I need it. I do "git diff --stat" and "git diff --cached --stat" a lot
more often than "git status". Without this option, I'm stuck with the
old behavior.

> even though the
> use of it in wt-status.c (below) makes a very good sense at least
> as a temporary band-aid.
>
> At the philosophical level, I however think this "I-T-A does not
> logically exist in the index (yet)" is a mistake, and "an option
> controls if I-T-A does or does not exist depending on who calls it"
> is even worse; it is a road to insanity.

i-t-a entries have dual personality (perhaps because it's implemented
as an index entry). Although I think the "does not exist" aspect will
win in most cases. The intention behind the revert is we have more
time to examine case by case and gradually convert them. Maybe in the
end one behavior wins and we no longer need another. A thought of
keeping i-t-a entries in an index extension instead crossed my mind.
It may simplify things a bit (e.g. there's no "ghost" entries any more
and active_nr in 3/4 can remain "the number of _real_ entries"). The
few parts that do need to know about i-t-a entries need explict
modification (probably git-reset and git-diff). But I don't know yet
if it would just lead to another nightmare.

> For example, because I-T-A does not logically exist in the index,
> "git reset --hard" should not remove it but make it untracked again
> (but I do not think it does). After "git add -N foo", because "foo"
> does not exist in the index, "git clean" should remove it for the
> definition of what's in the index to be logically consistent, but
> the whole intent of "add -N" is that the user meant it is worth
> checking into sometime in the future, which contradicts with its
> removal upon "clean".

I think we should fix them. I started that and so far only 4d55200
(grep: make it clear i-t-a entries are ignored - 2015-12-27) has made
it to 'master'.

> So, I dunno.

I just remembered why the old behavior (abort to commit if i-t-a
entries are present) bugged me: it does not work well with splitting
changes in worktree into multiple commits (e.g. with "git add -p").
Even though I want git remind me to commit an i-t-a entry in the end,
it does not necessarily mean I have to do it in the next commit, which
may cover a bunch of files except that i-t-a file. I don't see any way
around that except ignoring i-t-a entries at commit time. If there's
another way, I'm all ears.
-- 
Duy

  reply	other threads:[~2016-06-07 12:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 11:16 [PATCH/RFC 0/4] i-t-a entries again Nguyễn Thái Ngọc Duy
2016-06-06 11:16 ` [PATCH 1/4] diff.h: extend "flags" field to 64 bits because we're out of bits Nguyễn Thái Ngọc Duy
2016-06-06 19:45   ` Junio C Hamano
2016-06-07  0:40     ` Duy Nguyen
2016-06-07  6:40   ` stefan.naewe
2016-06-06 11:16 ` [PATCH 2/4] Resurrect "diff-lib.c: adjust position of i-t-a entries in diff" Nguyễn Thái Ngọc Duy
2016-06-06 20:42   ` Junio C Hamano
2016-06-07 12:04     ` Duy Nguyen [this message]
2016-06-09 16:18   ` Johannes Schindelin
2016-09-27 10:58     ` Duy Nguyen
2016-09-27 12:27       ` Duy Nguyen
2016-06-06 11:16 ` [PATCH 3/4] commit: don't count i-t-a entries when checking if the new commit is empty Nguyễn Thái Ngọc Duy
2016-06-06 19:58   ` Junio C Hamano
2016-06-06 20:28     ` Junio C Hamano
2016-06-06 11:16 ` [PATCH/RFC 4/4] commit: reinstate commit behavior before 3f6d56d via a config option Nguyễn Thái Ngọc Duy

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=CACsJy8DO+KU59LbQ0ZtTax6DZKqYmZVT6MHLmNK73GkO9qHf_w@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=thomas.braun@virtuell-zuhause.de \
    /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).