am --skip: support skipping while on unborn branch
[gitweb.git] / reflog-walk.c
index 0dd5084fe5c80fe9504cfe4ec4bff3722b733eaf..222de762eb2b1893d63da838251cbad9c902880b 100644 (file)
@@ -41,14 +41,15 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1,
 static struct complete_reflogs *read_complete_reflog(const char *ref)
 {
        struct complete_reflogs *reflogs =
-               xcalloc(sizeof(struct complete_reflogs), 1);
+               xcalloc(1, sizeof(struct complete_reflogs));
        reflogs->ref = xstrdup(ref);
        for_each_reflog_ent(ref, read_one_reflog, reflogs);
        if (reflogs->nr == 0) {
                unsigned char sha1[20];
                const char *name;
                void *name_to_free;
-               name = name_to_free = resolve_refdup(ref, sha1, 1, NULL);
+               name = name_to_free = resolve_refdup(ref, RESOLVE_REF_READING,
+                                                    sha1, NULL);
                if (name) {
                        for_each_reflog_ent(name, read_one_reflog, reflogs);
                        free(name_to_free);
@@ -133,9 +134,9 @@ struct reflog_walk_info {
        struct commit_reflog *last_commit_reflog;
 };
 
-void init_reflog_walk(struct reflog_walk_info** info)
+void init_reflog_walk(struct reflog_walk_info **info)
 {
-       *info = xcalloc(sizeof(struct reflog_walk_info), 1);
+       *info = xcalloc(1, sizeof(struct reflog_walk_info));
 }
 
 int add_reflog_for_walk(struct reflog_walk_info *info,
@@ -174,7 +175,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
                if (*branch == '\0') {
                        unsigned char sha1[20];
                        free(branch);
-                       branch = resolve_refdup("HEAD", sha1, 0, NULL);
+                       branch = resolve_refdup("HEAD", 0, sha1, NULL);
                        if (!branch)
                                die ("No current branch");
 
@@ -199,7 +200,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
                        = reflogs;
        }
 
-       commit_reflog = xcalloc(sizeof(struct commit_reflog), 1);
+       commit_reflog = xcalloc(1, sizeof(struct commit_reflog));
        if (recno < 0) {
                commit_reflog->recno = get_reflog_recno_by_time(reflogs, timestamp);
                if (commit_reflog->recno < 0) {
@@ -242,7 +243,7 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
                return;
        }
 
-       commit->parents = xcalloc(sizeof(struct commit_list), 1);
+       commit->parents = xcalloc(1, sizeof(struct commit_list));
        commit->parents->item = commit_info->commit;
 }