git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 1/2] diff --cached: do not report i-t-a entries as "new"
Date: Mon,  9 Mar 2015 21:14:04 +0700	[thread overview]
Message-ID: <1425910445-27383-2-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1425910445-27383-1-git-send-email-pclouds@gmail.com>

Paths marked by "git add -N" are simply a reminder to the user that
these files should be staged. If the user does not stage any of them,
"git commit" will not record them.

Align the behavior of "diff --cached" and "git commit". The most
prominent result of this patch is "git status" no longer reports i-t-a
paths as "Changes to be committed".

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 diff-lib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/diff-lib.c b/diff-lib.c
index a85c497..db0e6f8 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -400,6 +400,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
 	 * Something added to the tree?
 	 */
 	if (!tree) {
+		if (idx && (idx->ce_flags & CE_INTENT_TO_ADD))
+			return;
 		show_new_file(revs, idx, cached, match_missing);
 		return;
 	}
-- 
2.3.0.rc1.137.g477eb31

  reply	other threads:[~2015-03-09 14:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-09 14:14 [PATCH/RFC 0/2] Bug fixes regarding diff and "git add -N" Nguyễn Thái Ngọc Duy
2015-03-09 14:14 ` Nguyễn Thái Ngọc Duy [this message]
2015-03-15  6:55   ` [PATCH 1/2] diff --cached: do not report i-t-a entries as "new" Junio C Hamano
2015-03-16 13:56   ` [PATCH v2] diff-lib.c: adjust position of i-t-a entries in diff Nguyễn Thái Ngọc Duy
2015-03-16 15:15     ` Michael J Gruber
2015-03-16 16:05       ` Junio C Hamano
2015-03-17 14:07         ` Duy Nguyen
2015-03-17 17:57           ` Junio C Hamano
2015-03-18 12:47             ` Duy Nguyen
2015-03-18 20:30               ` Junio C Hamano
2015-03-19  6:00                 ` Junio C Hamano
2015-03-24  1:15                   ` Duy Nguyen
2015-03-24 17:00                     ` Junio C Hamano
2015-03-23 20:52                 ` Junio C Hamano
2015-03-09 14:14 ` [PATCH 2/2] diff-files: mark i-t-a paths as "new" Nguyễn Thái Ngọc Duy
2015-03-15  7:05   ` Junio C Hamano
2015-03-09 15:45 ` [PATCH] t2203,t4011: adjust to changed intent-to-add treatment Michael J Gruber
2015-03-15  7:07   ` Junio C Hamano

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=1425910445-27383-2-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    /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).