summaryrefslogtreecommitdiff
path: root/t/t2501-cwd-empty.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2021-12-09 05:08:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-12-09 21:33:12 (GMT)
commit0b0ee3388cf080c4200c235ee699bd95c960c167 (patch)
tree7d5329f4788d7cb5c335430c0ff573f0a83a5afb /t/t2501-cwd-empty.sh
parentb817e545338cdb737b3deebf4917afb4a18ede57 (diff)
downloadgit-0b0ee3388cf080c4200c235ee699bd95c960c167.zip
git-0b0ee3388cf080c4200c235ee699bd95c960c167.tar.gz
git-0b0ee3388cf080c4200c235ee699bd95c960c167.tar.bz2
unpack-trees: add special cwd handling
When running commands such as `git reset --hard` from a subdirectory, if that subdirectory is in the way of adding needed files, bail with an error message. Note that this change looks kind of like it duplicates the new lines of code from the previous commit in verify_clean_subdirectory(). However, when we are preserving untracked files, we would rather any error messages about untracked files being in the way take precedence over error messages about a subdirectory that happens to be the_original_cwd being in the way. But in the UNPACK_RESET_OVERWRITE_UNTRACKED case, there is no untracked checking to be done, so we simply add a special case near the top of verify_absent_1. Acked-by: Derrick Stolee <stolee@gmail.com> Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2501-cwd-empty.sh')
-rwxr-xr-xt/t2501-cwd-empty.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t2501-cwd-empty.sh b/t/t2501-cwd-empty.sh
index 398908d..5af1fec 100755
--- a/t/t2501-cwd-empty.sh
+++ b/t/t2501-cwd-empty.sh
@@ -121,7 +121,7 @@ test_expect_success 'reset --hard does not clean cwd incidentally' '
'
test_expect_success 'reset --hard fails if cwd needs to be removed' '
- test_required_dir_removal failure git reset --hard fd_conflict
+ test_required_dir_removal success git reset --hard fd_conflict
'
test_expect_success 'merge does not clean cwd incidentally' '