Skip to content
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

fix(git): improve parsing of worktree list #2548

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

hiddeco
Copy link
Contributor

@hiddeco hiddeco commented Sep 19, 2024

This changes the listing of Git worktrees by implementing a more robust parsing mechanism for the git worktree list command output. The previous implementation struggled with certain edge cases, such as detached HEAD states, leading to parsing errors:

error adding work tree ./target to repo https://example.com/org/repo.git: unexpected number of fields: "/tmp/dir/source                67286d2 (detached HEAD)"

The new approach utilizes the --porcelain option and introduces a line-by-line parsing strategy, capable of extracting detailed information about each worktree, including its path, HEAD commit, branch, etc. without relying on a specific number of columns.

Copy link

netlify bot commented Sep 19, 2024

Deploy Preview for docs-kargo-akuity-io ready!

Name Link
🔨 Latest commit 334547a
🔍 Latest deploy log https://app.netlify.com/sites/docs-kargo-akuity-io/deploys/66eca5efb594800007a61b78
😎 Deploy Preview https://deploy-preview-2548.kargo.akuity.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@hiddeco hiddeco force-pushed the fix-worktree-list branch 2 times, most recently from 446b758 to fafea65 Compare September 19, 2024 21:50
Copy link

codecov bot commented Sep 19, 2024

Codecov Report

Attention: Patch coverage is 90.47619% with 4 lines in your changes missing coverage. Please review.

Project coverage is 50.61%. Comparing base (85fff0a) to head (334547a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/controller/git/bare_repo.go 90.47% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2548      +/-   ##
==========================================
+ Coverage   50.54%   50.61%   +0.06%     
==========================================
  Files         278      278              
  Lines       20438    20471      +33     
==========================================
+ Hits        10331    10362      +31     
- Misses       9472     9473       +1     
- Partials      635      636       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hiddeco hiddeco added this pull request to the merge queue Sep 20, 2024
Merged via the queue into akuity:main with commit ac5f975 Sep 20, 2024
17 checks passed
@hiddeco hiddeco deleted the fix-worktree-list branch September 20, 2024 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants