8000 commit: support specifying encoding for message · libgit2/libgit2@5538181 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5538181

Browse files
committed
commit: support specifying encoding for message
1 parent 67a4d04 commit 5538181

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

include/git2/commit.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,23 @@ GIT_EXTERN(int) git_commit_create_v(
397397
typedef struct {
398398
unsigned int version;
399399

400+
/**
401+
* Flags for creating the commit.
402+
*
403+
* If `allow_empty_commit` is specified, a commit with no changes
404+
* from the prior commit (and "empty" commit) is allowed. Otherwise,
405+
* commit creation will be stopped.
406+
*/
400407
unsigned int allow_empty_commit : 1;
401408

409+
/** The commit author, or NULL for the default. */
402410
const git_signature *author;
411+
412+
/** The committer, or NULL for the default. */
403413
const git_signature *committer;
414+
415+
/** Encoding for the commit message; leave NULL for default. */
416+
const char *message_encoding;
404417
} git_commit_create_options;
405418

406419
#define GIT_COMMIT_CREATE_OPTIONS_VERSION 1

src/libgit2/commit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,8 @@ int git_commit_create_from_stage(
11471147
goto done;
11481148

11491149
error = git_commit_create(out, repo, "HEAD", author, committer,
1150-
NULL, message, tree, parents.count, parents.commits);
1150+
opts.message_encoding, message,
1151+
tree, parents.count, parents.commits);
11511152

11521153
done:
11531154
git_commitarray_dispose(&parents);

0 commit comments

Comments
 (0)
0