Skip to content

Commit ac35cfc

Browse files
committed
Better explain why we cancel even on unstaged deletions
Only the secondary reason, which is the less important one, was given before. Now both are given and the more important reason is emphasized. (If the entire subtree is deleted on disk, staged or not, then we do proceed, since neither disadvantage applies. I think this is clear from context, since this is checked first, and like the other checks, it is commented.)
1 parent 3710c34 commit ac35cfc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

etc/copy-packetline.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ function check_target_dir () {
5151
fi
5252
else
5353
# We can lose data if anything of value at the target is not in the index.
54-
# (Even unstaged deletions, for we can forget what was and wasn't deleted.)
54+
# (This includes unstaged deletions, for two reasons. One is that we could
55+
# lose track of which files had been deleted. More importantly, replacing a
56+
# staged symlink or regular file with an unstaged directory is shown by
57+
# git-status as only a deletion, even if the directory is non-empty.)
5558
if target_dir_status | grep -q '^.[^ ]'; then
5659
fail 'target exists, with unstaged changes or ignored files'
5760
fi

0 commit comments

Comments
 (0)