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

Generate .cargo_vcs_info.json and include in cargo package (take 2) #5886

Merged
merged 4 commits into from
Aug 20, 2018

Conversation

dekellum
Copy link
Contributor

Implements #5629 and supersedes #5786, with the following improvements:

Possible followup:

@alexcrichton r?
@joshtriplett cc

@rust-highfive
Copy link

r? @matklad

(rust_highfive has picked a reviewer for you, use r? to override)

@dekellum
Copy link
Contributor Author

r? @alexcrichton

format!("failed to add to archive: `{}`", fnd)
})?;
let mut buff = Cursor::new(Vec::with_capacity(256));
writeln!(buff, "{}", serde_json::to_string_pretty(json)?)?;
Copy link
Member

Choose a reason for hiding this comment

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

I think the Cursor isn't necessary here, right? This could just use to_string and then get out a Vec<u8> which could be passed in below as a slice?

@alexcrichton
Copy link
Member

Looks good to me, thanks! Just one small nit but otherwise r=me

@dekellum
Copy link
Contributor Author

@alexcrichton Fixed the ´nit, which does simplify that portion, thanks for pointing that out. Also fixed a new clippy lint associated with this PR's changes. Cross review as of 06dcc20?

@alexcrichton
Copy link
Member

@bors: r+

Thanks again for this!

@dekellum
Copy link
Contributor Author

Thank you! Bors is kind of slow at moment then, I must assume.

@alexcrichton
Copy link
Member

@bors: r+

I think @bors was asleep...

@bors
Copy link
Contributor

bors commented Aug 20, 2018

📌 Commit 06dcc20 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Aug 20, 2018

⌛ Testing commit 06dcc20 with merge 0ec7281...

bors added a commit that referenced this pull request Aug 20, 2018
Generate .cargo_vcs_info.json and include in `cargo package` (take 2)

Implements #5629 and supersedes #5786, with the following improvements:

* With an upstream git2-rs fix (tracked #5823, validated and min version update in: #5858), no longer requires windows/unix split tests.

* Per review in #5786, drops file system output and locks for .cargo_vcs_info.json.

* Now uses serde `json!` macro for json production with appropriate escaping.

* Now includes a test of the output json format.

Possible followup:

* Per discussion in #5786, we could improve reliability of both the VCS dirty check and the git head sha1 recording by preferring (and/or warning otherwise) the local repository bytes of each source file, at the same head commit. This makes the process more appropriately like an atomic snapshot, with no sentry file or other locking required.  However given my lack of a window's license and dev setup, as exhibited by troubles of #5823, this feel intuitively like too much to attempt to change in one iteration here.  I accept the "best effort" concept of this feature as suggested in #5786, and think it acceptable progress if merged in this form.

@alexcrichton r?
@joshtriplett cc
@bors
Copy link
Contributor

bors commented Aug 20, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 0ec7281 to master...

@bors bors merged commit 06dcc20 into rust-lang:master Aug 20, 2018
est31 added a commit to est31/cargo-local-serve that referenced this pull request Jan 12, 2019
Cargo has gained a feature where it records the package-time VCS commit:

* rust-lang/cargo#5886
* rust-lang/cargo#5629
@ehuss ehuss added this to the 1.30.0 milestone Feb 6, 2022
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.

6 participants