Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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>
  • Loading branch information...
commit d596118d7a9b104db10e64b2680a30ea80f1439c 1 parent a7eff1e
jrn jrn authored gitster committed

Showing 3 changed files with 7 additions and 21 deletions. Show diff stats Hide diff stats

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

0 comments on commit d596118

Please sign in to comment.
Something went wrong with that request. Please try again.