Skip to content

Commit

Permalink
Better explain why we cancel even on unstaged deletions
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
EliahKagan committed Apr 9, 2024
1 parent 3c553c3 commit a975339
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion etc/copy-packetline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ function check_target_dir () {
fi
else
# We can lose data if anything of value at the target is not in the index.
# (Even unstaged deletions, for we can forget what was and wasn't deleted.)
# (This includes unstaged deletions, for two reasons. One is that we could
# lose track of which files had been deleted. More importantly, replacing a
# staged symlink or regular file with an unstaged directory is shown by
# git-status as only a deletion, even if the directory is non-empty.)
if target_dir_status | grep -q '^.[^ ]'; then
fail 'target exists, with unstaged changes or ignored files'
fi
Expand Down

0 comments on commit a975339

Please sign in to comment.