Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

fix "reference delta not found" when cloning from aws codecommit #1086

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kcburge
Copy link

@kcburge kcburge commented Mar 12, 2019

The existing code does not handle the case where a ref delta refers to another
deltified object. Once the "parent" was undeltified, not attempt was made to
resolve references to that object's SHA1.

This change simply checks to see if there is an ExternalRef to the object just
resolved, and if so, replaces it and adopts its children.

I'm not an expert in the bowels of git, but this fixed my inability to clone
from codecommit.

@jfontan
Copy link
Contributor

jfontan commented Mar 14, 2019

Thanks for the patch!

@kcburge, are you able to iterate over all the objects after that change? I believe this change fixes index creation but there may be more problems.

@kcburge
Copy link
Author

kcburge commented Mar 16, 2019 via email

Copy link
Contributor

@jfontan jfontan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we don't have fixtures to test this case that would be good to have. Still this change looks good.

@kcburge kcburge force-pushed the fix-reference-delta-not-found branch from d131d7e to 75032bb Compare April 21, 2019 19:47
@kcburge
Copy link
Author

kcburge commented Apr 21, 2019

I resolved the DCO issue. I apologize for not having time to resolve the codecov issue.

@mcuadros
Copy link
Contributor

@kcburge can you provide a test?

@kcburge
Copy link
Author

kcburge commented Apr 22, 2019

I don't have anything to test with - I ran into this issue pulling from AWS codecommit (and not all repositories had this issue -- which is not invalid behavior of Git). It has been quite a while since I thought about this, but, from what I recall, the packfile objects parsed in order like this:

Object 1 OBJ_BLOB
Object 2 OBJ_REF_DELTA (based on Object 1)
Object 3 OBJ_REF_DELTA (based on Object 2) <-- this is where it would blow up

Basically the second (and more) subsequent ref delta's referred to SHA1's that didn't exist until the prior ref deltas were resolved. I don't know how hard it would be to mock this data structure.

Sorry I can't be more helpful at this time.

@mcuadros
Copy link
Contributor

What you can do upload to go-git-fixture a copy of the packfile or the capture the HTTP response to create a fixture.

@kcburge kcburge force-pushed the fix-reference-delta-not-found branch from 75032bb to b7346f9 Compare April 10, 2022 11:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants