зеркало из https://github.com/microsoft/git.git
commit: prepare logmsg_reencode to handle arbitrary repositories
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
70315373ae
Коммит
424510ed19
8
commit.h
8
commit.h
|
@ -180,6 +180,14 @@ extern int has_non_ascii(const char *text);
|
||||||
extern const char *logmsg_reencode(const struct commit *commit,
|
extern const char *logmsg_reencode(const struct commit *commit,
|
||||||
char **commit_encoding,
|
char **commit_encoding,
|
||||||
const char *output_encoding);
|
const char *output_encoding);
|
||||||
|
const char *repo_logmsg_reencode(struct repository *r,
|
||||||
|
const struct commit *commit,
|
||||||
|
char **commit_encoding,
|
||||||
|
const char *output_encoding);
|
||||||
|
#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
|
||||||
|
#define logmsg_reencode(c, enc, out) repo_logmsg_reencode(the_repository, c, enc, out)
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const char *skip_blank_lines(const char *msg);
|
extern const char *skip_blank_lines(const char *msg);
|
||||||
|
|
||||||
/** Removes the first commit from a list sorted by date, and adds all
|
/** Removes the first commit from a list sorted by date, and adds all
|
||||||
|
|
|
@ -123,3 +123,12 @@ expression F;
|
||||||
- unuse_commit_buffer(
|
- unuse_commit_buffer(
|
||||||
+ repo_unuse_commit_buffer(the_repository,
|
+ repo_unuse_commit_buffer(the_repository,
|
||||||
E, F);
|
E, F);
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E;
|
||||||
|
expression F;
|
||||||
|
expression G;
|
||||||
|
@@
|
||||||
|
- logmsg_reencode(
|
||||||
|
+ repo_logmsg_reencode(the_repository,
|
||||||
|
E, F, G);
|
||||||
|
|
13
pretty.c
13
pretty.c
|
@ -595,14 +595,15 @@ static char *replace_encoding_header(char *buf, const char *encoding)
|
||||||
return strbuf_detach(&tmp, NULL);
|
return strbuf_detach(&tmp, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *logmsg_reencode(const struct commit *commit,
|
const char *repo_logmsg_reencode(struct repository *r,
|
||||||
char **commit_encoding,
|
const struct commit *commit,
|
||||||
const char *output_encoding)
|
char **commit_encoding,
|
||||||
|
const char *output_encoding)
|
||||||
{
|
{
|
||||||
static const char *utf8 = "UTF-8";
|
static const char *utf8 = "UTF-8";
|
||||||
const char *use_encoding;
|
const char *use_encoding;
|
||||||
char *encoding;
|
char *encoding;
|
||||||
const char *msg = get_commit_buffer(commit, NULL);
|
const char *msg = repo_get_commit_buffer(r, commit, NULL);
|
||||||
char *out;
|
char *out;
|
||||||
|
|
||||||
if (!output_encoding || !*output_encoding) {
|
if (!output_encoding || !*output_encoding) {
|
||||||
|
@ -630,7 +631,7 @@ const char *logmsg_reencode(const struct commit *commit,
|
||||||
* the cached copy from get_commit_buffer, we need to duplicate it
|
* the cached copy from get_commit_buffer, we need to duplicate it
|
||||||
* to avoid munging the cached copy.
|
* to avoid munging the cached copy.
|
||||||
*/
|
*/
|
||||||
if (msg == get_cached_commit_buffer(the_repository, commit, NULL))
|
if (msg == get_cached_commit_buffer(r, commit, NULL))
|
||||||
out = xstrdup(msg);
|
out = xstrdup(msg);
|
||||||
else
|
else
|
||||||
out = (char *)msg;
|
out = (char *)msg;
|
||||||
|
@ -644,7 +645,7 @@ const char *logmsg_reencode(const struct commit *commit,
|
||||||
*/
|
*/
|
||||||
out = reencode_string(msg, output_encoding, use_encoding);
|
out = reencode_string(msg, output_encoding, use_encoding);
|
||||||
if (out)
|
if (out)
|
||||||
unuse_commit_buffer(commit, msg);
|
repo_unuse_commit_buffer(r, commit, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче