summaryrefslogtreecommitdiff
path: root/src/ident.c
diff options
context:
space:
mode:
authorColomban Wendling <ban@herbesfolles.org>2015-05-26 19:16:27 +0200
committerColomban Wendling <ban@herbesfolles.org>2015-05-26 19:56:06 +0200
commit1ecbcd8e51032529435a9e714802f2502293b050 (patch)
tree2439954e67e7fac7867c062b822e53f350a30173 /src/ident.c
parentc11daac9de2fb582873e2471346526f33835226e (diff)
downloadlibgit2-1ecbcd8e51032529435a9e714802f2502293b050.tar.gz
Fix ident replacement to match Git behavior
Git inserts a space after the SHA1 (as of 2.1.4 at least), so do the same.
Diffstat (limited to 'src/ident.c')
-rw-r--r--src/ident.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ident.c b/src/ident.c
index 6bc80abc7..4718ed664 100644
--- a/src/ident.c
+++ b/src/ident.c
@@ -56,7 +56,7 @@ static int ident_insert_id(
return GIT_PASSTHROUGH;
need_size = (size_t)(id_start - from->ptr) +
- 5 /* "$Id: " */ + GIT_OID_HEXSZ + 1 /* "$" */ +
+ 5 /* "$Id: " */ + GIT_OID_HEXSZ + 2 /* " $" */ +
(size_t)(from_end - id_end);
if (git_buf_grow(to, need_size) < 0)
@@ -65,7 +65,7 @@ static int ident_insert_id(
git_buf_set(to, from->ptr, (size_t)(id_start - from->ptr));
git_buf_put(to, "$Id: ", 5);
git_buf_put(to, oid, GIT_OID_HEXSZ);
- git_buf_putc(to, '$');
+ git_buf_put(to, " $", 2);
git_buf_put(to, id_end, (size_t)(from_end - id_end));
return git_buf_oom(to) ? -1 : 0;