From: Dana How <danahow@gmail.com>
To: Junio C Hamano <junkio@cox.net>
Cc: Git Mailing List <git@vger.kernel.org>, danahow@gmail.com
Subject: [PATCH 6/8] git-repack --max-pack-size: write_one() implements limits
Date: Sun, 08 Apr 2007 16:25:17 -0700 [thread overview]
Message-ID: <461979DD.6030408@gmail.com> (raw)
If --max-pack-size (offset_limit) is specified,
generate the appropriate write limit for each object and
pass it to write_object(). Detect and return
write "failure".
Signed-off-by: Dana How <how@deathvalley.cswitch.com>
---
builtin-pack-objects.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 9530008..a088f2e 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -556,16 +556,24 @@ static off_t write_one(struct sha1file *f,
struct object_entry *e,
off_t offset)
{
+ off_t result;
if (e->offset || e->preferred_base)
/* offset starts from header size and cannot be zero
* if it is written already.
*/
return offset;
/* if we are deltified, write out its base object first. */
- if (e->delta)
+ if (e->delta) {
offset = write_one(f, e->delta, offset);
+ if (!offset)
+ return offset;
+ }
+ /* pass in write limit if limited packsize and not first object */
+ result = write_object(f, e, offset_limit && nr_written ? offset_limit - offset : 0);
+ if (!result)
+ return result;
e->offset = offset;
- return offset + write_object(f, e, 0);
+ return offset + result;
}
/*
--
1.5.1.89.g8abf0
next reply other threads:[~2007-04-08 23:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-08 23:25 Dana How [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-04-30 23:23 [PATCH 6/8] git-repack --max-pack-size: write_one() implements limits Dana How
2007-05-01 5:25 ` Shawn O. Pearce
2007-05-01 6:00 ` Dana How
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=461979DD.6030408@gmail.com \
--to=danahow@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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.