Re: [PATCH] read-cache.c: Ensure unmerged entries are removed

2014-08-18 Thread Junio C Hamano
Jaime Soriano Pastor jsorianopas...@gmail.com writes: I'd like to add some tests too for this, but I don't know how to reproduce this state with git commands only, is there any way to add entries to the index without checkings? Perhaps feeding update-index --index-info four input lines would

Re: [PATCH] read-cache.c: Ensure unmerged entries are removed

2014-08-18 Thread Jaime Soriano Pastor
Yes, --index-info worked for this purpouse, thanks! https://github.com/jsoriano/git/blob/remove-unmerged-index-entry/t/t9904-unmerged-file-with-merged-entry.sh#L25 I'll try to send the patches to the mailing lists later today or tomorrow. On Mon, Aug 18, 2014 at 6:34 PM, Junio C Hamano

Re: [PATCH] read-cache.c: Ensure unmerged entries are removed

2014-08-16 Thread Jaime Soriano Pastor
I'd like to add some tests too for this, but I don't know how to reproduce this state with git commands only, is there any way to add entries to the index without checkings? Or maybe it could be done by creating a test- command that adds the entries to an index? Thanks. On Fri, Aug 15, 2014 at

Re: [PATCH] read-cache.c: Ensure unmerged entries are removed

2014-08-15 Thread Jaime Soriano Pastor
On Thu, Aug 14, 2014 at 1:04 AM, Junio C Hamano gits...@pobox.com wrote: Being a conservative, I'd rather avoid doing any magic during read_cache() time. ls-files -s for example should show the four stages so that the broken state can be inspected. Well, only read_cache_unmerged() is modified

Re: [PATCH] read-cache.c: Ensure unmerged entries are removed

2014-08-15 Thread Junio C Hamano
Jaime Soriano Pastor jsorianopas...@gmail.com writes: On Thu, Aug 14, 2014 at 1:04 AM, Junio C Hamano gits...@pobox.com wrote: Being a conservative, I'd rather avoid doing any magic during read_cache() time. ls-files -s for example should show the four stages so that the broken state can be

Re: [PATCH] read-cache.c: Ensure unmerged entries are removed

2014-08-13 Thread Jaime Soriano Pastor
On Tue, Aug 12, 2014 at 8:31 PM, Junio C Hamano gits...@pobox.com wrote: Jaime Soriano Pastor jsorianopas...@gmail.com writes: A file in the index can be left as merged and unmerged at the same time by some tools as libgit2, this causes some undesiderable behaviours in git. Well, doesn't

Re: [PATCH] read-cache.c: Ensure unmerged entries are removed

2014-08-13 Thread Jaime Soriano Pastor
On Tue, Aug 12, 2014 at 8:39 PM, Junio C Hamano gits...@pobox.com wrote: Jaime Soriano Pastor jsorianopas...@gmail.com writes: Wrong implementations of tools that modify the index can left some files as merged and unmerged at the same time. Avoid undesiderable behaviours by handling this

Re: [PATCH] read-cache.c: Ensure unmerged entries are removed

2014-08-13 Thread Junio C Hamano
Jaime Soriano Pastor jsorianopas...@gmail.com writes: In the problematic cases I've seen (specially git add and git reset --hard) the final state of both, merged and unmerged files, is that only an entry in stage 0 exists. Also, the current implementation of git checkout -f silently removes

Re: [PATCH] read-cache.c: Ensure unmerged entries are removed

2014-08-12 Thread Junio C Hamano
Jaime Soriano Pastor jsorianopas...@gmail.com writes: A file in the index can be left as merged and unmerged at the same time by some tools as libgit2, this causes some undesiderable behaviours in git. Well, doesn't it mean that libgit2 is broken? Have you filed a bug over there yet? Having

Re: [PATCH] read-cache.c: Ensure unmerged entries are removed

2014-08-12 Thread Junio C Hamano
Jaime Soriano Pastor jsorianopas...@gmail.com writes: Wrong implementations of tools that modify the index can left some files as merged and unmerged at the same time. Avoid undesiderable behaviours by handling this situation. It is understandable that the way _you_ decided to handle the