Merge branch 'ma/t1400-undebug-test' into maint
[gitweb.git] / refs / ref-cache.c
index 4f850e1b5c9ed1fae746a804ceceee42e2f54b86..9b110c8494ff802fea730570f8c8f3b522292dbf 100644 (file)
@@ -23,7 +23,7 @@ struct ref_dir *get_ref_dir(struct ref_entry *entry)
        dir = &entry->u.subdir;
        if (entry->flag & REF_INCOMPLETE) {
                if (!dir->cache->fill_ref_dir)
-                       die("BUG: incomplete ref_store without fill_ref_dir function");
+                       BUG("incomplete ref_store without fill_ref_dir function");
 
                dir->cache->fill_ref_dir(dir->cache->ref_store, dir, entry->name);
                entry->flag &= ~REF_INCOMPLETE;
@@ -238,10 +238,8 @@ int remove_entry_from_dir(struct ref_dir *dir, const char *refname)
                return -1;
        entry = dir->entries[entry_index];
 
-       memmove(&dir->entries[entry_index],
-               &dir->entries[entry_index + 1],
-               (dir->nr - entry_index - 1) * sizeof(*dir->entries)
-               );
+       MOVE_ARRAY(&dir->entries[entry_index],
+                  &dir->entries[entry_index + 1], dir->nr - entry_index - 1);
        dir->nr--;
        if (dir->sorted > entry_index)
                dir->sorted--;
@@ -260,8 +258,8 @@ int add_ref_entry(struct ref_dir *dir, struct ref_entry *ref)
 
 /*
  * Emit a warning and return true iff ref1 and ref2 have the same name
- * and the same sha1.  Die if they have the same name but different
- * sha1s.
+ * and the same oid. Die if they have the same name but different
+ * oids.
  */
 static int is_dup_ref(const struct ref_entry *ref1, const struct ref_entry *ref2)
 {
@@ -493,7 +491,7 @@ static int cache_ref_iterator_advance(struct ref_iterator *ref_iterator)
 static int cache_ref_iterator_peel(struct ref_iterator *ref_iterator,
                                   struct object_id *peeled)
 {
-       return peel_object(ref_iterator->oid->hash, peeled->hash);
+       return peel_object(ref_iterator->oid, peeled);
 }
 
 static int cache_ref_iterator_abort(struct ref_iterator *ref_iterator)