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

changeset: Look in packed-refs if ref file not found. #2425

Merged
merged 1 commit into from
Feb 17, 2022

Conversation

wlynch
Copy link
Contributor

@wlynch wlynch commented Feb 11, 2022

Changes

🎁 changeset: Look in packed-refs file if ref file not found.

If you have a lot of refs in a repo, git will eventually start
condensing them into a single file instead of letting them sprawl out in
separate directories on the filesystem. This change lets the changeset
package use the packed-refs file as a fall back in the event that the
ref file is not found.

See https://git-scm.com/docs/git-pack-refs for more details on packed
refs.

/kind feature

Bumped into this while working on some Tekton PRs - the refs got stuffed into packed-refs and calls relying on changeset.Get() started failing / causing log noise because the refs/heads/main file no longer existed. Seems small enough that it didn't warrant its own issue, but happy to open one if desired!

Release Note

* changeset now supports reading from Git `packed-refs` files.

Docs

n/a

@knative-prow-robot knative-prow-robot added kind/feature size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 11, 2022
@codecov
Copy link

codecov bot commented Feb 11, 2022

Codecov Report

Merging #2425 (62b1122) into main (51be315) will decrease coverage by 0.03%.
The diff coverage is 92.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2425      +/-   ##
==========================================
- Coverage   63.52%   63.48%   -0.04%     
==========================================
  Files         228      228              
  Lines        9990     9996       +6     
==========================================
  Hits         6346     6346              
- Misses       3344     3347       +3     
- Partials      300      303       +3     
Impacted Files Coverage Δ
changeset/commit.go 94.87% <92.00%> (-5.13%) ⬇️
test/gcs/mock/mock.go 90.32% <0.00%> (-2.16%) ⬇️
hash/bucketer.go 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc93ac7...62b1122. Read the comment docs.

If you have a lot of refs in a repo, git will eventually start
condensing them into a single file instead of letting them sprawl out in
separate directories on the filesystem. This change lets the changeset
package use the packed-refs file as a fall back in the event that the
ref file is not found.

See https://git-scm.com/docs/git-pack-refs for more details on packed
refs.
@dprotaso
Copy link
Member

I actually want to replace this package to use

https://pkg.go.dev/runtime/debug there's a ReadBuildInfo function

does that give you what you want?

@wlynch
Copy link
Contributor Author

wlynch commented Feb 14, 2022

Did some testing - runtime/debug probably won't be super useful until 1.18, particularly for local changes.

The main module info for something built not at a semver tag looks like:

Main:{Path:knative.dev/pkg Version:(devel) Sum: Replace:<nil>}

What we really want are the vcs tags included in 1.18 which look like:

Settings:[
 {Key:-compiler Value:gc}
 {Key:CGO_ENABLED Value:1}
 {Key:CGO_CFLAGS Value:}
 {Key:CGO_CPPFLAGS Value:} 
 {Key:CGO_CXXFLAGS Value:}
 {Key:CGO_LDFLAGS Value:} 
 {Key:GOARCH Value:amd64} 
 {Key:GOOS Value:linux} 
 {Key:GOAMD64 Value:v1} 
 {Key:vcs Value:git} 
 {Key:vcs.revision Value:62b1122c86b2f032117da832332037ff511c2b74} 
 {Key:vcs.time Value:2022-02-11T23:48:33Z} 
 {Key:vcs.modified Value:true}
]

@dprotaso
Copy link
Member

/lgtm
/approve

thanks for the due diligence

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 15, 2022
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, wlynch

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 15, 2022
@dprotaso
Copy link
Member

/retest

1 similar comment
@dprotaso
Copy link
Member

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants