*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;
branch = xstrdup(head);
}
reflogs = read_complete_reflog(branch);
+ if (!reflogs || reflogs->nr == 0) {
+ unsigned char sha1[20];
+ char *b;
+ if (dwim_log(branch, strlen(branch), sha1, &b) == 1) {
+ if (reflogs) {
+ free(reflogs->ref);
+ free(reflogs);
+ }
+ free(branch);
+ branch = b;
+ reflogs = read_complete_reflog(branch);
+ }
+ }
if (!reflogs || reflogs->nr == 0)
- die("No reflogs found for '%s'", branch);
+ return -1;
path_list_insert(branch, &info->complete_reflogs)->util
= reflogs;
}
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)