diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-11-27 07:57:08 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-11-27 07:57:08 +0900 |
| commit | 8eaa06590fe916d4f2baa1fdb93959f1cfa9ab47 (patch) | |
| tree | bae07cc5dc2973486420b8f64a611fb99d7c7031 /t | |
| parent | Merge branch 'kh/trailer-in-glossary' (diff) | |
| parent | fast-import: avoid making replace refs point to themselves (diff) | |
| download | git-8eaa06590fe916d4f2baa1fdb93959f1cfa9ab47.tar.gz git-8eaa06590fe916d4f2baa1fdb93959f1cfa9ab47.zip | |
Merge branch 'en/fast-import-avoid-self-replace'
"git fast-import" can be tricked into a replace ref that maps an
object to itself, which is a useless thing to do.
* en/fast-import-avoid-self-replace:
fast-import: avoid making replace refs point to themselves
Diffstat (limited to 't')
| -rwxr-xr-x | t/t9300-fast-import.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 6224f54d4d..425a261c16 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -3692,6 +3692,34 @@ test_expect_success ICONV 'X: handling encoding' ' git log -1 --format=%B encoding | grep $(printf "\317\200") ' +test_expect_success 'X: replace ref that becomes useless is removed' ' + git init -qb main testrepo && + cd testrepo && + ( + test_commit test && + + test_commit msg somename content && + + git mv somename othername && + NEW_TREE=$(git write-tree) && + MSG="$(git log -1 --format=%B HEAD)" && + NEW_COMMIT=$(git commit-tree -p HEAD^1 -m "$MSG" $NEW_TREE) && + git replace main $NEW_COMMIT && + + echo more >>othername && + git add othername && + git commit -qm more && + + git fast-export --all >tmp && + sed -e s/othername/somename/ tmp >tmp2 && + git fast-import --force <tmp2 2>msgs && + + grep "Dropping.*since it would point to itself" msgs && + git show-ref >refs && + ! grep refs/replace refs + ) +' + ### ### series Y (submodules and hash algorithms) ### |
