diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index 080af1a01b8155680faf6c04101217b60ae7b919..33911fd5e9325210dae63b3252fa3b56d42b545c 100644 (file)
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
* Copyright (C) Linus Torvalds, 2005
* Copyright (C) Junio C Hamano, 2005
*/
-#include "cache.h"
+#include "builtin.h"
#include "blob.h"
#include "quote.h"
#include "parse-options.h"
{
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))
+ 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);