From: Junio C Hamano Date: Fri, 10 Feb 2017 20:52:25 +0000 (-0800) Subject: Merge branch 'ps/worktree-prune-help-fix' X-Git-Tag: v2.12.0-rc1~8 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/65fecf0c08ceb5dd492281aa5894df64f898a118?ds=inline;hp=-c Merge branch 'ps/worktree-prune-help-fix' Incorrect usage help message for "git worktree prune" has been fixed. * ps/worktree-prune-help-fix: worktree: fix option descriptions for `prune` --- 65fecf0c08ceb5dd492281aa5894df64f898a118 diff --combined builtin/worktree.c index 9a97e37a3f,3c42e8b657..831fe058a5 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@@ -2,32 -2,12 +2,32 @@@ #include "builtin.h" #include "dir.h" #include "parse-options.h" +#include "argv-array.h" +#include "branch.h" +#include "refs.h" +#include "run-command.h" +#include "sigchain.h" +#include "refs.h" +#include "utf8.h" +#include "worktree.h" static const char * const worktree_usage[] = { + N_("git worktree add [] []"), + N_("git worktree list []"), + N_("git worktree lock [] "), N_("git worktree prune []"), + N_("git worktree unlock "), NULL }; +struct add_opts { + int force; + int detach; + int checkout; + const char *new_branch; + int force_new_branch; +}; + static int show_only; static int verbose; static unsigned long expire; @@@ -55,7 -35,7 +55,7 @@@ static int prune_worktree(const char *i return 1; } len = st.st_size; - path = xmalloc(len + 1); + path = xmallocz(len); read_in_full(fd, path, len); close(fd); while (len && (path[len - 1] == '\n' || path[len - 1] == '\r')) @@@ -97,7 -77,7 +97,7 @@@ static void prune_worktrees(void if (!dir) return; while ((d = readdir(dir)) != NULL) { - if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) + if (is_dot_or_dotdot(d->d_name)) continue; strbuf_reset(&reason); if (!prune_worktree(d->d_name, &reason)) @@@ -112,7 -92,7 +112,7 @@@ if (ret < 0 && errno == ENOTDIR) ret = unlink(path.buf); if (ret) - error(_("failed to remove: %s"), strerror(errno)); + error_errno(_("failed to remove '%s'"), path.buf); } closedir(dir); if (!show_only) @@@ -125,9 -105,9 +125,9 @@@ static int prune(int ac, const char **a { struct option options[] = { OPT__DRY_RUN(&show_only, N_("do not remove, show only")), - OPT__VERBOSE(&verbose, N_("report pruned objects")), + OPT__VERBOSE(&verbose, N_("report pruned working trees")), OPT_EXPIRY_DATE(0, "expire", &expire, - N_("expire objects older than