Merge branches 'jc/convert', 'jc/bigfile' and 'jc/replacing' into jc/streaming
* jc/convert: convert: make it harder to screw up adding a conversion attribute convert: make it safer to add conversion attributes convert: give saner names to crlf/eol variables, types and functions convert: rename the "eol" global variable to "core_eol" * jc/bigfile: Bigfile: teach "git add" to send a large file straight to a pack index_fd(): split into two helper functions index_fd(): turn write_object and format_check arguments into one flag * 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
This commit is contained in:
@ -14,8 +14,11 @@ static void hash_fd(int fd, const char *type, int write_object, const char *path
|
||||
{
|
||||
struct stat st;
|
||||
unsigned char sha1[20];
|
||||
unsigned flags = (HASH_FORMAT_CHECK |
|
||||
(write_object ? HASH_WRITE_OBJECT : 0));
|
||||
|
||||
if (fstat(fd, &st) < 0 ||
|
||||
index_fd(sha1, fd, &st, write_object, type_from_string(type), path, 1))
|
||||
index_fd(sha1, fd, &st, type_from_string(type), path, flags))
|
||||
die(write_object
|
||||
? "Unable to add %s to database"
|
||||
: "Unable to hash %s", path);
|
||||
|
@ -23,8 +23,8 @@ static int verify_object(const unsigned char *sha1, const char *expected_type)
|
||||
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))
|
||||
|
@ -99,7 +99,8 @@ static int add_one_path(struct cache_entry *old, const char *path, int len, stru
|
||||
fill_stat_cache_info(ce, st);
|
||||
ce->ce_mode = ce_mode_from_stat(old, st->st_mode);
|
||||
|
||||
if (index_path(ce->sha1, path, st, !info_only))
|
||||
if (index_path(ce->sha1, path, st,
|
||||
info_only ? 0 : HASH_WRITE_OBJECT))
|
||||
return -1;
|
||||
option = allow_add ? ADD_CACHE_OK_TO_ADD : 0;
|
||||
option |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0;
|
||||
|
Reference in New Issue
Block a user