Skip to content

Commit d596118

Browse files
jrngitster
authored andcommitted
revert: stop creating and removing sequencer-old directory
Now that "git reset" no longer implicitly removes .git/sequencer that the operator may or may not have wanted to keep, the logic to write a backup copy of .git/sequencer and remove it when stale is not needed any more. Simplify the sequencer API and repository layout by dropping it. Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a7eff1e commit d596118

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed

builtin/revert.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ static int sequencer_rollback(struct replay_opts *opts)
944944
}
945945
if (reset_for_rollback(sha1))
946946
goto fail;
947-
remove_sequencer_state(1);
947+
remove_sequencer_state();
948948
strbuf_release(&buf);
949949
return 0;
950950
fail:
@@ -1026,7 +1026,7 @@ static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts)
10261026
* Sequence of picks finished successfully; cleanup by
10271027
* removing the .git/sequencer directory
10281028
*/
1029-
remove_sequencer_state(1);
1029+
remove_sequencer_state();
10301030
return 0;
10311031
}
10321032

@@ -1084,7 +1084,7 @@ static int pick_revisions(struct replay_opts *opts)
10841084
* one that is being continued
10851085
*/
10861086
if (opts->subcommand == REPLAY_REMOVE_STATE) {
1087-
remove_sequencer_state(1);
1087+
remove_sequencer_state();
10881088
return 0;
10891089
}
10901090
if (opts->subcommand == REPLAY_ROLLBACK)

sequencer.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,11 @@
33
#include "strbuf.h"
44
#include "dir.h"
55

6-
void remove_sequencer_state(int aggressive)
6+
void remove_sequencer_state(void)
77
{
88
struct strbuf seq_dir = STRBUF_INIT;
9-
struct strbuf seq_old_dir = STRBUF_INIT;
109

1110
strbuf_addf(&seq_dir, "%s", git_path(SEQ_DIR));
12-
strbuf_addf(&seq_old_dir, "%s", git_path(SEQ_OLD_DIR));
13-
remove_dir_recursively(&seq_old_dir, 0);
14-
rename(git_path(SEQ_DIR), git_path(SEQ_OLD_DIR));
15-
if (aggressive)
16-
remove_dir_recursively(&seq_old_dir, 0);
11+
remove_dir_recursively(&seq_dir, 0);
1712
strbuf_release(&seq_dir);
18-
strbuf_release(&seq_old_dir);
1913
}

sequencer.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,11 @@
22
#define SEQUENCER_H
33

44
#define SEQ_DIR "sequencer"
5-
#define SEQ_OLD_DIR "sequencer-old"
65
#define SEQ_HEAD_FILE "sequencer/head"
76
#define SEQ_TODO_FILE "sequencer/todo"
87
#define SEQ_OPTS_FILE "sequencer/opts"
98

10-
/*
11-
* Removes SEQ_OLD_DIR and renames SEQ_DIR to SEQ_OLD_DIR, ignoring
12-
* any errors. Intended to be used by 'git reset'.
13-
*
14-
* With the aggressive flag, it additionally removes SEQ_OLD_DIR,
15-
* ignoring any errors. Inteded to be used by the sequencer's
16-
* '--quit' subcommand.
17-
*/
18-
void remove_sequencer_state(int aggressive);
9+
/* Removes SEQ_DIR. */
10+
extern void remove_sequencer_state(void);
1911

2012
#endif

0 commit comments

Comments
 (0)