-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
When cloning a repository: "BUG: refs.c:1119: create called without valid new_oid" #3781
Comments
Hi, @helarsen:
There has been recent work in the refs backend that could have temporarily triggered this bug, but maybe it is fixed by now. If not, then we will take a closer look. |
Thank you @derrickstolee for looking into this. re 1: The version provoking this error is the latest 2.35.1.windows.2. And Version 2.27 is the one which does not fail (on another machine) I should probably also have mentioned that despite this error - the cloned version does not appear to have any flaws - at least I can check in and out - very basic tests in that respect because of the obvious risk of corruption i abandoned working on the clone. If i can have access to older releases of the installer I can try downgrade from 2.35 but I have not been able to find this - and I am reluctant to upgrade my working 2.27. Can you point me where I can find older releases? br henning |
Sorry that I misread your issue. You clearly stated that and it was my fault in misunderstanding.
You could try a
Makes sense, but you're likely missing some security fixes in the meantime.
The full release list is available at https://github.com/git-for-windows/git/releases
|
Thanks.
It turns out that Google drive, which hosts the repository sprinkles each and every folder with a desktop.ini file!
So google drive it is not a good place to store such repositories!
with a file extension of .ini6) or .ini56) or .ini256). This is not reflected in the actual files - they are all .ini I will clean up this shameful mess and report back if this did not solve the issue. Any suggestions are welcome - of course. |
Summary and solutions. Cloning fails in git 2.35 with the mentioned message "BUG: refs.c:1119: create called without valid new_oid" but My solution: Copy the repository files from google drive to a windows folder and remove all the desktop.ini files (using the practical grepWin tool). Now the repostory is healthy again in its new location. But lesson is - "Dont store a repository on google drive". Thanks to @derrickstolee for helping |
I'm glad you have a workaround. We should probably fix this, anyway. Having a |
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>
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>
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Setup
Git 32bit, but also Git 64bit gives same result
$ cmd.exe /c ver
Microsoft Windows [Version 10.0.19042.1620]
Above is a copy of the command and reply.
This repository can be cloned with another computer and same command without problem using this version of git:
The text was updated successfully, but these errors were encountered: