revert: Introduce --reset to remove sequencer state
[git/git.git] / sequencer.c
... / ...
CommitLineData
1#include "cache.h"
2#include "sequencer.h"
3#include "strbuf.h"
4#include "dir.h"
5
6void remove_sequencer_state(int aggressive)
7{
8 struct strbuf seq_dir = STRBUF_INIT;
9 struct strbuf seq_old_dir = STRBUF_INIT;
10
11 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);
17 strbuf_release(&seq_dir);
18 strbuf_release(&seq_old_dir);
19}