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

[vcs] cargo new --vcs fossil changes global settings for fossil-scm. #9449

Closed
yasuoohno opened this issue May 2, 2021 · 5 comments · Fixed by #9469
Closed

[vcs] cargo new --vcs fossil changes global settings for fossil-scm. #9449

yasuoohno opened this issue May 2, 2021 · 5 comments · Fixed by #9469
Labels
A-vcs Area: general VCS issues C-bug Category: bug Command-new

Comments

@yasuoohno
Copy link

Problem

cargo new --vcs fossil changes global ignore-glob/clean-glob settings for fossil-scm instead of repository local settings.
It will also affect other fossil-scm working copies.

Steps

  1. clear global setings `fossil unset ignore-glob --global & fossil unset clean-glob --global
  2. create new cargo package with cargo new project_name --vcs fossil
  3. global settings has been changed.

Possible Solution(s)

https://github.com/rust-lang/cargo/blob/master/src/cargo/util/vcs.rs#L99-L111

It seems that cargo executes fossil settings on the current working directory for cargo.
If it has to change the local settings of the repository, we need to do it in the project working directory.

just like this?

        ProcessBuilder::new("fossil")
            .cwd(&path)
            .arg("settings")
            .arg("ignore-glob")
            .arg("target")
            .exec()?;

        ProcessBuilder::new("fossil")
            .cwd(&path)
            .arg("settings")
            .arg("clean-glob")
            .arg("target")
            .exec()?;

But it is unversioned settings.
I think it would be better using versioned setting files in the project working directory.

  1. create .fossil-settings/ignore-glob and .fossil-settings/clean-glob files.
  2. (optional) add configuration files to the repository.
    fossil add .fossil-settings/ignore-glob .fossil-settings/clean-glob

Notes

Output of cargo version:
cargo 1.51.0 (43b129a 2021-03-16)

output of rustup show:
Default host: x86_64-pc-windows-msvc
stable-x86_64-pc-windows-msvc (default)
rustc 1.51.0 (2fd73fabe 2021-03-23)

Output of fossil version:
This is fossil version 2.15.1 [2f901f98b3] 2021-04-08 01:05:44 UTC

@yasuoohno yasuoohno added the C-bug Category: bug label May 2, 2021
@ehuss
Copy link
Contributor

ehuss commented May 3, 2021

Yea, it seems like it would make sense to have those be repository settings. I don't use fossil, but it sounds reasonable to me to change it.

@PaulDance
Copy link
Contributor

@yasuoohno #9469 hopefully fixed this part of the code. If you have a bit of time to try this out when it lands on nightly, I would love to hear some feedback!

bors added a commit to rust-lang-ci/rust that referenced this issue May 12, 2021
Update cargo

8 commits in e51522ab3db23b0d8f1de54eb1f0113924896331..070e459c2d8b79c5b2ac5218064e7603329c92ae
2021-05-07 21:29:52 +0000 to 2021-05-11 18:12:23 +0000
- Fix rustdoc warnings (rust-lang/cargo#9468)
- Improve performance of git status check in `cargo package`. (rust-lang/cargo#9478)
- Link to the new rustc tests chapter. (rust-lang/cargo#9477)
- Bump index cache version to deal with semver metadata version mismatch. (rust-lang/cargo#9476)
- Fix Url::into_string deprecation warning (rust-lang/cargo#9475)
- Fix rust-lang/cargo#4482 and rust-lang/cargo#9449: set Fossil ignore and clean settings locally (rust-lang/cargo#9469)
- Improve two error messages (rust-lang/cargo#9472)
- Fix `cargo install` with a semver metadata version. (rust-lang/cargo#9467)
@yasuoohno
Copy link
Author

Hi @PaulDance, Thank you for the fix. I'll try this and give you some feedback when I have time.

@yasuoohno
Copy link
Author

I confirmed with cargo 1.54.0-nightly.
It works fine as I expected with cargo new --vcs fossil and also cargo init --vcs fossil.

# the global settings are unchanged :-)
$ fossil settings ignore-glob --global
ignore-glob
$ fossil settings clean-glob --global
clean-glob

# and local settings are versionable
$ fossil settings ignore-glob
ignore-glob
  (overridden by contents of file .fossil-settings/ignore-glob)
$ fossil settings clean-glob
clean-glob
  (overridden by contents of file .fossil-settings/clean-glob)

$ cat .fossil-settings/ignore-glob
target
$ cat .fossil-settings/clean-glob
target

Thanks!

@PaulDance
Copy link
Contributor

@yasuoohno Cool, glad to hear it works as expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vcs Area: general VCS issues C-bug Category: bug Command-new
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants