From: Jaime Soriano Pastor <jsorianopastor@gmail.com>
To: git@vger.kernel.org
Cc: Jaime Soriano Pastor <jsorianopastor@gmail.com>
Subject: [PATCH 1/4] read_index_unmerged doesn't loop forever if merged stage exists for unmerged file
Date: Wed, 20 Aug 2014 13:26:00 +0200 [thread overview]
Message-ID: <3c1dfe8a1cc03c083e93ce834aac574e4e321f6e.1408533065.git.jsorianopastor@gmail.com> (raw)
In-Reply-To: <cover.1408533065.git.jsorianopastor@gmail.com>
In-Reply-To: <cover.1408533065.git.jsorianopastor@gmail.com>
Signed-off-by: Jaime Soriano Pastor <jsorianopastor@gmail.com>
---
read-cache.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index 7f5645e..c932b83 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1933,6 +1933,7 @@ int read_index_unmerged(struct index_state *istate)
{
int i;
int unmerged = 0;
+ struct cache_entry *merged_ce = NULL;
read_index(istate);
for (i = 0; i < istate->cache_nr; i++) {
@@ -1940,9 +1941,26 @@ int read_index_unmerged(struct index_state *istate)
struct cache_entry *new_ce;
int size, len;
- if (!ce_stage(ce))
+ if (!ce_stage(ce)) {
+ merged_ce = ce;
continue;
+ }
unmerged = 1;
+ if (merged_ce && ce_same_name(merged_ce, ce)) {
+ warning("Unexpected stages for merged file '%s':",
+ merged_ce->name);
+ i--;
+ while (i < istate->cache_nr &&
+ ce_same_name(merged_ce, istate->cache[i])) {
+ ce = istate->cache[i++];
+ warning("%06o %s %d",
+ ce->ce_mode, sha1_to_hex(ce->sha1), ce_stage(ce));
+ }
+ i--;
+ merged_ce->ce_flags = create_ce_flags(0) | CE_CONFLICTED;
+ merged_ce = NULL;
+ continue;
+ }
len = ce_namelen(ce);
size = cache_entry_size(len);
new_ce = xcalloc(1, size);
@@ -1953,7 +1971,6 @@ int read_index_unmerged(struct index_state *istate)
if (add_index_entry(istate, new_ce, 0))
return error("%s: cannot drop to stage #0",
new_ce->name);
- i = index_name_pos(istate, new_ce->name, len);
}
return unmerged;
}
--
2.0.4.4.gaf54b2b
next prev parent reply other threads:[~2014-08-20 11:27 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-12 15:31 [PATCH] read-cache.c: Ensure unmerged entries are removed Jaime Soriano Pastor
2014-08-12 15:31 ` Jaime Soriano Pastor
2014-08-12 18:39 ` Junio C Hamano
2014-08-13 22:10 ` Jaime Soriano Pastor
2014-08-13 23:04 ` Junio C Hamano
2014-08-15 19:50 ` Jaime Soriano Pastor
2014-08-15 21:45 ` Junio C Hamano
2014-08-16 14:51 ` Jaime Soriano Pastor
2014-08-18 16:34 ` Junio C Hamano
2014-08-18 17:23 ` Jaime Soriano Pastor
2014-08-20 11:25 ` [PATCH 0/4] Handling unmerged files with merged entries Jaime Soriano Pastor
2014-08-20 11:26 ` Jaime Soriano Pastor [this message]
2014-08-20 11:26 ` [PATCH 2/4] Error out when adding a file with merged and unmerged entries Jaime Soriano Pastor
2014-08-20 11:26 ` [PATCH 3/4] Added tests for the case of merged and unmerged entries for the same file Jaime Soriano Pastor
2014-08-20 21:00 ` Junio C Hamano
2014-08-21 13:51 ` Jaime Soriano Pastor
2014-08-21 22:21 ` Junio C Hamano
2014-08-20 11:26 ` [PATCH 4/4] git update-index --cacheinfo can be used to select a stage when there are merged and unmerged entries Jaime Soriano Pastor
2014-08-20 21:08 ` Junio C Hamano
2014-08-21 13:57 ` Jaime Soriano Pastor
2014-08-20 22:19 ` [PATCH 0/4] Handling unmerged files with merged entries Junio C Hamano
2014-08-21 13:42 ` Jaime Soriano Pastor
2014-08-21 13:43 ` [PATCH] Check order when reading index Jaime Soriano Pastor
2014-08-21 13:49 ` Jaime Soriano Pastor
2014-08-21 13:59 ` Duy Nguyen
2014-08-21 18:51 ` Junio C Hamano
2014-08-24 17:57 ` [PATCH 1/2] " Jaime Soriano Pastor
2014-08-24 17:57 ` [PATCH 2/2] Loop index increases monotonically when reading unmerged entries Jaime Soriano Pastor
2014-08-24 18:04 ` Jaime Soriano Pastor
2014-08-25 17:09 ` Junio C Hamano
2014-08-25 17:21 ` [PATCH 1/2] Check order when reading index Junio C Hamano
2014-08-25 19:44 ` Jeff King
2014-08-25 20:52 ` Junio C Hamano
2014-08-26 12:08 ` Jaime Soriano Pastor
2014-08-26 12:20 ` Jeff King
2014-08-26 16:53 ` Junio C Hamano
2014-08-26 17:22 ` Jaime Soriano Pastor
2014-08-26 17:43 ` Junio C Hamano
2014-08-27 19:48 ` [PATCH 1/2] read_index_from(): catch out of order entries when reading an index file Jaime Soriano Pastor
2014-08-27 19:48 ` [PATCH 2/2] read_index_unmerged(): remove unnecessary loop index adjustment Jaime Soriano Pastor
2014-08-29 2:16 ` [PATCH 1/2] read_index_from(): catch out of order entries when reading an index file Eric Sunshine
2014-08-29 8:54 ` [PATCH] " Jaime Soriano Pastor
2014-08-29 17:06 ` Junio C Hamano
2014-08-27 19:52 ` [PATCH 1/2] Check order when reading index Jaime Soriano Pastor
2014-08-27 21:11 ` Junio C Hamano
2014-08-27 22:13 ` Jaime Soriano Pastor
2014-08-25 20:26 ` Jaime Soriano Pastor
2014-08-21 18:40 ` [PATCH 0/4] Handling unmerged files with merged entries Johannes Sixt
2014-08-21 22:18 ` Junio C Hamano
2014-08-12 18:31 ` [PATCH] read-cache.c: Ensure unmerged entries are removed Junio C Hamano
2014-08-13 22:10 ` Jaime Soriano Pastor
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=3c1dfe8a1cc03c083e93ce834aac574e4e321f6e.1408533065.git.jsorianopastor@gmail.com \
--to=jsorianopastor@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.
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).