17
#include "pack-mtimes.h"
18
#include "config.h"
19
#include "run-command.h"
20
+#include "sequencer.h"
21
22
struct connectivity_progress {
23
struct progress *progress;
31
display_progress(cp->progress, cp->count);
32
}
33
34
+static void add_one_file(const char *path, struct rev_info *revs)
35
+{
36
+ struct strbuf buf = STRBUF_INIT;
37
+ struct object_id oid;
38
+ struct object *object;
39
+
40
+ if (!read_oneliner(&buf, path, READ_ONELINER_SKIP_IF_EMPTY)) {
41
+ strbuf_release(&buf);
42
+ return;
43
+ }
44
+ strbuf_trim(&buf);
45
+ if (!get_oid_hex(buf.buf, &oid)) {
46
+ object = parse_object_or_die(&oid, buf.buf);
47
+ add_pending_object(revs, object, "");
48
+ }
49
+ strbuf_release(&buf);
50
+}
51
+
52
+/* Mark objects recorded in rebase state files as reachable. */
53
+static void add_rebase_files(struct rev_info *revs)
54
+{
55
+ struct strbuf buf = STRBUF_INIT;
56
+ size_t len;
57
+ const char *path[] = {
58
+ "rebase-apply/autostash",
59
+ "rebase-apply/orig-head",
60
+ "rebase-merge/autostash",
61
+ "rebase-merge/orig-head",
62
+ };
63
+ struct worktree **worktrees = get_worktrees();
64
+
65
+ for (struct worktree **wt = worktrees; *wt; wt++) {
66
+ strbuf_reset(&buf);
67
+ strbuf_addstr(&buf, get_worktree_git_dir(*wt));
68
+ strbuf_complete(&buf, '/');
69
+ len = buf.len;
70
+ for (size_t i = 0; i < ARRAY_SIZE(path); i++) {
71
+ strbuf_setlen(&buf, len);
72
+ strbuf_addstr(&buf, path[i]);
73
+ add_one_file(buf.buf, revs);
74
+ }
75
+ }
76
+ strbuf_release(&buf);
77
+ free_worktrees(worktrees);
78
+}
79
+
80
static int add_one_ref(const char *path, const struct object_id *oid,
81
int flag, void *cb_data)
82
{
369
head_ref(add_one_ref, revs);
370
other_head_refs(add_one_ref, revs);
371
372
+ /* rebase autostash and orig-head */
373
+ add_rebase_files(revs);
374
+
375
/* Add all reflog info */
376
if (mark_reflog)
377
add_reflogs_to_pending(revs, 0);