mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-22 15:18:07 +00:00
Merge pull request #3160 from b4n/ident-same-as-git
Fix ident replacement to match Git behavior
This commit is contained in:
commit
c7f9412356
@ -56,7 +56,7 @@ static int ident_insert_id(
|
|||||||
return GIT_PASSTHROUGH;
|
return GIT_PASSTHROUGH;
|
||||||
|
|
||||||
need_size = (size_t)(id_start - from->ptr) +
|
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);
|
(size_t)(from_end - id_end);
|
||||||
|
|
||||||
if (git_buf_grow(to, need_size) < 0)
|
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_set(to, from->ptr, (size_t)(id_start - from->ptr));
|
||||||
git_buf_put(to, "$Id: ", 5);
|
git_buf_put(to, "$Id: ", 5);
|
||||||
git_buf_put(to, oid, GIT_OID_HEXSZ);
|
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));
|
git_buf_put(to, id_end, (size_t)(from_end - id_end));
|
||||||
|
|
||||||
return git_buf_oom(to) ? -1 : 0;
|
return git_buf_oom(to) ? -1 : 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user