From e0708cba8d8b95f961534bdd2d605cdda78dbb6c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 1 Jun 2021 23:34:32 +0200 Subject: fix(3p/josh): Temporarily patch instances of master->canon ... until hardcoded references are removed upstream. This is motivated by HEAD-branch related issues when cloning depot via josh and a naive search for places where `master` was used directly. Change-Id: I46709631d6ee5561344fc5f407324bcf69c641e2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3171 Tested-by: BuildkiteCI Reviewed-by: cschilling Reviewed-by: sterni --- ...001-replace-mentions-of-master-with-canon.patch | 47 ++++++++++++++++++++++ third_party/josh/default.nix | 4 ++ 2 files changed, 51 insertions(+) create mode 100644 third_party/josh/0001-replace-mentions-of-master-with-canon.patch (limited to 'third_party') diff --git a/third_party/josh/0001-replace-mentions-of-master-with-canon.patch b/third_party/josh/0001-replace-mentions-of-master-with-canon.patch new file mode 100644 index 000000000000..6e9a8028f22a --- /dev/null +++ b/third_party/josh/0001-replace-mentions-of-master-with-canon.patch @@ -0,0 +1,47 @@ +From 4245dbdcacc3a4d4801a50071ba84379be4e1d2e Mon Sep 17 00:00:00 2001 +From: Vincent Ambo +Date: Tue, 1 Jun 2021 23:27:30 +0200 +Subject: [PATCH] replace mentions of 'master' with 'canon' + +While there are areas of josh that hardcode `master`, we can override +this to make it work for the TVL use-case. +--- + josh-proxy/src/bin/josh-proxy.rs | 2 +- + src/housekeeping.rs | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/josh-proxy/src/bin/josh-proxy.rs b/josh-proxy/src/bin/josh-proxy.rs +index 6f15566..76f4a5d 100644 +--- a/josh-proxy/src/bin/josh-proxy.rs ++++ b/josh-proxy/src/bin/josh-proxy.rs +@@ -374,7 +374,7 @@ async fn call_service( + + let mut headref = parsed_url.headref.trim_start_matches("@").to_owned(); + if headref == "" { +- headref = "refs/heads/master".to_string(); ++ headref = "refs/heads/canon".to_string(); + } + + let remote_url = [ +diff --git a/src/housekeeping.rs b/src/housekeeping.rs +index 5d08f81..1d55bc4 100644 +--- a/src/housekeeping.rs ++++ b/src/housekeeping.rs +@@ -44,12 +44,12 @@ pub fn memorize_from_to( + ) -> Vec<(String, String)> { + let mut refs = vec![]; + let glob = format!( +- "refs/josh/upstream/{}/refs/heads/master", ++ "refs/josh/upstream/{}/refs/heads/canon", + &to_ns(upstream_repo) + ); + for refname in repo.references_glob(&glob).unwrap().names() { + let refname = refname.unwrap(); +- let to_ref = format!("refs/{}/heads/master", &namespace); ++ let to_ref = format!("refs/{}/heads/canon", &namespace); + + refs.push((refname.to_owned(), to_ref.clone())); + } +-- +2.31.1 + diff --git a/third_party/josh/default.nix b/third_party/josh/default.nix index 2b6cff582c90..6c49809b51a2 100644 --- a/third_party/josh/default.nix +++ b/third_party/josh/default.nix @@ -22,4 +22,8 @@ in depot.third_party.naersk.buildPackage { "-p" "josh-proxy" "-p" "josh-ui" ]; + + overrideMain = x: { + patches = [ ./0001-replace-mentions-of-master-with-canon.patch ]; + }; } -- cgit 1.4.1