8000 utils: fix diff so subpaths work for sparse checkouts, fixes 1455 to releases/v5.x by kane8n · Pull Request #1567 · go-git/go-git · GitHub
[go: up one dir, main page]

Skip to content

utils: fix diff so subpaths work for sparse checkouts, fixes 1455 to releases/v5.x #1567

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

Merged

Conversation

kane8n
Copy link
@kane8n kane8n commented Jun 6, 2025

Related issues

#1558

Description

Backport of #1484 to v5.

utils: fix diff so subpaths work for sparse checkouts, fixes 1455
@Copilot Copilot AI review requested due to automatic review settings June 6, 2025 08:22
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR backports changes to fix subpath handling for sparse checkouts, addressing issue 1455 by ensuring diff operations respect the SkipWorktree flag correctly.

  • Replace filepath with path for consistent path joining.
  • Add a new test (TestDiffSkipIssue1455) to verify correct diff behavior with sparse checkouts.
  • Adjust node creation and change processing logic to properly handle nodes with SkipWorktree enabled.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
utils/merkletrie/index/node_test.go Updated tests replacing filepath with path and added TestDiffSkipIssue1455.
utils/merkletrie/index/node.go Modified logic to update parent's skip flag in nested nodes.
utils/merkletrie/change.go Updated condition to skip processing for directories or skipped entries.
Comments suppressed due to low confidence (2)

utils/merkletrie/index/node_test.go:66

  • Consider adding additional test cases within TestDiffSkipIssue1455 to cover scenarios with nested nodes having mixed SkipWorktree values to ensure robust behavior.
func (s *NoderSuite) TestDiffSkipIssue1455(c *C) {

utils/merkletrie/change.go:153

  • Adding a brief comment explaining why current.Skip() is checked alongside current.IsDir() could improve code clarity for future maintainers.
if current.IsDir() || current.Skip() {

Copy link
Member
@pjbgf pjbgf left a comment

Choose a reason for hiding this comment

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

@kane8n thank you for back-porting this. 🙇

@pjbgf pjbgf merged commit ed8216c into go-git:releases/v5.x Jun 6, 2025
12 of 13 checks passed
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

Successfully merging this pull request may close these issues.

2 participants
0