All of lore.kernel.org
 help / color / mirror / Atom feed
From: pclouds@gmail.com
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Shawn Pearce" <spearce@spearce.org>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 1/2] index_pack: indent find_unresolved_detals one level
Date: Thu,  8 Dec 2011 20:40:37 +0700	[thread overview]
Message-ID: <4ee0be67.05c1e70a.1956.ffff800b@mx.google.com> (raw)
In-Reply-To: <CAJo=hJvrk3Jzg3dQhQnfbmKAFovLuEtJAP4rakHPFeuZ0T5R7g@mail.gmail.com>

From: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>

The next patch puts most of the code in one level deeper. By indenting
separately, it'd be easier to see the actual changes.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/index-pack.c |   47 +++++++++++++++++++++++------------------------
 1 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 103e19c..9855ada 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -585,37 +585,36 @@ static void find_unresolved_deltas(struct base_data *base,
 		base_spec.offset = base->obj->idx.offset;
 		find_delta_children(&base_spec,
 				    &ofs_first, &ofs_last, OBJ_OFS_DELTA);
-	}
 
-	if (ref_last == -1 && ofs_last == -1) {
-		free(base->data);
-		return;
-	}
+		if (ref_last == -1 && ofs_last == -1) {
+			free(base->data);
+			return;
+		}
 
-	link_base_data(prev_base, base);
+		link_base_data(prev_base, base);
 
-	for (i = ref_first; i <= ref_last; i++) {
-		struct object_entry *child = objects + deltas[i].obj_no;
-		struct base_data result;
+		for (i = ref_first; i <= ref_last; i++) {
+			struct object_entry *child = objects + deltas[i].obj_no;
+			struct base_data result;
 
-		assert(child->real_type == OBJ_REF_DELTA);
-		resolve_delta(child, base, &result);
-		if (i == ref_last && ofs_last == -1)
-			free_base_data(base);
-		find_unresolved_deltas(&result, base);
-	}
+			assert(child->real_type == OBJ_REF_DELTA);
+			resolve_delta(child, base, &result);
+			if (i == ref_last && ofs_last == -1)
+				free_base_data(base);
+			find_unresolved_deltas(&result, base);
+		}
 
-	for (i = ofs_first; i <= ofs_last; i++) {
-		struct object_entry *child = objects + deltas[i].obj_no;
-		struct base_data result;
+		for (i = ofs_first; i <= ofs_last; i++) {
+			struct object_entry *child = objects + deltas[i].obj_no;
+			struct base_data result;
 
-		assert(child->real_type == OBJ_OFS_DELTA);
-		resolve_delta(child, base, &result);
-		if (i == ofs_last)
-			free_base_data(base);
-		find_unresolved_deltas(&result, base);
+			assert(child->real_type == OBJ_OFS_DELTA);
+			resolve_delta(child, base, &result);
+			if (i == ofs_last)
+				free_base_data(base);
+			find_unresolved_deltas(&result, base);
+		}
 	}
-
 	unlink_base_data(base);
 }
 
-- 
1.7.8.36.g69ee2

  parent reply	other threads:[~2011-12-08 13:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05  7:04 [PATCH] Set hard limit on delta chain depth Nguyễn Thái Ngọc Duy
2011-12-06 12:17 ` Erik Faye-Lund
2011-12-06 12:32   ` Nguyen Thai Ngoc Duy
2011-12-06 12:41     ` Erik Faye-Lund
2011-12-06 12:48       ` Nguyen Thai Ngoc Duy
2011-12-06 14:54   ` Michael Haggerty
2011-12-06 15:30     ` Nguyen Thai Ngoc Duy
2011-12-06 18:12       ` Shawn Pearce
2011-12-06 18:56         ` Jeff King
2011-12-06 15:06 ` Junio C Hamano
2011-12-06 15:45   ` Nguyen Thai Ngoc Duy
2011-12-10  0:02     ` Junio C Hamano
2011-12-07 17:50   ` [PATCH] index-pack: eliminate unlimited recursion in get_delta_base() Nguyễn Thái Ngọc Duy
2011-12-08  3:02     ` Shawn Pearce
2011-12-08 11:06       ` Nguyen Thai Ngoc Duy
2011-12-08 13:40       ` pclouds [this message]
2011-12-09 21:27         ` [PATCH 1/2] index_pack: indent find_unresolved_detals one level Junio C Hamano
     [not found]       ` <1323351638-4790-1-git-send-email-y>
2011-12-08 13:40         ` [PATCH 2/2] index-pack: a naive attempt to flatten find_unresolved_deltas pclouds
2011-12-08 16:42           ` Shawn Pearce

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

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

  git send-email \
    --in-reply-to=4ee0be67.05c1e70a.1956.ffff800b@mx.google.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=spearce@spearce.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.