git-merge: honor pre-merge-commit hook
[gitweb.git] / builtin / describe.c
index cc118448ee00d2c4336422afbad1799babfb5783..200154297d5ea8baddda52e39cd4de302595bfcc 100644 (file)
@@ -1,3 +1,4 @@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
 #include "cache.h"
 #include "config.h"
 #include "lockfile.h"
@@ -75,7 +76,7 @@ static int commit_name_neq(const void *unused_cmp_data,
 
 static inline struct commit_name *find_commit_name(const struct object_id *peeled)
 {
-       return hashmap_get_from_hash(&names, sha1hash(peeled->hash), peeled->hash);
+       return hashmap_get_from_hash(&names, oidhash(peeled), peeled);
 }
 
 static int replace_name(struct commit_name *e,
@@ -122,7 +123,7 @@ static void add_to_known_names(const char *path,
                if (!e) {
                        e = xmalloc(sizeof(struct commit_name));
                        oidcpy(&e->peeled, peeled);
-                       hashmap_entry_init(e, sha1hash(peeled->hash));
+                       hashmap_entry_init(e, oidhash(peeled));
                        hashmap_add(&names, e);
                        e->path = NULL;
                }
@@ -629,12 +630,13 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
                        struct argv_array args = ARGV_ARRAY_INIT;
                        int fd, result;
 
+                       setup_work_tree();
                        read_cache();
                        refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED,
                                      NULL, NULL, NULL);
                        fd = hold_locked_index(&index_lock, 0);
                        if (0 <= fd)
-                               update_index_if_able(&the_index, &index_lock);
+                               repo_update_index_if_able(the_repository, &index_lock);
 
                        repo_init_revisions(the_repository, &revs, prefix);
                        argv_array_pushv(&args, diff_index_args);