Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx> --- builtin/revert.c | 20 -------------------- commit.c | 19 +++++++++++++++++++ commit.h | 3 +++ 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/builtin/revert.c b/builtin/revert.c index 44149b5..9215e66 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -99,26 +99,6 @@ struct commit_message { const char *message; }; -/* Find beginning and length of commit subject. */ -static int find_commit_subject(const char *commit_buffer, const char **subject) -{ - const char *eol; - const char *p = commit_buffer; - - while (*p && (*p != '\n' || p[1] != '\n')) - p++; - if (*p) { - p += 2; - for (eol = p; *eol && *eol != '\n'; eol++) - ; /* do nothing */ - } else - eol = p; - - *subject = p; - - return eol - p; -} - static int get_message(const char *raw_message, struct commit_message *out) { const char *encoding; diff --git a/commit.c b/commit.c index e9b0750..0094ec1 100644 --- a/commit.c +++ b/commit.c @@ -315,6 +315,25 @@ int parse_commit(struct commit *item) return ret; } +int find_commit_subject(const char *commit_buffer, const char **subject) +{ + const char *eol; + const char *p = commit_buffer; + + while (*p && (*p != '\n' || p[1] != '\n')) + p++; + if (*p) { + p += 2; + for (eol = p; *eol && *eol != '\n'; eol++) + ; /* do nothing */ + } else + eol = p; + + *subject = p; + + return eol - p; +} + struct commit_list *commit_list_insert(struct commit *item, struct commit_list **list_p) { struct commit_list *new_list = xmalloc(sizeof(struct commit_list)); diff --git a/commit.h b/commit.h index eb2b8ac..9113bbe 100644 --- a/commit.h +++ b/commit.h @@ -41,6 +41,9 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size); int parse_commit(struct commit *item); +/* Find beginning and length of commit subject. */ +int find_commit_subject(const char *commit_buffer, const char **subject); + struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p); unsigned commit_list_count(const struct commit_list *l); struct commit_list * insert_by_date(struct commit *item, struct commit_list **list); -- 1.7.2.rc3.267.g400b3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html