From a45924cc21d3138ee449d1cf756ca914ce10f52d Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:21:18 +0000 Subject: [PATCH] Explicitly provide dummy git author name and email This avoids the need to tell git beforehand about your name and email --- .cirrus.yml | 2 -- .github/workflows/main.yml | 7 +------ build_system/prepare.rs | 21 +++++++++++++++++++-- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 732edd66196d..d627c2ee09c4 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -12,8 +12,6 @@ task: folder: target prepare_script: - . $HOME/.cargo/env - - git config --global user.email "user@example.com" - - git config --global user.name "User" - ./y.rs prepare test_script: - . $HOME/.cargo/env diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index babadc4d4677..a6bb12a66a24 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -90,10 +90,7 @@ jobs: sudo apt-get install -y gcc-s390x-linux-gnu qemu-user - name: Prepare dependencies - run: | - git config --global user.email "user@example.com" - git config --global user.name "User" - ./y.rs prepare + run: ./y.rs prepare - name: Build without unstable features env: @@ -183,8 +180,6 @@ jobs: - name: Prepare dependencies run: | - git config --global user.email "user@example.com" - git config --global user.name "User" git config --global core.autocrlf false rustc y.rs -o y.exe -g ./y.exe prepare diff --git a/build_system/prepare.rs b/build_system/prepare.rs index 28322c1cb512..8826f1bd2595 100644 --- a/build_system/prepare.rs +++ b/build_system/prepare.rs @@ -180,7 +180,16 @@ fn init_git_repo(repo_dir: &Path) { spawn_and_wait(git_add_cmd); let mut git_commit_cmd = Command::new("git"); - git_commit_cmd.arg("commit").arg("-m").arg("Initial commit").arg("-q").current_dir(repo_dir); + git_commit_cmd + .arg("-c") + .arg("user.name=Dummy") + .arg("-c") + .arg("user.email=dummy@example.com") + .arg("commit") + .arg("-m") + .arg("Initial commit") + .arg("-q") + .current_dir(repo_dir); spawn_and_wait(git_commit_cmd); } @@ -216,7 +225,15 @@ fn apply_patches(dirs: &Dirs, crate_name: &str, target_dir: &Path) { patch.file_name().unwrap() ); let mut apply_patch_cmd = Command::new("git"); - apply_patch_cmd.arg("am").arg(patch).arg("-q").current_dir(target_dir); + apply_patch_cmd + .arg("-c") + .arg("user.name=Dummy") + .arg("-c") + .arg("user.email=dummy@example.com") + .arg("am") + .arg(patch) + .arg("-q") + .current_dir(target_dir); spawn_and_wait(apply_patch_cmd); } }