-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clone: ignore invalid local refs in remote #1214
Conversation
Linking to the original report: git-for-windows#3781 |
/submit |
Submitted as pull.1214.git.1650301959803.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
On the Git mailing list, Ævar Arnfjörð Bjarmason wrote (reply to this):
|
User |
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
On the Git mailing list, Derrick Stolee wrote (reply to this):
|
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
When cloning directly from a local repository, we load a list of refs based on scanning the $GIT_DIR/refs/ directory of the "server" repository. If files exist in that directory that do not parse as hexadecimal hashes, then the ref array used by write_remote_refs() ends up with some entries with null OIDs. This causes us to hit a BUG() statement in ref_transaction_create(): BUG: create called without valid new_oid This BUG() call used to be a die() until 033abf9 (Replace all die("BUG: ...") calls by BUG() ones, 2018-05-02). Before that, the die() was added by f04c5b5 (ref_transaction_create(): check that new_sha1 is valid, 2015-02-17). The original report for this bug [1] mentioned that this problem did not exist in Git 2.27.0. The failure bisects unsurprisingly to 968f12f (refs: turn on GIT_REF_PARANOIA by default, 2021-09-24). When GIT_REF_PARANOIA is enabled, this case always fails as far back as I am able to successfully compile and test the Git codebase. [1] git-for-windows#3781 There are two approaches to consider here. One would be to remove this BUG() statement in favor of returning with an error. There are only two callers to ref_transaction_create(), so this would have a limited impact. The other approach would be to add special casing in 'git clone' to avoid this faulty input to the method. While I originally started with changing 'git clone', I decided that modifying ref_transaction_create() was a more complete solution. This prevents failing with a BUG() statement when we already have a good way to report an error (including a reason for that error) within the method. Both callers properly check the return value and die() with the error message, so this is an appropriate direction. The added test helps check against a regression, but does check that our intended error message is handled correctly. Signed-off-by: Derrick Stolee <derrickstolee@github.com>
/submit |
Submitted as pull.1214.v2.git.1650894450441.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
This branch is now known as |
This patch series was integrated into seen via git@5cb6ecf. |
This patch series was integrated into seen via git@9b6309a. |
This patch series was integrated into seen via git@d4a6080. |
There was a status update in the "New Topics" section about the branch Code clean-up. Will merge to 'next'. source: <pull.1214.v2.git.1650894450441.gitgitgadget@gmail.com> |
This patch series was integrated into seen via git@1c7bbea. |
This patch series was integrated into seen via git@0f5143d. |
This patch series was integrated into seen via git@945d404. |
This patch series was integrated into seen via git@d415a42. |
This patch series was integrated into seen via git@65ffd11. |
This patch series was integrated into seen via git@c848471. |
There was a status update in the "Cooking" section about the branch Code clean-up. Will merge to 'next'. source: <pull.1214.v2.git.1650894450441.gitgitgadget@gmail.com> |
This patch series was integrated into seen via git@49bf962. |
This patch series was integrated into seen via git@18f3145. |
There was a status update in the "Cooking" section about the branch Code clean-up. Will merge to 'next'. source: <pull.1214.v2.git.1650894450441.gitgitgadget@gmail.com> |
This patch series was integrated into seen via git@64359f5. |
This patch series was integrated into seen via git@4f429ec. |
There was a status update in the "Cooking" section about the branch Code clean-up. Will merge to 'next'. source: <pull.1214.v2.git.1650894450441.gitgitgadget@gmail.com> |
This patch series was integrated into seen via git@892b473. |
This patch series was integrated into seen via git@8cdf52e. |
There was a status update in the "Cooking" section about the branch Code clean-up. Will merge to 'next'. source: <pull.1214.v2.git.1650894450441.gitgitgadget@gmail.com> |
This patch series was integrated into seen via git@4df5247. |
This patch series was integrated into seen via git@2feb3c2. |
This patch series was integrated into seen via git@3a47162. |
This patch series was integrated into next via git@af4d003. |
There was a status update in the "Cooking" section about the branch Code clean-up. Will merge to 'master'. source: <pull.1214.v2.git.1650894450441.gitgitgadget@gmail.com> |
This patch series was integrated into seen via git@93031d7. |
Update in v2:
cc: gitster@pobox.com
cc: me@ttaylorr.com
cc: Ævar Arnfjörð Bjarmason avarab@gmail.com