diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2022-07-07 00:28:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 00:28:56 -0400 |
commit | 50a1f6374fd487ae6c9359c8807826efe7782372 (patch) | |
tree | c80a495986bb8587b566a0d3a119a96a7bea868b | |
parent | b34b831c97ccc99643752becf761378728e38ea0 (diff) | |
parent | cdcf5b9ca2396f7741bede6f0eda78c5aaa54ae7 (diff) | |
download | libgit2-50a1f6374fd487ae6c9359c8807826efe7782372.tar.gz |
Merge pull request #6334 from i-tengfei/fix-rebase-interactive
fix interactive rebase detect.
-rw-r--r-- | src/libgit2/rebase.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libgit2/rebase.c b/src/libgit2/rebase.c index 6f01d3990..5e48f0dfb 100644 --- a/src/libgit2/rebase.c +++ b/src/libgit2/rebase.c @@ -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" @@ -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) @@ -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; } @@ -118,6 +127,7 @@ done: *path_out = git_str_detach(&path); git_str_dispose(&path); + git_str_dispose(&interactive_path); return 0; } |