worktree move: accept destination as directory

Similar to "mv a b/", which is actually "mv a b/a", we extract basename
of source worktree and create a directory of the same name at
destination if dst path is a directory.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2018-02-12 16:49:37 +07:00
committed by Junio C Hamano
parent 9f792bb472
commit c64a8d200f
4 changed files with 32 additions and 1 deletions

View File

@ -179,6 +179,9 @@ extern void strbuf_trim(struct strbuf *);
extern void strbuf_rtrim(struct strbuf *);
extern void strbuf_ltrim(struct strbuf *);
/* Strip trailing directory separators */
extern void strbuf_trim_trailing_dir_sep(struct strbuf *);
/**
* Replace the contents of the strbuf with a reencoded form. Returns -1
* on error, 0 on success.