@matheusbsbs / matheus-bagliano / commits / c20de8bec6
Fork 0

sequencer: make read_oneliner() extern

The function read_oneliner() is a generally useful util function. Instead of hiding it as a static function within sequencer.c, extern it so that it can be reused by others. This patch is best viewed with --color-moved. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Denton Liu committed Apr 7, 2020 at 10:27 UTC c20de8bec6ba759c5e17ad8b8fd7105e8228e313
2 files changed +15 -13
sequencer.c
+1 -13
@@ -419,19 +419,7 @@ static int write_message(const void *buf, size_t len, const char *filename,
419 return 0;
420 }
421
422 -#define READ_ONELINER_SKIP_IF_EMPTY (1 << 0)
423 -#define READ_ONELINER_WARN_MISSING (1 << 1)
424 -
425 -/*
426 - * Reads a file that was presumably written by a shell script, i.e. with an
427 - * end-of-line marker that needs to be stripped.
428 - *
429 - * Note that only the last end-of-line marker is stripped, consistent with the
430 - * behavior of "$(cat path)" in a shell script.
431 - *
432 - * Returns 1 if the file was read, 0 if it could not be read or does not exist.
433 - */
434 -static int read_oneliner(struct strbuf *buf,
422 +int read_oneliner(struct strbuf *buf,
423 const char *path, unsigned flags)
424 {
425 int orig_len = buf->len;
sequencer.h
+14
@@ -198,6 +198,20 @@ void print_commit_summary(struct repository *repo,
198 const struct object_id *oid,
199 unsigned int flags);
200
201 +#define READ_ONELINER_SKIP_IF_EMPTY (1 << 0)
202 +#define READ_ONELINER_WARN_MISSING (1 << 1)
203 +
204 +/*
205 + * Reads a file that was presumably written by a shell script, i.e. with an
206 + * end-of-line marker that needs to be stripped.
207 + *
208 + * Note that only the last end-of-line marker is stripped, consistent with the
209 + * behavior of "$(cat path)" in a shell script.
210 + *
211 + * Returns 1 if the file was read, 0 if it could not be read or does not exist.
212 + */
213 +int read_oneliner(struct strbuf *buf,
214 + const char *path, unsigned flags);
215 int read_author_script(const char *path, char **name, char **email, char **date,
216 int allow_missing);
217 void parse_strategy_opts(struct replay_opts *opts, char *raw_opts);