diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-03-14 22:01:05 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-03-14 22:01:05 +0300 |
commit | bd0f794342d5b3921f2d5d4bffce87ec7b7e4d96 (patch) | |
tree | f080814888dc0d530d2bc7fe3fa8fe21a136de7b /strbuf.c | |
parent | 436d18f2d00b61bea44be2f8d35a437172132873 (diff) | |
parent | 7f19def0fc254829839495f7fb44a7d99b161d3d (diff) |
Merge branch 'nd/worktree-move'
"git worktree" learned move and remove subcommands.
* nd/worktree-move:
t2028: fix minor error and issues in newly-added "worktree move" tests
worktree remove: allow it when $GIT_WORK_TREE is already gone
worktree remove: new command
worktree move: refuse to move worktrees with submodules
worktree move: accept destination as directory
worktree move: new command
worktree.c: add update_worktree_location()
worktree.c: add validate_worktree()
Diffstat (limited to 'strbuf.c')
-rw-r--r-- | strbuf.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -95,6 +95,7 @@ void strbuf_trim(struct strbuf *sb) strbuf_rtrim(sb); strbuf_ltrim(sb); } + void strbuf_rtrim(struct strbuf *sb) { while (sb->len > 0 && isspace((unsigned char)sb->buf[sb->len - 1])) @@ -102,6 +103,13 @@ void strbuf_rtrim(struct strbuf *sb) sb->buf[sb->len] = '\0'; } +void strbuf_trim_trailing_dir_sep(struct strbuf *sb) +{ + while (sb->len > 0 && is_dir_sep((unsigned char)sb->buf[sb->len - 1])) + sb->len--; + sb->buf[sb->len] = '\0'; +} + void strbuf_ltrim(struct strbuf *sb) { char *b = sb->buf; |