Re: [PATCH v2 04/25] sequencer: future-proof remove_sequencer_state()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 12, 2016, 19:53 UTC
- Message-ID
- <xmqqinu028tx.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <d6b92cd7aa56ceb515c50467a0e6030401e2e1bc.1473590966.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> +static const char *get_dir(const struct replay_opts *opts)
> +{
> + return git_path_seq_dir();
> +}Presumably this is what "In a couple of commits" meant, i.e. opts will be used soonish.
Show 13 quoted lines
> -static void remove_sequencer_state(void)
> +static void remove_sequencer_state(const struct replay_opts *opts)
> {
> - struct strbuf seq_dir = STRBUF_INIT;
> + struct strbuf dir = STRBUF_INIT;
>
> - strbuf_addstr(&seq_dir, git_path_seq_dir());
> - remove_dir_recursively(&seq_dir, 0);
> - strbuf_release(&seq_dir);
> + strbuf_addf(&dir, "%s", get_dir(opts));
> + remove_dir_recursively(&dir, 0);
> + strbuf_release(&dir);
> }As long as "who called the sequencer" is the only thing that determines where the state is kept, this should work fine, I would think. I wondered that it would introduce a chicken-and-egg problem if we had to support "git sequencer --clear-state" command ;-) but that is not the case.
Good.