summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: abb25ac)
raw | patch | inline | side by side (parent: abb25ac)
author | Junio C Hamano <gitster@pobox.com> | |
Sun, 15 May 2011 19:54:52 +0000 (12:54 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 15 May 2011 22:23:33 +0000 (15:23 -0700) |
Most callers want to silently get a replacement object, and they do not
care what the real name of the replacement object is. Worse yet, no sane
interface to return the underlying object without replacement is provided.
Remove the function and make only the few callers that want the name of
the replacement object find it themselves.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
care what the real name of the replacement object is. Worse yet, no sane
interface to return the underlying object without replacement is provided.
Remove the function and make only the few callers that want the name of
the replacement object find it themselves.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/mktag.c | patch | blob | history | |
cache.h | patch | blob | history | |
object.c | patch | blob | history | |
sha1_file.c | patch | blob | history |
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 324a267163d758b5dea51405265ae89042a657ad..640ab64f418208842ae3901ce37ac8918740037e 100644 (file)
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
int ret = -1;
enum object_type type;
unsigned long size;
- const unsigned char *repl;
- void *buffer = read_sha1_file_repl(sha1, &type, &size, &repl);
+ void *buffer = read_sha1_file(sha1, &type, &size);
+ const unsigned char *repl = lookup_replace_object(sha1);
if (buffer) {
if (type == type_from_string(expected_type))
index e09cf7501363c337bf9719c41485f12a0ef564a3..a9ae100542e9c9de67605ed3b75cad1350da298f 100644 (file)
--- a/cache.h
+++ b/cache.h
/* Read and unpack a sha1 file into memory, write memory to a sha1 file */
extern int sha1_object_info(const unsigned char *, unsigned long *);
-extern void *read_sha1_file_repl(const unsigned char *sha1, enum object_type *type, unsigned long *size, const unsigned char **replacement);
-static inline void *read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size)
-{
- return read_sha1_file_repl(sha1, type, size, NULL);
-}
+extern void *read_sha1_file(const unsigned char *sha1, enum object_type *type, unsigned long *size);
extern const unsigned char *lookup_replace_object(const unsigned char *sha1);
extern int hash_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *sha1);
extern int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *return_sha1);
diff --git a/object.c b/object.c
index 7e1f2bbed2ad7f331fefc78d759acb14050bea48..31976b5d70b6310552b04ce79c7ea0b07bc536d7 100644 (file)
--- a/object.c
+++ b/object.c
unsigned long size;
enum object_type type;
int eaten;
- const unsigned char *repl;
- void *buffer = read_sha1_file_repl(sha1, &type, &size, &repl);
+ const unsigned char *repl = lookup_replace_object(sha1);
+ void *buffer = read_sha1_file(sha1, &type, &size);
if (buffer) {
struct object *obj;
diff --git a/sha1_file.c b/sha1_file.c
index 889fe7183065ae8bc12821aadebb69a17bc7635c..5d80febde24ebf4e8cf72923a3fb684942a82e75 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
* deal with them should arrange to call read_object() and give error
* messages themselves.
*/
-void *read_sha1_file_repl(const unsigned char *sha1,
- enum object_type *type,
- unsigned long *size,
- const unsigned char **replacement)
+void *read_sha1_file(const unsigned char *sha1,
+ enum object_type *type,
+ unsigned long *size)
{
const unsigned char *repl = lookup_replace_object(sha1);
void *data;
errno = 0;
data = read_object(repl, type, size);
- if (data) {
- if (replacement)
- *replacement = repl;
+ if (data)
return data;
- }
if (errno && errno != ENOENT)
die_errno("failed to read object %s", sha1_to_hex(sha1));