Skip to content

Commit c20de8b

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bfa50c2 commit c20de8b

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

sequencer.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -419,19 +419,7 @@ static int write_message(const void *buf, size_t len, const char *filename,
419419
return 0;
420420
}
421421

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,
435423
const char *path, unsigned flags)
436424
{
437425
int orig_len = buf->len;

sequencer.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,20 @@ void print_commit_summary(struct repository *repo,
198198
const struct object_id *oid,
199199
unsigned int flags);
200200

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);
201215
int read_author_script(const char *path, char **name, char **email, char **date,
202216
int allow_missing);
203217
void parse_strategy_opts(struct replay_opts *opts, char *raw_opts);

0 commit comments

Comments
 (0)