Skip to content

Commit 507e547

Browse files
szedergitster
authored andcommitted
worktree remove: clarify error message on dirty worktree
To avoid data loss, 'git worktree remove' refuses to delete a worktree if it's dirty or contains untracked files. However, the error message only mentions that the worktree "is dirty", even if the worktree in question is in fact clean, but contains untracked files: $ git worktree add test-worktree Preparing worktree (new branch 'test-worktree') HEAD is now at aa53e60 Initial $ >test-worktree/untracked-file $ git worktree remove test-worktree/ fatal: 'test-worktree/' is dirty, use --force to delete it $ git -C test-worktree/ diff $ git -C test-worktree/ diff --cached $ # Huh? Where are those dirty files?! Clarify this error message to say that the worktree "contains modified or untracked files". Signed-off-by: SZEDER Gábor <[email protected]> Reviewed-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ff66981 commit 507e547

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/worktree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ static void check_clean_worktree(struct worktree *wt,
880880
original_path);
881881
ret = xread(cp.out, buf, sizeof(buf));
882882
if (ret)
883-
die(_("'%s' is dirty, use --force to delete it"),
883+
die(_("'%s' contains modified or untracked files, use --force to delete it"),
884884
original_path);
885885
close(cp.out);
886886
ret = finish_command(&cp);

0 commit comments

Comments
 (0)