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 <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder committed
Dec 10, 2011 at 07:06 UTC
d596118d7a9b104db10e64b2680a30ea80f1439c
3 files changed
+7
-21
builtin/revert.c
+3
-3
@@ -944,7 +944,7 @@ static int sequencer_rollback(struct replay_opts *opts)
944
}
945
if (reset_for_rollback(sha1))
946
goto fail;
947
- remove_sequencer_state(1);
947
+ remove_sequencer_state();
948
strbuf_release(&buf);
949
return 0;
950
fail:
@@ -1026,7 +1026,7 @@ static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts)
1026
* Sequence of picks finished successfully; cleanup by
1027
* removing the .git/sequencer directory
1028
*/
1029
- remove_sequencer_state(1);
1029
+ remove_sequencer_state();
1030
return 0;
1031
}
1032
@@ -1084,7 +1084,7 @@ static int pick_revisions(struct replay_opts *opts)
1084
* one that is being continued
1085
*/
1086
if (opts->subcommand == REPLAY_REMOVE_STATE) {
1087
- remove_sequencer_state(1);
1087
+ remove_sequencer_state();
1088
return 0;
1089
}
1090
if (opts->subcommand == REPLAY_ROLLBACK)
sequencer.c
+2
-8
@@ -3,17 +3,11 @@
3
#include "strbuf.h"
4
#include "dir.h"
5
6
-void remove_sequencer_state(int aggressive)
6
+void remove_sequencer_state(void)
7
{
8
struct strbuf seq_dir = STRBUF_INIT;
9
- struct strbuf seq_old_dir = STRBUF_INIT;
9
10
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);
12
strbuf_release(&seq_dir);
18
- strbuf_release(&seq_old_dir);
13
}
sequencer.h
+2
-10
@@ -2,19 +2,11 @@
2
#define SEQUENCER_H
3
4
#define SEQ_DIR "sequencer"
5
-#define SEQ_OLD_DIR "sequencer-old"
5
#define SEQ_HEAD_FILE "sequencer/head"
6
#define SEQ_TODO_FILE "sequencer/todo"
7
#define SEQ_OPTS_FILE "sequencer/opts"
8
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);
11
12
#endif