summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: edaec3f)
raw | patch | inline | side by side (parent: edaec3f)
author | Junio C Hamano <junkio@cox.net> | |
Wed, 28 Feb 2007 19:52:04 +0000 (11:52 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 28 Feb 2007 20:00:00 +0000 (12:00 -0800) |
Signed-off-by: Junio C Hamano <junkio@cox.net>
cache.h | patch | blob | history | |
hash-object.c | patch | blob | history | |
read-cache.c | patch | blob | history | |
sha1_file.c | patch | blob | history |
index 9f30ad672b746b31d2d3719cf6c354df403621bd..b84e3decfcd38a349243dc8e3a88e1b5151ced6c 100644 (file)
--- a/cache.h
+++ b/cache.h
extern int ce_match_stat(struct cache_entry *ce, struct stat *st, int);
extern int ce_modified(struct cache_entry *ce, struct stat *st, int);
extern int ce_path_match(const struct cache_entry *ce, const char **pathspec);
-extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type);
+extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path);
extern int read_pipe(int fd, char** return_buf, unsigned long* return_size);
extern int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object);
extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object);
diff --git a/hash-object.c b/hash-object.c
index 1e6f6bf7061d57bcfa194b3b7b3e45f6a3f7b54c..18f5017f51bcac5798e959991be37c7cd6d70528 100644 (file)
--- a/hash-object.c
+++ b/hash-object.c
fd = open(path, O_RDONLY);
if (fd < 0 ||
fstat(fd, &st) < 0 ||
- index_fd(sha1, fd, &st, write_object, type))
+ index_fd(sha1, fd, &st, write_object, type, path))
die(write_object
? "Unable to add %s to database"
: "Unable to hash %s", path);
diff --git a/read-cache.c b/read-cache.c
index 6bfd4116508d0c885ab6c60931cd01cec58afbaf..7a104e351263ee47dc51bcca2ce2761fbd7f5092 100644 (file)
--- a/read-cache.c
+++ b/read-cache.c
if (fd >= 0) {
unsigned char sha1[20];
- if (!index_fd(sha1, fd, st, 0, OBJ_BLOB))
+ if (!index_fd(sha1, fd, st, 0, OBJ_BLOB, ce->name))
match = hashcmp(sha1, ce->sha1);
/* index_fd() closed the file descriptor already */
}
diff --git a/sha1_file.c b/sha1_file.c
index 38ccf1b80911facf8e28968306d4cafcc4464229..fe73904cbed4b10af46a4f85b58b1943d5d69295 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2054,7 +2054,7 @@ int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object)
}
int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
- enum object_type type)
+ enum object_type type, const char *path)
{
unsigned long size = st->st_size;
void *buf;
if (type == OBJ_BLOB) {
unsigned long nsize = size;
char *nbuf = buf;
- if (convert_to_git(NULL, &nbuf, &nsize)) {
+ if (convert_to_git(path, &nbuf, &nsize)) {
if (size)
munmap(buf, size);
size = nsize;
@@ -2107,7 +2107,7 @@ int index_path(unsigned char *sha1, const char *path, struct stat *st, int write
if (fd < 0)
return error("open(\"%s\"): %s", path,
strerror(errno));
- if (index_fd(sha1, fd, st, write_object, OBJ_BLOB) < 0)
+ if (index_fd(sha1, fd, st, write_object, OBJ_BLOB, path) < 0)
return error("%s: failed to insert into database",
path);
break;