[PATCH] reset: unstage empty deleted ita files

2019-07-12 Thread Varun Naik
It is possible to delete a committed file from the index and then add it as intent-to-add. After `git reset HEAD`, the file should be identical in the index and HEAD. This patch provides the desired behavior even when the file is empty in the index. Signed-off-by: Varun Naik --- My first patch

[PATCH] read-cache.c: do not die if mmap fails

2019-07-13 Thread Varun Naik
then invoking any command that reads from the index. Signed-off-by: Varun Naik --- I believe this is the only place that calls xmmap() when it should be calling xmmap_gently(). There is a related recent commit 3203566a71 ("Use xmmap_gently instead of xmmap in use_pack", 2019-05-1

[PATCH v2] reset: unstage empty deleted ita files

2019-07-25 Thread Varun Naik
It is possible to delete a committed file from the index and then add it as intent-to-add. After `git reset HEAD`, the file should be identical in the index and HEAD. This patch provides the desired behavior even when the file is empty in the index. Signed-off-by: Varun Naik --- CC Duy because

[PATCH] checkout.c: unstage empty deleted ita files

2019-07-25 Thread Varun Naik
: Varun Naik --- CC Jeff because you wrote the code that I am changing now. checkout.c:update_some() discards the newly created cache entry when its mode and oid match those of the old entry. Since an ita file has the same oid as an empty file, an empty deleted ita file passes both of these checks, and

Re: [PATCH] checkout.c: unstage empty deleted ita files

2019-07-25 Thread Varun Naik
Got the CC list wrong in the first email... Varun On Thu, Jul 25, 2019 at 9:57 PM Varun Naik wrote: > > It is possible to delete a committed file from the index and then add it > as intent-to-add. After `git checkout HEAD` or `git restore --staged`, > the file should be identical

Re: [PATCH v2] reset: unstage empty deleted ita files

2019-07-28 Thread Varun Naik
On Fri, Jul 26, 2019 at 11:20 AM Junio C Hamano wrote: > > Varun Naik writes: > > > It is possible to delete a committed file from the index and then add it > > as intent-to-add. After `git reset HEAD`, the file should be identical > > in the index and HEAD. This

Re: [PATCH] checkout.c: unstage empty deleted ita files

2019-07-28 Thread Varun Naik
On Fri, Jul 26, 2019 at 1:57 AM Jeff King wrote: > > On Thu, Jul 25, 2019 at 09:56:45PM -0700, Varun Naik wrote: > > > It is possible to delete a committed file from the index and then add it > > as intent-to-add. After `git checkout HEAD` or `git restore --staged`, &

[PATCH v2] checkout.c: unstage empty deleted ita files

2019-08-01 Thread Varun Naik
instead. This change should not affect newly added ita files. For those, inside tree.c:read_tree_1(), tree_entry_interesting() returns entry_not_interesting, so fn is never called. Helped-by: Jeff King Signed-off-by: Varun Naik --- This patch fixes and tests only "checkout", because &qu

[PATCH] restore: add test for deleted ita files

2019-08-01 Thread Varun Naik
`git restore --staged` uses the same machinery as `git checkout HEAD`, so there should be a similar test case for "restore" as the existing test case for "checkout" with deleted ita files. Helped-by: Jeff King Signed-off-by: Varun Naik --- This is the "restore" p

[PATCH v3] diff-lib.c: handle empty deleted ita files

2019-08-01 Thread Varun Naik
, the "tree" cache entry is NULL, so the changed code is not executed. Helped-by: Junio C Hamano Signed-off-by: Varun Naik --- I tried to limit the "blast radius" of affected commands as much as possible. To find commands that were affected, I ran the following: git diff

[PATCH v3] checkout.c: unstage empty deleted ita files

2019-08-02 Thread Varun Naik
instead. This change should not affect newly added ita files. For those, inside tree.c:read_tree_1(), tree_entry_interesting() returns entry_not_interesting, so fn is never called. Helped-by: Jeff King Signed-off-by: Varun Naik --- This patch fixes and tests "checkout". New in v3 is a

[RFC PATCH] unpack-trees.c: handle empty deleted ita files

2019-08-13 Thread Varun Naik
leted ita file was previously considered the "same" as the cache entry for an empty file. This fix adds a comparison of the intent-to-add bits so that the two cache entries are no longer considered the "same". Signed-off-by: Varun Naik --- I am marking this patch as RFC be

Re: [RFC PATCH] unpack-trees.c: handle empty deleted ita files

2019-08-15 Thread Varun Naik
On Tue, Aug 13, 2019 at 1:33 PM Junio C Hamano wrote: > > The original code considered that two entries with the same mode and > the same "contents" are the same. As nobody sane tracks an empty > file for an extended span of history, that meant that most of the > time, intent-to-add entries, whic

[PATCH v2] unpack-trees.c: distinguish ita files from empty files

2019-08-15 Thread Varun Naik
the "same". This fix checks the intent-to-add bits so if one or both of the cache entries are marked as ita, then the two cache entries are not considered the "same". Helped-by: René Scharfe Signed-off-by: Varun Naik --- I rewrote the code in same(), as René suggested. Ne

Re: [PATCH v3] diff-lib.c: handle empty deleted ita files

2019-08-15 Thread Varun Naik
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 c

Re: [RFC PATCH] unpack-trees.c: handle empty deleted ita files

2019-08-19 Thread Varun Naik
On Thu, Aug 15, 2019 at 9:34 AM Junio C Hamano wrote: > > Varun Naik writes: > > > On Tue, Aug 13, 2019 at 1:33 PM Junio C Hamano wrote: > >> > >> So perhaps > >> > >> + !ce_intent_to_add(a) && !ce_intent_to_add(b) &&

Re: [PATCH v3] diff-lib.c: handle empty deleted ita files

2019-08-19 Thread Varun Naik
On Thu, Aug 15, 2019 at 12:06 PM Junio C Hamano wrote: > > /* > * i-t-a entries do not actually exist in the index (if we're > * looking at its content) > */ > if (o->index_only && > revs->diffopt.ita_invisible_in_index && > idx &&

[PATCH v3] unpack-trees.c: distinguish ita files from empty files

2019-08-20 Thread Varun Naik
the "same". This fix checks the intent-to-add bits so if one or both of the cache entries are marked as ita, then the two cache entries are not considered the "same". Helped-by: René Scharfe Signed-off-by: Varun Naik --- I rewrote the code in same(), as René suggested. Someh