Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix interactive rebase detect. #6334

Merged
merged 2 commits into from
Jul 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/libgit2/rebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define ONTO_FILE "onto"
#define ONTO_NAME_FILE "onto_name"
#define QUIET_FILE "quiet"
#define INTERACTIVE_FILE "interactive"

#define MSGNUM_FILE "msgnum"
#define END_FILE "end"
Expand Down Expand Up @@ -92,6 +93,7 @@ static int rebase_state_type(
git_repository *repo)
{
git_str path = GIT_STR_INIT;
git_str interactive_path = GIT_STR_INIT;
git_rebase_t type = GIT_REBASE_NONE;

if (git_str_joinpath(&path, repo->gitdir, REBASE_APPLY_DIR) < 0)
Expand All @@ -107,7 +109,14 @@ static int rebase_state_type(
return -1;

if (git_fs_path_isdir(git_str_cstr(&path))) {
type = GIT_REBASE_MERGE;
if (git_str_joinpath(&interactive_path, path.ptr, INTERACTIVE_FILE) < 0)
return -1;

if (git_fs_path_isfile(interactive_path.ptr))
type = GIT_REBASE_INTERACTIVE;
else
type = GIT_REBASE_MERGE;

goto done;
}

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

git_str_dispose(&path);
git_str_dispose(&interactive_path);

return 0;
}
Expand Down