sequencer: use memoized sequencer directory path

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Oct 14, 2016 at 15:17 UTC 8a2a0f534141cf6d2fa63fe3f84acbc4763c6754
3 files changed +8 -10
builtin/commit.c
+1 -1
@@ -183,7 +183,7 @@ static void determine_whence(struct wt_status *s)
183 whence = FROM_MERGE;
184 else if (file_exists(git_path_cherry_pick_head())) {
185 whence = FROM_CHERRY_PICK;
186 - if (file_exists(git_path(SEQ_DIR)))
186 + if (file_exists(git_path_seq_dir()))
187 sequencer_in_use = 1;
188 }
189 else
sequencer.c
+6 -5
@@ -21,10 +21,11 @@
21 const char sign_off_header[] = "Signed-off-by: ";
22 static const char cherry_picked_prefix[] = "(cherry picked from commit ";
23
24 -static GIT_PATH_FUNC(git_path_todo_file, SEQ_TODO_FILE)
25 -static GIT_PATH_FUNC(git_path_opts_file, SEQ_OPTS_FILE)
26 -static GIT_PATH_FUNC(git_path_seq_dir, SEQ_DIR)
27 -static GIT_PATH_FUNC(git_path_head_file, SEQ_HEAD_FILE)
24 +GIT_PATH_FUNC(git_path_seq_dir, "sequencer")
25 +
26 +static GIT_PATH_FUNC(git_path_todo_file, "sequencer/todo")
27 +static GIT_PATH_FUNC(git_path_opts_file, "sequencer/opts")
28 +static GIT_PATH_FUNC(git_path_head_file, "sequencer/head")
29
30 static int is_rfc2822_line(const char *buf, int len)
31 {
@@ -112,7 +113,7 @@ static void remove_sequencer_state(void)
113 {
114 struct strbuf seq_dir = STRBUF_INIT;
115
115 - strbuf_addstr(&seq_dir, git_path(SEQ_DIR));
116 + strbuf_addstr(&seq_dir, git_path_seq_dir());
117 remove_dir_recursively(&seq_dir, 0);
118 strbuf_release(&seq_dir);
119 }
sequencer.h
+1 -4
@@ -1,10 +1,7 @@
1 #ifndef SEQUENCER_H
2 #define SEQUENCER_H
3
4 -#define SEQ_DIR "sequencer"
5 -#define SEQ_HEAD_FILE "sequencer/head"
6 -#define SEQ_TODO_FILE "sequencer/todo"
7 -#define SEQ_OPTS_FILE "sequencer/opts"
4 +const char *git_path_seq_dir(void);
5
6 #define APPEND_SIGNOFF_DEDUP (1u << 0)
7