path: root/sha1_file.c
diff options
authorJunio C Hamano <>2011-05-15 19:54:52 (GMT)
committerJunio C Hamano <>2011-05-15 22:23:33 (GMT)
commit4bbf5a2615420ac50c696b72dc303727e6218562 (patch)
treed829a6b6fcac5228fb1964239b3d8a582d58a25f /sha1_file.c
parentabb25ac365791e16563dfd09e4ecd3e7e4dcf6b1 (diff)
read_sha1_file(): get rid of read_sha1_file_repl() madness
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 <>
Diffstat (limited to 'sha1_file.c')
1 files changed, 4 insertions, 8 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 889fe71..5d80feb 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2206,10 +2206,9 @@ static void *read_object(const unsigned char *sha1, enum object_type *type,
* 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;
@@ -2218,11 +2217,8 @@ void *read_sha1_file_repl(const unsigned char *sha1,
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));