Makefile: add a gitexecdir_relative variable
[gitweb.git] / cache-tree.c
index 6574eeb80dc972b8533363937e072dca0ea61930..c52e4303dfcbc6a17796f536e8602017b1d951f0 100644 (file)
@@ -84,9 +84,8 @@ static struct cache_tree_sub *find_subtree(struct cache_tree *it,
        down->namelen = pathlen;
 
        if (pos < it->subtree_nr)
-               memmove(it->down + pos + 1,
-                       it->down + pos,
-                       sizeof(down) * (it->subtree_nr - pos - 1));
+               MOVE_ARRAY(it->down + pos + 1, it->down + pos,
+                          it->subtree_nr - pos - 1);
        it->down[pos] = down;
        return down;
 }
@@ -406,9 +405,10 @@ static int update_one(struct cache_tree *it,
                        oidcpy(&it->oid, &oid);
                else
                        to_invalidate = 1;
-       } else if (dryrun)
+       } else if (dryrun) {
                hash_object_file(buffer.buf, buffer.len, tree_type, &it->oid);
-       else if (write_sha1_file(buffer.buf, buffer.len, tree_type, it->oid.hash)) {
+       } else if (write_object_file(buffer.buf, buffer.len, tree_type,
+                                    &it->oid)) {
                strbuf_release(&buffer);
                return -1;
        }
@@ -607,7 +607,7 @@ int write_index_as_tree(unsigned char *sha1, struct index_state *index_state, co
 
        hold_lock_file_for_update(&lock_file, index_path, LOCK_DIE_ON_ERROR);
 
-       entries = read_index_from(index_state, index_path);
+       entries = read_index_from(index_state, index_path, get_git_dir());
        if (entries < 0) {
                ret = WRITE_TREE_UNREADABLE_INDEX;
                goto out;