diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-05-19 20:37:21 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-05-19 20:37:21 -0700 |
commit | 61d7503da141f13bc916b36012760791761cc909 (patch) | |
tree | 2b1cff95e16f2ed1543e4790d682e2e4996e92b7 /sha1_file.c | |
parent | 2d220862d43b4d54f3173f67956fc5221690fb7e (diff) | |
parent | 5bf29b950063c8fa2f3666cb6cf2ca20be61f3d1 (diff) | |
download | git-61d7503da141f13bc916b36012760791761cc909.tar.gz |
Merge branch 'jc/replacing'
* jc/replacing:
read_sha1_file(): allow selective bypassing of replacement mechanism
inline lookup_replace_object() calls
read_sha1_file(): get rid of read_sha1_file_repl() madness
t6050: make sure we test not just commit replacement
Declare lookup_replace_object() in cache.h, not in commit.h
Conflicts:
environment.c
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sha1_file.c b/sha1_file.c index 1a7e41070e..357f9ab7ff 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2205,23 +2205,21 @@ 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_extended(const unsigned char *sha1, + enum object_type *type, + unsigned long *size, + unsigned flag) { - const unsigned char *repl = lookup_replace_object(sha1); void *data; char *path; const struct packed_git *p; + const unsigned char *repl = (flag & READ_SHA1_FILE_REPLACE) + ? lookup_replace_object(sha1) : 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)); |