File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -600,6 +600,13 @@ void git_buf_shorten(git_buf *buf, size_t amount)
600600 git_buf_clear (buf );
601601}
602602
603+ void git_buf_truncate_at_char (git_buf * buf , char separator )
604+ {
605+ ssize_t idx = git_buf_find (buf , separator );
606+ if (idx >= 0 )
607+ git_buf_truncate (buf , (size_t )idx );
608+ }
609+
603610void git_buf_rtruncate_at_char (git_buf * buf , char separator )
604611{
605612 ssize_t idx = git_buf_rfind_next (buf , separator );
Original file line number Diff line number Diff line change @@ -171,6 +171,7 @@ void git_buf_consume_bytes(git_buf *buf, size_t len);
171171void git_buf_consume (git_buf * buf , const char * end );
172172void git_buf_truncate (git_buf * buf , size_t len );
173173void git_buf_shorten (git_buf * buf , size_t amount );
174+ void git_buf_truncate_at_char (git_buf * buf , char separator );
174175void git_buf_rtruncate_at_char (git_buf * path , char separator );
175176
176177/** General join with separator */
You can’t perform that action at this time.
0 commit comments