Skip to content

Support for SHA256 #706

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

Open
3 of 11 tasks
pjbgf opened this issue Mar 7, 2023 · 7 comments
Open
3 of 11 tasks

Support for SHA256 #706

pjbgf opened this issue Mar 7, 2023 · 7 comments
Assignees
Milestone

Comments

@pjbgf
Copy link
Member

pjbgf commented Mar 7, 2023

Implement SHA256 support as per https://git-scm.com/docs/hash-function-transition/.

High level changes:

  • Repository Format Extension
  • Init a valid SHA256 repository
  • Packfile
  • Loose object index
  • Bidirectional (SHA-1 <-> SHA-256) mapping table
  • Fetching from SHA1 server
  • Signed Commits
  • Signed Tags
  • Mergetag
  • Submodules
  • Shallow clone (unsupported - fail gracefully)
@pjbgf pjbgf self-assigned this Mar 7, 2023
pjbgf added a commit to pjbgf/go-git that referenced this issue Mar 7, 2023
Relates to go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-git that referenced this issue Mar 8, 2023
Relates to the SHA256 implementation, defined in go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-git that referenced this issue Mar 8, 2023
The variable length for plumbing.Hash is defined at build time, blocked by
tag sha256.

This approach was a trade-off between keeping backwards compatibility while
making progress towards supporting SHA256 with a small amount of changes.

Relates to the SHA256 implementation, defined in go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
pjbgf added a commit to pjbgf/go-git that referenced this issue Mar 8, 2023
Add a new example on initializing a new repository with object format SHA256.
A new Makefile target was created to run the example to ensure that new changes
won't break SHA256 support going forwards.

Relates to the SHA256 implementation, defined in go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
@AdamMajer
Copy link

Thanks for working on this. I think the transition doesn't yet need to be implemented, since it doesn't really work in git tools anyway. What should be implemented is simply ability to work with SHA256 repositories - I think this is the scope of the work here.

SHA1 <> SHA256 repo interop probably will need some more thought and implementation upstream first.

@AdamMajer
Copy link

Seems a duplicate of #229 although more work is done here so maybe close the other issue.

@pjbgf
Copy link
Member Author

pjbgf commented Apr 18, 2023

@AdamMajer thanks for calling out the duplicated issue - just closed it.

I agree with your comment on the transition. Given that go-git aims to be aligned with upstream, the items pending for SHA256 will always have a hard blocker in terms of whether or not upstream already merged the given feature/change.

#707 Already added support to create and make commits in SHA256 repositories, but this is still experimental - hence why it is blocked by a build tag.

@AdamMajer
Copy link

@pjbgf , just to make sure I'm reading the patch you linked correctly, this basically just allows go-git to use only sha256 or sha1, depending on the build tag? There is no possibility of using both hash types in one program?

@pjbgf
Copy link
Member Author

pjbgf commented Jun 27, 2023

@AdamMajer that's correct. That is a temporary limitation which aims to keep backwards compatibility with the API - as plumbing.Hash defines the hash's length. There are also some performance/memory footprint considerations that will need to be considered when we implement that.

Once the bilateral mapping table is implemented, we should start looking into removing that limitation.

durandj pushed a commit to durandj/go-git that referenced this issue Jul 1, 2023
Relates to go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
durandj pushed a commit to durandj/go-git that referenced this issue Jul 1, 2023
Relates to the SHA256 implementation, defined in go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
durandj pushed a commit to durandj/go-git that referenced this issue Jul 1, 2023
The variable length for plumbing.Hash is defined at build time, blocked by
tag sha256.

This approach was a trade-off between keeping backwards compatibility while
making progress towards supporting SHA256 with a small amount of changes.

Relates to the SHA256 implementation, defined in go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
durandj pushed a commit to durandj/go-git that referenced this issue Jul 1, 2023
Add a new example on initializing a new repository with object format SHA256.
A new Makefile target was created to run the example to ensure that new changes
won't break SHA256 support going forwards.

Relates to the SHA256 implementation, defined in go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
traidare pushed a commit to traidare/go-git that referenced this issue Oct 26, 2024
Relates to go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
traidare pushed a commit to traidare/go-git that referenced this issue Oct 26, 2024
Relates to the SHA256 implementation, defined in go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
traidare pushed a commit to traidare/go-git that referenced this issue Oct 26, 2024
The variable length for plumbing.Hash is defined at build time, blocked by
tag sha256.

This approach was a trade-off between keeping backwards compatibility while
making progress towards supporting SHA256 with a small amount of changes.

Relates to the SHA256 implementation, defined in go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
traidare pushed a commit to traidare/go-git that referenced this issue Oct 26, 2024
Add a new example on initializing a new repository with object format SHA256.
A new Makefile target was created to run the example to ensure that new changes
won't break SHA256 support going forwards.

Relates to the SHA256 implementation, defined in go-git#706.

Signed-off-by: Paulo Gomes <pjbgf@linux.com>
@gecube
Copy link

gecube commented Oct 30, 2024

Hi!

I am waiting for changes, as I just experienced that Gitlab.com offers the new SHA-256 algorithm, but unfortunately tools bases on go-git could not work with such a repos...

image

@pjbgf
Copy link
Member Author

pjbgf commented Oct 30, 2024

@gecube thanks for the ping - I wasn't aware of that support from Gitlab. 🙇
The packfile refactoring is well under progress, hopefully by next month I will be able to get that merged against v6-exp - which should enable for cloning sha256 repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants