Merge branch 'jk/tzoffset-fix'
[gitweb.git] / builtin / worktree.c
index f9dac376f748480c72023e9f4375edc90069a2ce..e866844685d519e2406c050da497c42506077f7d 100644 (file)
@@ -110,7 +110,7 @@ static void prune_worktrees(void)
                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)
@@ -340,6 +340,9 @@ static int add(int ac, const char **av, const char *prefix)
        path = prefix_filename(prefix, strlen(prefix), av[0]);
        branch = ac < 2 ? "HEAD" : av[1];
 
+       if (!strcmp(branch, "-"))
+               branch = "@{-1}";
+
        opts.force_new_branch = !!new_branch_force;
        if (opts.force_new_branch) {
                struct strbuf symref = STRBUF_INIT;