Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fast-import: avoid making replace refs point to themselves
If someone replaces a commit with a modified version, then builds on that commit, and then later decides to rewrite history in a format like git fast-export --all | CMD_TO_TWEAK_THE_STREAM | git fast-import and CMD_TO_TWEAK_THE_STREAM undoes the modifications that the replacement did, then at the end you'd get a replace ref that points to itself. For example: $ git show-ref | grep replace fb92ebc654641b310e7d0360d0a5a49316fd7264 refs/replace/fb92ebc654641b310e7d0360d0a5a49316fd7264 Most git commands that you try to run in such a repository with a self-pointing replace object will result in an error: $ git log fatal: replace depth too high for object fb92ebc654641b310e7d0360d0a5a49316fd7264 Avoid such problems by deleting replace refs that will simply end up pointing to themselves at the end of our writing. Warn the users when we do so, unless they specify --quiet. Signed-off-by: Elijah Newren <[email protected]>
- Loading branch information