summaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-03-14 19:01:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-14 19:01:05 (GMT)
commitbd0f794342d5b3921f2d5d4bffce87ec7b7e4d96 (patch)
treef080814888dc0d530d2bc7fe3fa8fe21a136de7b /strbuf.c
parent436d18f2d00b61bea44be2f8d35a437172132873 (diff)
parent7f19def0fc254829839495f7fb44a7d99b161d3d (diff)
downloadgit-bd0f794342d5b3921f2d5d4bffce87ec7b7e4d96.zip
git-bd0f794342d5b3921f2d5d4bffce87ec7b7e4d96.tar.gz
git-bd0f794342d5b3921f2d5d4bffce87ec7b7e4d96.tar.bz2
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.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/strbuf.c b/strbuf.c
index 5f138ed..0759590 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -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;