Merge branch 'maint'
[gitweb.git] / reflog-walk.c
index c983858259f717b3ed9d0f00921aec92219c1ad3..f751fdc8d832cae54647c1a70d888e979d324fd8 100644 (file)
@@ -3,7 +3,7 @@
 #include "refs.h"
 #include "diff.h"
 #include "revision.h"
-#include "path-list.h"
+#include "string-list.h"
 #include "reflog-walk.h"
 
 struct complete_reflogs {
@@ -127,7 +127,7 @@ struct commit_reflog {
 
 struct reflog_walk_info {
        struct commit_info_lifo reflogs;
-       struct path_list complete_reflogs;
+       struct string_list complete_reflogs;
        struct commit_reflog *last_commit_reflog;
 };
 
@@ -136,12 +136,12 @@ void init_reflog_walk(struct reflog_walk_info** info)
        *info = xcalloc(sizeof(struct reflog_walk_info), 1);
 }
 
-void add_reflog_for_walk(struct reflog_walk_info *info,
+int add_reflog_for_walk(struct reflog_walk_info *info,
                struct commit *commit, const char *name)
 {
        unsigned long timestamp = 0;
        int recno = -1;
-       struct path_list_item *item;
+       struct string_list_item *item;
        struct complete_reflogs *reflogs;
        char *branch, *at = strchr(name, '@');
        struct commit_reflog *commit_reflog;
@@ -161,7 +161,7 @@ void add_reflog_for_walk(struct reflog_walk_info *info,
        } else
                recno = 0;
 
-       item = path_list_lookup(branch, &info->complete_reflogs);
+       item = string_list_lookup(branch, &info->complete_reflogs);
        if (item)
                reflogs = item->util;
        else {
@@ -188,8 +188,8 @@ void add_reflog_for_walk(struct reflog_walk_info *info,
                        }
                }
                if (!reflogs || reflogs->nr == 0)
-                       die("No reflogs found for '%s'", branch);
-               path_list_insert(branch, &info->complete_reflogs)->util
+                       return -1;
+               string_list_insert(branch, &info->complete_reflogs)->util
                        = reflogs;
        }
 
@@ -200,13 +200,14 @@ void add_reflog_for_walk(struct reflog_walk_info *info,
                if (commit_reflog->recno < 0) {
                        free(branch);
                        free(commit_reflog);
-                       return;
+                       return -1;
                }
        } else
                commit_reflog->recno = reflogs->nr - recno - 1;
        commit_reflog->reflogs = reflogs;
 
        add_commit_info(commit, commit_reflog, &info->reflogs);
+       return 0;
 }
 
 void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)