Skip to content

Commit 8fa5881

Browse files
committed
fix interactive rebase detect.
1 parent 3847522 commit 8fa5881

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/libgit2/rebase.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#define ONTO_FILE "onto"
3636
#define ONTO_NAME_FILE "onto_name"
3737
#define QUIET_FILE "quiet"
38+
#define INTERACTIVE_FILE "interactive"
3839

3940
#define MSGNUM_FILE "msgnum"
4041
#define END_FILE "end"
@@ -92,6 +93,7 @@ static int rebase_state_type(
9293
git_repository *repo)
9394
{
9495
git_str path = GIT_STR_INIT;
96+
git_str interactive_path = GIT_STR_INIT;
9597
git_rebase_t type = GIT_REBASE_NONE;
9698

9799
if (git_str_joinpath(&path, repo->gitdir, REBASE_APPLY_DIR) < 0)
@@ -107,7 +109,13 @@ static int rebase_state_type(
107109
return -1;
108110

109111
if (git_fs_path_isdir(git_str_cstr(&path))) {
110-
type = GIT_REBASE_MERGE;
112+
if (git_str_joinpath(&interactive_path, path.ptr, INTERACTIVE_FILE) < 0)
113+
return -1;
114+
if (git_fs_path_isfile(interactive_path.ptr)) {
115+
type = GIT_REBASE_INTERACTIVE;
116+
} else {
117+
type = GIT_REBASE_MERGE;
118+
}
111119
goto done;
112120
}
113121

@@ -118,6 +126,7 @@ static int rebase_state_type(
118126
*path_out = git_str_detach(&path);
119127

120128
git_str_dispose(&path);
129+
git_str_dispose(&interactive_path);
121130

122131
return 0;
123132
}

0 commit comments

Comments
 (0)