list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Varun Naik <>
To: Varun Naik <>
Cc:, Junio C Hamano <>,
Subject: Re: [PATCH v3] diff-lib.c: handle empty deleted ita files
Date: Thu, 15 Aug 2019 09:26:21 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Thu, Aug 1, 2019 at 9:16 AM Varun Naik <> wrote:
> It is possible to delete a committed file from the index and then add it
> as intent-to-add. Certain forms of `git diff` should show the file.
> After `git reset HEAD`, the file should be identical in the index and
> HEAD. The commands already work correctly if the file has contents in
> HEAD. This patch provides the desired behavior even when the file is
> empty in HEAD.
> The affected "diff" commands and the "reset" command call
> diff-lib.c:do_oneway_diff() with a cache entry in the index and a cache
> entry in HEAD. An ita file is represented in the index by a cache entry
> with the same hash as an empty file. For a nonempty deleted ita file,
> do_oneway_diff() calls show_modified(), which detects a diff between the
> cache entry in the index and the cache entry in HEAD and therefore deems
> the file "modified". However, for an empty deleted ita file,
> do_oneway_diff() previously detected no such diff between the two cache
> entries and therefore deemed the file "not modified". After this fix,
> for any deleted ita file, do_oneway_diff() calls diff_index_show_file()
> and deems the file "deleted".
> `git diff-index --cached HEAD` prints a row of output for both a
> "modified" and a "deleted" file, although the output differs slightly.
> `git reset HEAD` treats a "modified" and a "deleted" file similarly,
> resurrecting the file in the index from HEAD.
> This change should not affect newly added ita files. For those, the
> "tree" cache entry is NULL, so the changed code is not executed.
> Helped-by: Junio C Hamano <>
> Signed-off-by: Varun Naik <>
> ---

Bumping this email, since I noticed v2 is still in pu.


  reply	other threads:[~2019-08-15 16:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12 15:02 [PATCH] reset: unstage " Varun Naik
2019-07-26  4:48 ` [PATCH v2] " Varun Naik
2019-07-26 18:19   ` Junio C Hamano
2019-07-29  6:52     ` Varun Naik
2019-07-29 16:07       ` Junio C Hamano
2019-08-01 16:15 ` [PATCH v3] diff-lib.c: handle " Varun Naik
2019-08-15 16:26   ` Varun Naik [this message]
2019-08-15 19:06   ` Junio C Hamano
2019-08-19 15:42     ` Varun Naik
2019-08-19 20:15       ` Junio C Hamano
2020-02-14 17:12         ` Varun Naik

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:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \ \
    --subject='Re: [PATCH v3] diff-lib.c: handle empty deleted ita files' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ \
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
 note: .onion URLs require Tor:

code repositories for project(s) associated with this inbox:

AGPL code for this site: git clone