about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-11 22:58:30 +0200
committerGitHub <noreply@github.com>2025-06-11 22:58:30 +0200
commitc97dca69897a656895141ca708a4ed64c26fb304 (patch)
tree3ef95b1ce6ab65c16108803ae33c4dc975adfc6e
parentf417620160990a9a3fd943b834045e37e99e9a4a (diff)
parent87b068ccb7d36e494a1cb4cfd104bf782eeac088 (diff)
downloadrust-c97dca69897a656895141ca708a4ed64c26fb304.tar.gz
rust-c97dca69897a656895141ca708a4ed64c26fb304.zip
Rollup merge of #142374 - Kobzol:fix-newline, r=tmiasko
Fix missing newline trim in bootstrap

Fixes [this comment](https://github.com/rust-lang/rust/pull/141909/files#r2140632918).

Fixes: https://github.com/rust-lang/rust/issues/142350
-rw-r--r--src/bootstrap/src/core/config/config.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 8f3c95ab5bf..860aa120326 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -1389,7 +1389,8 @@ impl Config {
                 // If there is a tag named after the current branch, git will try to disambiguate by prepending `heads/` to the branch name.
                 // This syntax isn't accepted by `branch.{branch}`. Strip it.
                 let branch = current_branch.stdout();
-                let branch = branch.strip_prefix("heads/").unwrap_or(&branch);
+                let branch = branch.trim();
+                let branch = branch.strip_prefix("heads/").unwrap_or(branch);
                 git.arg("-c").arg(format!("branch.{branch}.remote=origin"));
             }
             git.args(["submodule", "update", "--init", "--recursive", "--depth=1"]);