From: Dmitry Ivankov Date: Mon, 19 Sep 2011 01:27:34 GMT Subject: [PATCH 5/8] fast-import: tiny optimization in read_marks Message-ID: <1316395657-6991-6-git-send-email-divanorama@gmail.com> In-Reply-To: <1316395657-6991-1-git-send-email-divanorama@gmail.com> read_marks calls find_object and then insert_object if nothing is found. Reduce it to just insert_object and a check if it was found or inserted. Signed-off-by: Dmitry Ivankov --- fast-import.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fast-import.c b/fast-import.c index 3c2a067..dd3dcd5 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1852,11 +1852,9 @@ static void read_marks(void) if (!mark || end == line + 1 || *end != ' ' || get_sha1(end + 1, sha1)) die("corrupt mark line: %s", line); - e = find_object(sha1); - if (!e) { - e = insert_object(sha1); + e = insert_object(sha1); + if (!e->idx.offset) resolve_sha1_object(e); - } insert_mark(mark, e); } fclose(f); -- 1.7.3.4