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

Add test coverage for use of git without feature flag #10874

Merged
merged 3 commits into from
Jan 23, 2025
Merged

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Jan 22, 2025

Shoves a broken git executable onto the front of the PATH in the test context when the git feature is disabled so they fail if they're missing the feature-gate.

@zanieb zanieb added the internal A refactor or improvement that is not user-facing label Jan 22, 2025
@zanieb zanieb temporarily deployed to uv-test-publish January 22, 2025 19:53 — with GitHub Actions Inactive
@zanieb zanieb temporarily deployed to uv-test-publish January 22, 2025 20:06 — with GitHub Actions Inactive
@zanieb zanieb force-pushed the zb/disable-git branch 3 times, most recently from c48e963 to d71c696 Compare January 22, 2025 20:46
@zanieb zanieb temporarily deployed to uv-test-publish January 22, 2025 20:51 — with GitHub Actions Inactive
@zanieb zanieb changed the title Test if git is used without flagging Add test coverage for use of git without feature flag Jan 22, 2025
@zanieb zanieb marked this pull request as ready for review January 22, 2025 21:47
Copy link
Contributor

@Gankra Gankra left a comment

Choose a reason for hiding this comment

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

Nice, I gather from all the new attrs that The System Works!

Comment on lines +471 to +475
let contents = r"#!/bin/sh
echo 'error: `git` operations are not allowed — are you missing a cfg for the `git` feature?' >&2
exit 127";
let git = bin_dir.join(format!("git{}", env::consts::EXE_SUFFIX));
fs_err::write(&git, contents)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's funny, this is all kinds of weird on windows but that's fine because we just need windows to explode (especially because we only need this to break on some platform so the CI throws a fit and tells you to add a cfg).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah haha it doesn't fail with a nice error message on Windows but it does fail loudly..

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there something better we could do that remains trivial?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think so, especially if anything specifically looks for git.exe (windows PATH resolution is weird and magic about suffixes and there's two different APIs for looking up things on PATH, it's a whole thing).

Copy link
Contributor

Choose a reason for hiding this comment

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

(Notably the thing JS does to shim binaries onto path doesn't work with rust's Command because of all this, blech)

@zanieb zanieb merged commit a0620bc into main Jan 23, 2025
68 checks passed
@zanieb zanieb deleted the zb/disable-git branch January 23, 2025 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal A refactor or improvement that is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants