Skip to content

Commit 50a1f63

Browse files
authored
Merge pull request #6334 from i-tengfei/fix-rebase-interactive
fix interactive rebase detect.
2 parents b34b831 + cdcf5b9 commit 50a1f63

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/libgit2/rebase.c

Lines changed: 11 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,14 @@ 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+
115+
if (git_fs_path_isfile(interactive_path.ptr))
116+
type = GIT_REBASE_INTERACTIVE;
117+
else
118+
type = GIT_REBASE_MERGE;
119+
111120
goto done;
112121
}
113122

@@ -118,6 +127,7 @@ static int rebase_state_type(
118127
*path_out = git_str_detach(&path);
119128

120129
git_str_dispose(&path);
130+
git_str_dispose(&interactive_path);
121131

122132
return 0;
123133
}

0 commit comments

Comments
 (0)