diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-05-08 01:47:33 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-05-09 11:58:19 -0700 |
commit | c4ce46fc7ac1b59372aa935e641ca15b12359f5b (patch) | |
tree | 000be1d69bef6c7129bdc97568d441e6b8e6615a /builtin/hash-object.c | |
parent | 9cedd16c62e12521f35b44e10bba80bfe261e69c (diff) | |
download | git-c4ce46fc7ac1b59372aa935e641ca15b12359f5b.tar.gz |
index_fd(): turn write_object and format_check arguments into one flag
The "format_check" parameter tucked after the existing parameters is too
ugly an afterthought to live in any reasonable API.
Combine it with the other boolean parameter "write_object" into a single
"flags" parameter.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/hash-object.c')
-rw-r--r-- | builtin/hash-object.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/hash-object.c b/builtin/hash-object.c index b96f46acf5..33911fd5e9 100644 --- a/builtin/hash-object.c +++ b/builtin/hash-object.c @@ -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); |