@@ -37,6 +37,12 @@ static GIT_PATH_FUNC(git_path_rebase_dir, "rebase-merge")
3737 * file and written to the tail of 'done'.
3838 */
3939static GIT_PATH_FUNC (git_path_rebase_todo , "rebase-merge/git-rebase-todo" )
40+ /*
41+ * The rebase command lines that have already been processed. A line
42+ * is moved here when it is first handled, before any associated user
43+ * actions.
44+ */
45+ static GIT_PATH_FUNC (git_path_rebase_done , "rebase-merge/done" )
4046/*
4147 * The commit message that is planned to be used for any changes that
4248 * need to be committed following a user interaction.
@@ -1131,6 +1137,20 @@ static int save_todo(struct todo_list *todo_list, struct replay_opts *opts)
11311137 todo_path , strerror (errno ));
11321138 if (commit_lock_file (& todo_lock ) < 0 )
11331139 return error (_ ("Error wrapping up %s." ), todo_path );
1140+
1141+ if (IS_REBASE_I ()) {
1142+ const char * done_path = git_path_rebase_done ();
1143+ int fd = open (done_path , O_CREAT | O_WRONLY , 0666 );
1144+ int prev_offset = todo_list -> items [next - 1 ].offset_in_buf ;
1145+
1146+ lseek (fd , 0 , SEEK_END );
1147+ if (offset > prev_offset && write_in_full (fd ,
1148+ todo_list -> buf .buf + prev_offset ,
1149+ offset - prev_offset ) < 0 )
1150+ return error (_ ("Could not write to %s (%s)" ),
1151+ done_path , strerror (errno ));
1152+ close (fd );
1153+ }
11341154 return 0 ;
11351155}
11361156
0 commit comments