summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTengfei <tengfei@tengfei.fun>2022-06-28 04:48:57 +0800
committerTengfei <tengfei@tengfei.fun>2022-06-28 04:48:57 +0800
commit8fa58818859e8afaa2143fa222e6aedccaf86df9 (patch)
tree3787ee3e583efa47e35dc47f2e0c72ce23d1c349
parent3847522e86e9c65be674f1372cefefdbfbe9ba2b (diff)
downloadlibgit2-8fa58818859e8afaa2143fa222e6aedccaf86df9.tar.gz
fix interactive rebase detect.
-rw-r--r--src/libgit2/rebase.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libgit2/rebase.c b/src/libgit2/rebase.c
index 6f01d3990..c3acfd52c 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,13 @@ 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 +126,7 @@ done:
*path_out = git_str_detach(&path);
git_str_dispose(&path);
+ git_str_dispose(&interactive_path);
return 0;
}