diff options
Diffstat (limited to 'src/index.c')
| -rw-r--r-- | src/index.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/index.c b/src/index.c index 95e56b7d5..6a31dd5cb 100644 --- a/src/index.c +++ b/src/index.c @@ -74,7 +74,7 @@ struct entry_short { uint32_t file_size; git_oid oid; uint16_t flags; - char path[1]; /* arbritrary length */ + char path[1]; /* arbitrary length */ }; struct entry_long { @@ -89,7 +89,7 @@ struct entry_long { git_oid oid; uint16_t flags; uint16_t flags_extended; - char path[1]; /* arbritrary length */ + char path[1]; /* arbitrary length */ }; /* local declarations */ @@ -148,7 +148,7 @@ static int index_initialize(git_index **index_out, git_repository *owner, const index->on_disk = 1; *index_out = index; - return GIT_SUCCESS; + return git_index_read(index); } int git_index_open_bare(git_index **index_out, const char *index_path) @@ -312,8 +312,8 @@ int git_index_add(git_index *index, const char *rel_path, int stage) memset(&entry, 0x0, sizeof(git_index_entry)); - entry.ctime.seconds = st.st_ctime; - entry.mtime.seconds = st.st_mtime; + entry.ctime.seconds = (git_time_t)st.st_ctime; + entry.mtime.seconds = (git_time_t)st.st_mtime; /* entry.mtime.nanoseconds = st.st_mtimensec; */ /* entry.ctime.nanoseconds = st.st_ctimensec; */ entry.dev= st.st_rdev; @@ -324,7 +324,7 @@ int git_index_add(git_index *index, const char *rel_path, int stage) entry.file_size = st.st_size; /* write the blob to disk and get the oid */ - if ((error = git_blob_writefile(&entry.oid, index->repository, full_path)) < GIT_SUCCESS) + if ((error = git_blob_create_fromfile(&entry.oid, index->repository, rel_path)) < GIT_SUCCESS) return error; entry.flags |= (stage << GIT_IDXENTRY_STAGESHIFT); @@ -491,10 +491,10 @@ static size_t read_entry(git_index_entry *dest, const void *buffer, size_t buffe source = (const struct entry_short *)(buffer); - dest->ctime.seconds = (time_t)ntohl(source->ctime.seconds); - dest->ctime.nanoseconds = (time_t)ntohl(source->ctime.nanoseconds); - dest->mtime.seconds = (time_t)ntohl(source->mtime.seconds); - dest->mtime.nanoseconds = (time_t)ntohl(source->mtime.nanoseconds); + dest->ctime.seconds = (git_time_t)ntohl(source->ctime.seconds); + dest->ctime.nanoseconds = ntohl(source->ctime.nanoseconds); + dest->mtime.seconds = (git_time_t)ntohl(source->mtime.seconds); + dest->mtime.nanoseconds = ntohl(source->mtime.nanoseconds); dest->dev = ntohl(source->dev); dest->ino = ntohl(source->ino); dest->mode = ntohl(source->mode); |
