From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
Joey Hess <joey@kitenet.net>
Subject: [PATCH 3/5] Add an "unsigned flags" parameter to sha1_object_info_extended()
Date: Sat, 30 Nov 2013 14:51:21 +0100 [thread overview]
Message-ID: <20131130135124.2697.9050.chriscool@tuxfamily.org> (raw)
In-Reply-To: <20131130133934.2697.75781.chriscool@tuxfamily.org>
This parameter is not used yet, but it will be used to tell
sha1_object_info_extended() if it should perform object
replacement or not.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
builtin/cat-file.c | 2 +-
cache.h | 2 +-
sha1_file.c | 6 +++---
streaming.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index b2ca775..a2d3a9b 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -238,7 +238,7 @@ static int batch_one_object(const char *obj_name, struct batch_options *opt,
return 0;
}
- if (sha1_object_info_extended(data->sha1, &data->info) < 0) {
+ if (sha1_object_info_extended(data->sha1, &data->info, READ_SHA1_FILE_REPLACE) < 0) {
printf("%s missing\n", obj_name);
fflush(stdout);
return 0;
diff --git a/cache.h b/cache.h
index b845485..3be03dc 100644
--- a/cache.h
+++ b/cache.h
@@ -1104,7 +1104,7 @@ struct object_info {
} packed;
} u;
};
-extern int sha1_object_info_extended(const unsigned char *, struct object_info *);
+extern int sha1_object_info_extended(const unsigned char *, struct object_info *, unsigned flags);
/* Dumb servers support */
extern int update_server_info(int);
diff --git a/sha1_file.c b/sha1_file.c
index b0a3964..09e56ef 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2514,7 +2514,7 @@ static int sha1_loose_object_info(const unsigned char *sha1,
return 0;
}
-int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
+int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi, unsigned flags)
{
struct cached_object *co;
struct pack_entry e;
@@ -2548,7 +2548,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
rtype = packed_object_info(e.p, e.offset, oi);
if (rtype < 0) {
mark_bad_packed_object(e.p, sha1);
- return sha1_object_info_extended(sha1, oi);
+ return sha1_object_info_extended(sha1, oi, 0);
} else if (in_delta_base_cache(e.p, e.offset)) {
oi->whence = OI_DBCACHED;
} else {
@@ -2570,7 +2570,7 @@ int sha1_object_info(const unsigned char *sha1, unsigned long *sizep)
oi.typep = &type;
oi.sizep = sizep;
- if (sha1_object_info_extended(sha1, &oi) < 0)
+ if (sha1_object_info_extended(sha1, &oi, READ_SHA1_FILE_REPLACE) < 0)
return -1;
return type;
}
diff --git a/streaming.c b/streaming.c
index debe904..9659f18 100644
--- a/streaming.c
+++ b/streaming.c
@@ -113,7 +113,7 @@ static enum input_source istream_source(const unsigned char *sha1,
oi->typep = type;
oi->sizep = &size;
- status = sha1_object_info_extended(sha1, oi);
+ status = sha1_object_info_extended(sha1, oi, 0);
if (status < 0)
return stream_error;
--
1.8.4.1.561.g12affca
next prev parent reply other threads:[~2013-11-30 13:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-30 13:51 [PATCH 0/5] teach replace objects to sha1_object_info_extended() Christian Couder
2013-11-30 13:51 ` [PATCH 1/5] replace_object: don't check read_replace_refs twice Christian Couder
2013-11-30 13:51 ` [PATCH 2/5] introduce lookup_replace_object_extended() to pass flags Christian Couder
2013-11-30 13:51 ` Christian Couder [this message]
2013-11-30 13:51 ` [PATCH 4/5] t6050: show that git cat-file --batch fails with replace objects Christian Couder
2013-11-30 13:51 ` [PATCH 5/5] sha1_file: perform object replacement in sha1_object_info_extended() Christian Couder
2013-12-02 14:52 ` [PATCH 0/5] teach replace objects to sha1_object_info_extended() Jeff King
2013-12-02 15:06 ` Jeff King
2013-12-02 23:41 ` Junio C Hamano
2013-12-03 20:42 ` Christian Couder
2013-12-03 20:46 ` Christian Couder
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=20131130135124.2697.9050.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=joey@kitenet.net \
--cc=peff@peff.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 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 NNTP newsgroup(s).