From ade86d29f887bc60cca5b05635feac63b68243f0 Mon Sep 17 00:00:00 2001 From: Vlad Ivanov Date: Fri, 5 Apr 2024 13:24:13 +0200 Subject: [PATCH] Support push + force push over SSH (#1323) * Support receive-pack over SSH * Improve tracing in push routines * Improve error propagation between hooks and proxy * Improve push option handling: use predefined struct * Add `force` push option commit-id:2dbf5e93 --- josh-proxy/src/bin/josh-proxy.rs | 243 +++++++++++------- josh-proxy/src/lib.rs | 150 +++++++---- josh-proxy/src/trace.rs | 17 ++ run-josh.sh | 6 +- run-tests.sh | 1 - tests/proxy/amend_patchset.t | 16 +- tests/proxy/authentication.t | 8 +- tests/proxy/caching.t | 16 +- tests/proxy/push_new_branch.t | 56 +++- tests/proxy/push_prefix.t | 8 +- tests/proxy/push_review.t | 16 +- tests/proxy/push_review_already_in.t | 8 +- tests/proxy/push_review_nop_behind.t | 8 +- tests/proxy/push_review_old.t | 8 +- tests/proxy/push_review_topic.t | 8 +- tests/proxy/push_stacked.t | 32 +-- tests/proxy/push_stacked_gerrit.t | 32 +-- tests/proxy/push_stacked_split.t | 8 +- tests/proxy/push_stacked_sub.t | 32 +-- tests/proxy/push_subtree.t | 24 +- tests/proxy/push_subtree_two_repos.t | 16 +- tests/proxy/ssh.t | 77 ++++++ tests/proxy/unrelated_leak.t | 16 +- tests/proxy/workspace.t | 8 +- tests/proxy/workspace_create.t | 24 +- tests/proxy/workspace_edit_commit.t | 16 +- tests/proxy/workspace_errors.t | 24 +- tests/proxy/workspace_in_workspace.t | 24 +- tests/proxy/workspace_in_workspace_prefix.t | 24 +- .../proxy/workspace_invalid_trailing_slash.t | 16 +- tests/proxy/workspace_modify.t | 24 +- .../workspace_modify_chain_prefix_subtree.t | 16 +- tests/proxy/workspace_mv_folder.t | 16 +- tests/proxy/workspace_tags.t | 24 +- 34 files changed, 626 insertions(+), 396 deletions(-) create mode 100644 josh-proxy/src/trace.rs diff --git a/josh-proxy/src/bin/josh-proxy.rs b/josh-proxy/src/bin/josh-proxy.rs index c290cb588..57f326147 100644 --- a/josh-proxy/src/bin/josh-proxy.rs +++ b/josh-proxy/src/bin/josh-proxy.rs @@ -22,9 +22,10 @@ use josh::{josh_error, JoshError, JoshResult}; use josh_rpc::calls::RequestedCommand; use serde::Serialize; use std::collections::HashMap; +use std::ffi::OsStr; use std::io; use std::net::IpAddr; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::process::Stdio; use std::str::FromStr; use std::sync::{Arc, RwLock}; @@ -729,14 +730,15 @@ async fn serve_namespace( params: &josh_rpc::calls::ServeNamespace, repo_path: std::path::PathBuf, namespace: &str, + repo_update: RepoUpdate, ) -> josh::JoshResult<()> { const SERVE_TIMEOUT: u64 = 60; tracing::trace!( - "serve_namespace: command: {:?}, query: {}, namespace: {}", - params.command, - params.query, - namespace + command = ?params.command, + query = %params.query, + namespace = %namespace, + "serve_namespace", ); enum ServeError { @@ -746,25 +748,24 @@ async fn serve_namespace( SubprocessExited(i32), } - if params.command == RequestedCommand::GitReceivePack { - return Err(josh_error("Push over SSH is not supported")); - } - let command = match params.command { RequestedCommand::GitUploadPack => "git-upload-pack", RequestedCommand::GitUploadArchive => "git-upload-archive", RequestedCommand::GitReceivePack => "git-receive-pack", }; + let overlay_path = repo_path.join("overlay"); + let mut process = tokio::process::Command::new(command) - .arg(repo_path.join("overlay")) - .current_dir(repo_path.join("overlay")) + .arg(&overlay_path) + .current_dir(&overlay_path) .env("GIT_DIR", &repo_path) .env("GIT_NAMESPACE", namespace) .env( "GIT_ALTERNATE_OBJECT_DIRECTORIES", repo_path.join("mirror").join("objects"), ) + .env("JOSH_REPO_UPDATE", serde_json::to_string(&repo_update)?) .stdin(Stdio::piped()) .stdout(Stdio::piped()) .spawn()?; @@ -912,6 +913,31 @@ fn head_ref_or_default(head_ref: &str) -> HeadRef { } } +fn make_repo_update( + remote_url: &str, + serv: Arc, + filter: josh::filter::Filter, + remote_auth: RemoteAuth, + meta: &MetaConfig, + repo_path: &Path, + ns: Arc, +) -> RepoUpdate { + let context_propagator = josh_proxy::trace::make_context_propagator(); + + RepoUpdate { + refs: HashMap::new(), + remote_url: remote_url.to_string(), + remote_auth, + port: serv.port.clone(), + filter_spec: josh::filter::spec(filter), + base_ns: josh::to_ns(&meta.config.repo), + git_ns: ns.name().to_string(), + git_dir: repo_path.display().to_string(), + mirror_git_dir: serv.repo_path.join("mirror").display().to_string(), + context_propagator, + } +} + async fn handle_serve_namespace_request( serv: Arc, req: Request, @@ -958,6 +984,9 @@ async fn handle_serve_namespace_request( )); }; + eprintln!("params: {:?}", params); + eprintln!("parsed_url.upstream_repo: {:?}", parsed_url.upstream_repo); + let auth_socket = params.ssh_socket.clone(); let remote_auth = RemoteAuth::Ssh { auth_socket: auth_socket.clone(), @@ -1000,24 +1029,34 @@ async fn handle_serve_namespace_request( let remote_url = upstream + meta_config.config.repo.as_str(); let head_ref = head_ref_or_default(&parsed_url.headref); - let remote_refs = [head_ref.get()]; - let remote_refs = match ssh_list_refs(&remote_url, auth_socket, Some(&remote_refs)).await { - Ok(remote_refs) => remote_refs, - Err(e) => { - return Ok(make_response( - hyper::Body::from(e.to_string()), - hyper::StatusCode::FORBIDDEN, - )) - } - }; + let resolved_ref = match params.command { + // When pushing over SSH, we need to fetch to get new references + // for searching for unapply base, so we don't bother with additional cache checks + RequestedCommand::GitReceivePack => None, + // Otherwise, list refs - it doesn't need locking and is faster - + // and use results to potentially skip fetching + _ => { + let remote_refs = [head_ref.get()]; + let remote_refs = + match ssh_list_refs(&remote_url, auth_socket, Some(&remote_refs)).await { + Ok(remote_refs) => remote_refs, + Err(e) => { + return Ok(make_response( + hyper::Body::from(e.to_string()), + hyper::StatusCode::FORBIDDEN, + )) + } + }; - let resolved_ref = match remote_refs.get(head_ref.get()) { - Some(resolved_ref) => resolved_ref, - None => { - return Ok(make_response( - hyper::Body::from("Could not resolve remote ref"), - hyper::StatusCode::INTERNAL_SERVER_ERROR, - )) + match remote_refs.get(head_ref.get()) { + Some(resolved_ref) => Some(resolved_ref.clone()), + None => { + return Ok(make_response( + hyper::Body::from("Could not resolve remote ref"), + hyper::StatusCode::INTERNAL_SERVER_ERROR, + )) + } + } } }; @@ -1027,7 +1066,7 @@ async fn handle_serve_namespace_request( &remote_auth, remote_url.to_owned(), Some(head_ref.get()), - Some(resolved_ref), + resolved_ref.as_deref(), false, ) .await @@ -1095,7 +1134,19 @@ async fn handle_serve_namespace_request( } }; - let serve_result = serve_namespace(¶ms, serv.repo_path.clone(), temp_ns.name()).await; + let overlay_path = serv.repo_path.join("overlay"); + let repo_update = make_repo_update( + &remote_url, + serv.clone(), + filter, + remote_auth, + &meta_config, + &overlay_path, + temp_ns.clone(), + ); + + let serve_result = + serve_namespace(¶ms, serv.repo_path.clone(), temp_ns.name(), repo_update).await; std::mem::drop(temp_ns); match serve_result { @@ -1295,68 +1346,39 @@ async fn call_service( } let temp_ns = prepare_namespace(serv.clone(), &meta, filter, &headref).await?; + let overlay_path = serv.repo_path.join("overlay"); - let repo_path = serv - .repo_path - .join("overlay") - .to_str() - .ok_or(josh::josh_error("repo_path.to_str"))? - .to_string(); - - let mirror_repo_path = serv - .repo_path - .join("mirror") - .to_str() - .ok_or(josh::josh_error("repo_path.to_str"))? - .to_string(); - - let context_propagator = { - let span = tracing::Span::current(); - - let mut context_propagator = HashMap::::default(); - let context = span.context(); - global::get_text_map_propagator(|propagator| { - propagator.inject_context(&context, &mut context_propagator); - }); - - tracing::debug!("context propagator: {:?}", context_propagator); - context_propagator - }; - - let repo_update = josh_proxy::RepoUpdate { - refs: HashMap::new(), - remote_url: remote_url.clone(), + let repo_update = make_repo_update( + &remote_url, + serv.clone(), + filter, remote_auth, - port: serv.port.clone(), - filter_spec: josh::filter::spec(filter), - base_ns: josh::to_ns(&meta.config.repo), - git_ns: temp_ns.name().to_string(), - git_dir: repo_path.clone(), - mirror_git_dir: mirror_repo_path.clone(), - context_propagator, - }; + &meta, + &overlay_path, + temp_ns.clone(), + ); let cgi_response = async { let mut cmd = Command::new("git"); cmd.arg("http-backend"); - cmd.current_dir(&serv.repo_path.join("overlay")); - cmd.env("GIT_DIR", &repo_path); + cmd.current_dir(&overlay_path); + cmd.env("GIT_DIR", &overlay_path); cmd.env("GIT_HTTP_EXPORT_ALL", ""); cmd.env( "GIT_ALTERNATE_OBJECT_DIRECTORIES", serv.repo_path .join("mirror") .join("objects") - .to_str() - .ok_or(josh::josh_error("repo_path.to_str"))?, + .display() + .to_string(), ); cmd.env("GIT_NAMESPACE", temp_ns.name()); - cmd.env("GIT_PROJECT_ROOT", repo_path); + cmd.env("GIT_PROJECT_ROOT", &overlay_path); cmd.env("JOSH_REPO_UPDATE", serde_json::to_string(&repo_update)?); cmd.env("PATH_INFO", parsed_url.pathinfo.clone()); let (response, stderr) = hyper_cgi::do_cgi(req, cmd).await; - tracing::debug!("Git stderr: {}", String::from_utf8_lossy(&stderr)); + tracing::debug!(stderr = %String::from_utf8_lossy(&stderr), "http-backend exited"); Ok::<_, JoshError>(response) } @@ -1655,35 +1677,41 @@ async fn run_housekeeping(local: std::path::PathBuf) -> josh::JoshResult<()> { } } +fn repo_update_from_env() -> josh::JoshResult { + let repo_update = + std::env::var("JOSH_REPO_UPDATE").map_err(|_| josh_error("JOSH_REPO_UPDATE not set"))?; + + serde_json::from_str(&repo_update) + .map_err(|e| josh_error(&format!("Failed to parse JOSH_REPO_UPDATE: {}", e))) +} + fn pre_receive_hook() -> josh::JoshResult { - let repo_update: josh_proxy::RepoUpdate = - serde_json::from_str(&std::env::var("JOSH_REPO_UPDATE")?)?; + let repo_update = repo_update_from_env()?; - let p = std::path::PathBuf::from(repo_update.git_dir) + let push_options_path = std::path::PathBuf::from(repo_update.git_dir) .join("refs/namespaces") .join(repo_update.git_ns) .join("push_options"); - let n: usize = std::env::var("GIT_PUSH_OPTION_COUNT")?.parse()?; + let push_option_count: usize = std::env::var("GIT_PUSH_OPTION_COUNT")?.parse()?; - let mut push_options = std::collections::HashMap::::new(); - for i in 0..n { - let s = std::env::var(format!("GIT_PUSH_OPTION_{}", i))?; - if let [key, value] = s.as_str().split('=').collect::>().as_slice() { - push_options.insert(key.to_string(), value.to_string()); + let mut push_options = HashMap::::new(); + for i in 0..push_option_count { + let push_option = std::env::var(format!("GIT_PUSH_OPTION_{}", i))?; + if let Some((key, value)) = push_option.split_once("=") { + push_options.insert(key.into(), value.into()); } else { - push_options.insert(s, "".to_string()); + push_options.insert(push_option, true.into()); } } - std::fs::write(p, serde_json::to_string(&push_options)?)?; + std::fs::write(push_options_path, serde_json::to_string(&push_options)?)?; Ok(0) } fn update_hook(refname: &str, old: &str, new: &str) -> josh::JoshResult { - let mut repo_update: josh_proxy::RepoUpdate = - serde_json::from_str(&std::env::var("JOSH_REPO_UPDATE")?)?; + let mut repo_update = repo_update_from_env()?; repo_update .refs @@ -1696,24 +1724,33 @@ fn update_hook(refname: &str, old: &str, new: &str) -> josh::JoshResult { .send(); match resp { - Ok(r) => { - let success = r.status().is_success(); - if let Ok(body) = r.text() { - println!("response from upstream:\n{}\n\n", body); - } else { - println!("no upstream response"); + Ok(resp) => { + let success = resp.status().is_success(); + println!("upstream: response status: {}", resp.status()); + + match resp.text() { + Ok(text) if text.trim().is_empty() => { + println!("upstream: no response body"); + } + Ok(text) => { + println!("upstream: response body:\n\n{}", text); + } + Err(err) => { + println!("upstream: warn: failed to read response body: {:?}", err); + } } + if success { - return Ok(0); + Ok(0) } else { - return Ok(1); + Ok(1) } } Err(err) => { tracing::warn!("/repo_update request failed {:?}", err); + Ok(1) } - }; - Ok(1) + } } async fn serve_graphql( @@ -1949,8 +1986,16 @@ fn main() { if let [a0, ..] = &std::env::args().collect::>().as_slice() { if a0.ends_with("/pre-receive") { - println!("josh-proxy"); - std::process::exit(pre_receive_hook().unwrap_or(1)); + eprintln!("josh-proxy: pre-receive hook"); + let code = match pre_receive_hook() { + Ok(code) => code, + Err(e) => { + eprintln!("josh-proxy: pre-receive hook failed: {}", e); + std::process::exit(1); + } + }; + + std::process::exit(code); } } diff --git a/josh-proxy/src/lib.rs b/josh-proxy/src/lib.rs index d33917a31..ebe913043 100644 --- a/josh-proxy/src/lib.rs +++ b/josh-proxy/src/lib.rs @@ -1,6 +1,7 @@ pub mod auth; pub mod cli; pub mod juniper_hyper; +pub mod trace; #[macro_use] extern crate lazy_static; @@ -108,19 +109,44 @@ pub struct RepoUpdate { pub context_propagator: std::collections::HashMap, } +#[derive(serde::Serialize, serde::Deserialize, Debug)] +#[serde(default)] +pub struct PushOptions { + pub merge: bool, + pub create: bool, + pub force: bool, + pub base: Option, + pub author: Option, +} + +impl Default for PushOptions { + fn default() -> Self { + PushOptions { + merge: false, + create: false, + force: false, + base: None, + author: None, + } + } +} + pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult { - let p = std::path::PathBuf::from(&repo_update.git_dir) + let push_options_path = std::path::PathBuf::from(&repo_update.git_dir) .join("refs/namespaces") .join(&repo_update.git_ns) .join("push_options"); - let push_options_string = std::fs::read_to_string(p)?; - let push_options: std::collections::HashMap = - serde_json::from_str(&push_options_string)?; + let push_options = std::fs::read_to_string(push_options_path)?; + let push_options: PushOptions = serde_json::from_str(&push_options) + .map_err(|e| josh_error(&format!("Failed to parse push options: {}", e)))?; - for (refname, (old, new)) in repo_update.refs.iter() { - tracing::debug!("REPO_UPDATE env ok"); + tracing::debug!( + push_options = ?push_options, + "process_repo_update" + ); + for (refname, (old, new)) in repo_update.refs.iter() { let transaction = josh::cache::Transaction::open( std::path::Path::new(&repo_update.git_dir), Some(&format!("refs/josh/upstream/{}/", repo_update.base_ns)), @@ -141,28 +167,34 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult )?; let old = git2::Oid::from_str(old)?; - let (baseref, push_to, options, push_mode) = baseref_and_options(refname)?; - let josh_merge = push_options.contains_key("merge"); - - tracing::debug!("push options: {:?}", push_options); - tracing::debug!("josh-merge: {:?}", josh_merge); let old = if old == git2::Oid::zero() { let rev = format!("refs/namespaces/{}/{}", repo_update.git_ns, &baseref); - let oid = if let Ok(x) = transaction.repo().revparse_single(&rev) { - x.id() + let oid = if let Ok(resolved) = transaction.repo().revparse_single(&rev) { + resolved.id() } else { old }; - tracing::debug!("push: old oid: {:?}, rev: {:?}", oid, rev); + + tracing::debug!( + old_oid = ?oid, + rev = %rev, + "resolve_old" + ); + oid } else { - tracing::debug!("push: old oid: {:?}, refname: {:?}", old, refname); + tracing::debug!( + old_oid = ?old, + refname = %refname, + "resolve_old" + ); + old }; - let original_target_ref = if let Some(base) = push_options.get("base") { + let original_target_ref = if let Some(base) = &push_options.base { // Allow user to use just the branchname as the base: let full_path_base_refname = transaction_mirror.refname(&format!("refs/heads/{}", base)); @@ -173,7 +205,7 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult { full_path_base_refname } else { - transaction_mirror.refname(base) + transaction_mirror.refname(&base) } } else { transaction_mirror.refname(&baseref) @@ -184,12 +216,18 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult .refname_to_id(&original_target_ref) { tracing::debug!( - "push: original_target oid: {:?}, original_target_ref: {:?}", - oid, - original_target_ref + original_target_oid = ?oid, + original_target_ref = %original_target_ref, + "resolve_original_target" ); + oid } else { + tracing::debug!( + original_target_ref = %original_target_ref, + "resolve_original_target" + ); + return Err(josh::josh_error(&unindent::unindent(&format!( r###" Reference {:?} does not exist on remote. @@ -200,14 +238,14 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult )))); }; - let reparent_orphans = if push_options.contains_key("create") { + let reparent_orphans = if push_options.create { Some(original_target) } else { None }; - let author = if let Some(p) = push_options.get("author") { - p.to_string() + let author = if let Some(author) = &push_options.author { + author.to_string() } else { "".to_string() }; @@ -219,26 +257,30 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult None }; - let filterobj = josh::filter::parse(&repo_update.filter_spec)?; + let filter = josh::filter::parse(&repo_update.filter_spec)?; let new_oid = git2::Oid::from_str(new)?; let backward_new_oid = { - tracing::debug!("=== MORE"); - - tracing::debug!("=== processed_old {:?}", old); - - josh::history::unapply_filter( + let unapply_result = josh::history::unapply_filter( &transaction, - filterobj, + filter, original_target, old, new_oid, - josh_merge, + push_options.merge, reparent_orphans, &mut changes, - )? + )?; + + tracing::debug!( + processed_old = ?old, + unapply_result = ?unapply_result, + "unapply_filter" + ); + + unapply_result }; - let oid_to_push = if josh_merge { + let oid_to_push = if push_options.merge { let backward_commit = transaction.repo().find_commit(backward_new_oid)?; if let Ok(base_commit_id) = transaction_mirror .repo() @@ -301,6 +343,8 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult let mut resp = vec![]; for (reference, oid, display_name) in to_push { + let force_push = push_mode != PushMode::Normal || push_options.force; + let (text, status) = push_head_url( transaction.repo(), &format!("{}/objects", repo_update.mirror_git_dir), @@ -310,17 +354,17 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult &repo_update.remote_auth, &repo_update.git_ns, &display_name, - push_mode != PushMode::Normal, + force_push, )?; + if status != 0 { return Err(josh::josh_error(&text)); } resp.push(text.to_string()); - let mut warnings = josh::filter::compute_warnings( &transaction, - filterobj, + filter, transaction.repo().find_commit(oid)?.tree()?, ); @@ -331,7 +375,7 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult } let reapply = josh::filter::apply_to_commit( - filterobj, + filter, &transaction.repo().find_commit(oid_to_push)?, &transaction, )?; @@ -342,7 +386,7 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult &format!( "refs/josh/rewrites/{}/{:?}/r_{}", repo_update.base_ns, - filterobj.id(), + filter.id(), reapply ), reapply, @@ -350,8 +394,14 @@ pub fn process_repo_update(repo_update: RepoUpdate) -> josh::JoshResult "reapply", )?; } + + tracing::debug!( + new_oid = ?new_oid, + reapply = ?reapply, + "rewrite" + ); + let text = format!("REWRITE({} -> {})", new_oid, reapply); - tracing::debug!("{}", text); resp.push(text); } @@ -437,27 +487,29 @@ pub fn push_head_url( display_name: &str, force: bool, ) -> josh::JoshResult<(String, i32)> { - let rn = format!("refs/{}", &namespace); - - let spec = format!("{}:{}", &rn, &refname); + let push_temp_ref = format!("refs/{}", &namespace); + let push_refspec = format!("{}:{}", &push_temp_ref, &refname); let mut cmd = vec!["git", "push"]; if force { cmd.push("--force") } cmd.push(url); - cmd.push(&spec); + cmd.push(&push_refspec); - let mut fakehead = repo.reference(&rn, oid, true, "push_head_url")?; + let mut fake_head = repo.reference(&push_temp_ref, oid, true, "push_head_url")?; let (stdout, stderr, status) = run_git_with_auth(repo.path(), &cmd, remote_auth, Some(alternate.to_owned()))?; - fakehead.delete()?; - - tracing::debug!("{}", &stderr); - tracing::debug!("{}", &stdout); + fake_head.delete()?; - let stderr = stderr.replace(&rn, display_name); + tracing::debug!( + stdout = %stdout, + stderr = %stderr, + status = %status, + "push_head_url: run_git" + ); + let stderr = stderr.replace(&push_temp_ref, display_name); Ok((stderr, status)) } diff --git a/josh-proxy/src/trace.rs b/josh-proxy/src/trace.rs new file mode 100644 index 000000000..d06a044d8 --- /dev/null +++ b/josh-proxy/src/trace.rs @@ -0,0 +1,17 @@ +use opentelemetry::global; +use std::collections::HashMap; +use tracing::Span; +use tracing_opentelemetry::OpenTelemetrySpanExt; + +pub fn make_context_propagator() -> HashMap { + let span = Span::current(); + + let mut context_propagator = HashMap::::default(); + let context = span.context(); + global::get_text_map_propagator(|propagator| { + propagator.inject_context(&context, &mut context_propagator); + }); + + tracing::debug!("context propagator: {:?}", context_propagator); + context_propagator +} diff --git a/run-josh.sh b/run-josh.sh index cbe54f1d3..f75ce966c 100644 --- a/run-josh.sh +++ b/run-josh.sh @@ -1,3 +1,7 @@ #!/bin/bash -cd /josh/ + +cd /josh/ || exit 1 + +# shellcheck disable=SC2086 +# intended to pass along the arguments RUST_BACKTRACE=1 josh-proxy --gc --local=/data/git/ --remote="${JOSH_REMOTE}" ${JOSH_EXTRA_OPTS} diff --git a/run-tests.sh b/run-tests.sh index 0b4f1558c..0940439ef 100644 --- a/run-tests.sh +++ b/run-tests.sh @@ -22,7 +22,6 @@ CONFIG_FILE=$(mktemp) trap 'rm ${CONFIG_FILE}' EXIT export GIT_CONFIG_GLOBAL=${CONFIG_FILE} -#git config --global init.defaultBranch master cargo fmt python3 -m cram "$@" diff --git a/tests/proxy/amend_patchset.t b/tests/proxy/amend_patchset.t index e14a0178c..5b9132dd8 100644 --- a/tests/proxy/amend_patchset.t +++ b/tests/proxy/amend_patchset.t @@ -60,12 +60,12 @@ > EOF $ git push origin HEAD:refs/for/master 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/for/master - remote: - remote: To http://localhost:8002/real_repo.git * [new reference] HEAD -> refs/for/master @@ -92,12 +92,12 @@ $ git add . $ git commit --amend --no-edit -q $ git push origin HEAD:refs/for/master 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/for/master - remote: - remote: To http://localhost:8002/real_repo.git:/sub3.git * [new reference] HEAD -> refs/for/master diff --git a/tests/proxy/authentication.t b/tests/proxy/authentication.t index 369b32d34..c3a5bf8f6 100644 --- a/tests/proxy/authentication.t +++ b/tests/proxy/authentication.t @@ -87,12 +87,12 @@ 1 file changed, 1 insertion(+) create mode 100644 file2 $ git push - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: bb282e9..f23daa6 JOSH_PUSH -> master - remote: - remote: To http://localhost:8002/real_repo.git bb282e9..f23daa6 master -> master diff --git a/tests/proxy/caching.t b/tests/proxy/caching.t index 01c2d0d4e..198123dda 100644 --- a/tests/proxy/caching.t +++ b/tests/proxy/caching.t @@ -28,12 +28,12 @@ 1 file changed, 1 insertion(+) create mode 100644 file2 $ git push - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 5a29d3e..2e310c4 JOSH_PUSH -> master - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git eb6a311..bdc926c master -> master # funny but expected behaviour @@ -142,12 +142,12 @@ 1 file changed, 1 insertion(+) create mode 100644 file2 $ git push - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 5a29d3e..2e310c4 JOSH_PUSH -> master - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git eb6a311..bdc926c master -> master $ git fetch diff --git a/tests/proxy/push_new_branch.t b/tests/proxy/push_new_branch.t index 8e87e747c..ab543e541 100644 --- a/tests/proxy/push_new_branch.t +++ b/tests/proxy/push_new_branch.t @@ -48,12 +48,12 @@ Create a new branch and push it $ git switch -c new-branch Switched to a new branch 'new-branch' $ git push origin new-branch -o base=refs/heads/master 1> /dev/null - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new branch] JOSH_PUSH -> new-branch - remote: - remote: To http://localhost:8002/real_repo.git:/sub.git * [new branch] new-branch -> new-branch Check the branch pushed @@ -73,22 +73,39 @@ Add one more commit in the workspace and push using implicit prefix in base 1 file changed, 1 insertion(+) create mode 100644 test.txt $ git push origin new-branch -o base=master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 37c3f9a..56dc1f7 JOSH_PUSH -> new-branch - remote: - remote: To http://localhost:8002/real_repo.git:/sub.git 28d2085..751ef45 new-branch -> new-branch +One more commit and push, but without base option: josh should figure out the base itself + + $ cd ${TESTTMP}/sub + $ echo "without base" > test.txt + $ git add test.txt + $ git commit -q -m "test commit without base" + $ git push origin new-branch + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: + remote: To http://localhost:8001/real_repo.git + remote: 56dc1f7..281431e JOSH_PUSH -> new-branch + To http://localhost:8002/real_repo.git:/sub.git + 751ef45..f435f3f new-branch -> new-branch + Check the branch again $ cd ${TESTTMP}/real_repo $ git fetch From http://localhost:8001/real_repo - 37c3f9a..56dc1f7 new-branch -> origin/new-branch + 37c3f9a..281431e new-branch -> origin/new-branch $ [ "${SHA1}" = "$(git log --max-count=1 --skip=1 --format='%H' origin/new-branch)" ] || echo "SHA1 differs after push!" + SHA1 differs after push! $ bash ${TESTDIR}/destroy_test_env.sh "real_repo.git" = [ @@ -116,14 +133,22 @@ Check the branch again | | | `-- c3f9a18f21fe53e0be9ea657220ba4537dbca7 | | |-- 3d | | | `-- 77ff51363c9825cc2a221fc0ba5a883a1a2c72 + | | |-- 49 + | | | `-- b12216dab2cefdb1cc0fcda7ab6bc9f8b882ab + | | |-- 56 + | | | `-- dc1f749ea31f735f981a42bc6c23e92baf2085 | | |-- 5f | | | `-- 2752aa0d3b643a6e95d754c3fd272318a02434 | | |-- 6b | | | `-- 46faacade805991bcaea19382c9d941828ce80 + | | |-- 9d + | | | `-- aeafb9864cf43055ae93beb0afd6c7d144bfa4 | | |-- a0 | | | `-- 24003ee1acc6bf70318a46e7b6df651b9dc246 | | |-- ae | | | `-- a557394ce29f000108607abd97f19fed4d1b7c + | | |-- b5 + | | | `-- afbb444fd22857e78ee11ddd92b7dd2f5c7d11 | | |-- info | | `-- pack | `-- refs @@ -145,6 +170,7 @@ Check the branch again | `-- exclude |-- objects | |-- 28 + | | |-- 1431e1f2eaff44142f2c0512c06716b6ebd6d6 | | `-- d20855c7b65b5a9948283516ae62739360544d | |-- 49 | | `-- b12216dab2cefdb1cc0fcda7ab6bc9f8b882ab @@ -152,14 +178,24 @@ Check the branch again | | `-- dc1f749ea31f735f981a42bc6c23e92baf2085 | |-- 75 | | `-- 1ef4576e133fc6279ccf882cb812a9b4dcf5dd + | |-- 84 + | | `-- f7637c03dc38d6d22461003f6b9c65f6fdb4d3 | |-- 9d | | `-- aeafb9864cf43055ae93beb0afd6c7d144bfa4 | |-- a5 | | `-- 5a119d24890de3a3e470f941217479629e50c6 + | |-- ab + | | `-- 26032e5a4ef35d64849e0af272ceb4b27948bf | |-- b5 | | `-- afbb444fd22857e78ee11ddd92b7dd2f5c7d11 | |-- de | | `-- 7cba2eb70af5ce3555c3670e7641f2f547db74 + | |-- e5 + | | `-- 28cb6fde9d30fd62f42484c291bd1799245888 + | |-- ef + | | `-- 5ab66c07ba7c211e2a3d30bc9b6e4d5b6909fe + | |-- f4 + | | `-- 35f3fecaba02ae9cc9d462b1bd0d396fdf352f | |-- info | `-- pack `-- refs @@ -167,4 +203,4 @@ Check the branch again |-- namespaces `-- tags - 42 directories, 29 files + 51 directories, 39 files diff --git a/tests/proxy/push_prefix.t b/tests/proxy/push_prefix.t index e3d901143..b82b4aeb2 100644 --- a/tests/proxy/push_prefix.t +++ b/tests/proxy/push_prefix.t @@ -22,12 +22,12 @@ $ git add . $ git commit -m "add file2" 1> /dev/null $ git push - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: bb282e9..b7cf821 JOSH_PUSH -> master - remote: - remote: To http://localhost:8002/real_repo.git:prefix=pre.git 1f0b9d8..f99a2dd master -> master diff --git a/tests/proxy/push_review.t b/tests/proxy/push_review.t index f9c3923a8..9af9ccf95 100644 --- a/tests/proxy/push_review.t +++ b/tests/proxy/push_review.t @@ -22,21 +22,21 @@ $ git add file2 $ git commit -m "add file2" 1> /dev/null $ git push origin master:refs/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/for/master - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git * [new reference] master -> refs/for/master $ git push origin master:refs/drafts/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/drafts/master - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git * [new reference] master -> refs/drafts/master diff --git a/tests/proxy/push_review_already_in.t b/tests/proxy/push_review_already_in.t index af5a3b3af..213c49100 100644 --- a/tests/proxy/push_review_already_in.t +++ b/tests/proxy/push_review_already_in.t @@ -26,12 +26,12 @@ test for that. $ git clone -q http://localhost:8002/real_repo.git vrepo $ cd ${TESTTMP}/vrepo $ git push origin master:refs/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/for/master - remote: - remote: To http://localhost:8002/real_repo.git * [new reference] master -> refs/for/master diff --git a/tests/proxy/push_review_nop_behind.t b/tests/proxy/push_review_nop_behind.t index 0b0ccf3a2..ce425f7e5 100644 --- a/tests/proxy/push_review_nop_behind.t +++ b/tests/proxy/push_review_nop_behind.t @@ -33,12 +33,12 @@ This is a regression test for that problem. $ git commit -m "add file3" 1> /dev/null $ git push origin HEAD:refs/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/for/master - remote: - remote: To http://localhost:8002/real_repo.git * [new reference] HEAD -> refs/for/master diff --git a/tests/proxy/push_review_old.t b/tests/proxy/push_review_old.t index 1e6c77f13..e29410cd8 100644 --- a/tests/proxy/push_review_old.t +++ b/tests/proxy/push_review_old.t @@ -32,12 +32,12 @@ Flushed credential cache * add file3 * add file1 $ git push origin master:refs/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/for/master - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git * [new reference] master -> refs/for/master diff --git a/tests/proxy/push_review_topic.t b/tests/proxy/push_review_topic.t index e35f4c350..6c6d85cc6 100644 --- a/tests/proxy/push_review_topic.t +++ b/tests/proxy/push_review_topic.t @@ -22,12 +22,12 @@ $ git add file2 $ git commit -m "add file2" 1> /dev/null $ git push origin master:refs/for/master%topic=mytopic - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/for/master%topic=mytopic - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git * [new reference] master -> refs/for/master%topic=mytopic diff --git a/tests/proxy/push_stacked.t b/tests/proxy/push_stacked.t index c7fa0db82..c96ad72dd 100644 --- a/tests/proxy/push_stacked.t +++ b/tests/proxy/push_stacked.t @@ -30,48 +30,48 @@ * Change-Id: 1234 * add file1 (origin/master, origin/HEAD) $ git push -o author=foo@example.com origin master:refs/stack/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new branch] master -> @heads/master/foo@example.com - remote: - remote: To http://localhost:8002/real_repo.git * [new reference] master -> refs/stack/for/master $ git push -o author=josh@example.com origin master:refs/stack/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new branch] 1234 -> @changes/master/josh@example.com/1234 remote: To http://localhost:8001/real_repo.git remote: * [new branch] foo7 -> @changes/master/josh@example.com/foo7 remote: To http://localhost:8001/real_repo.git remote: * [new branch] master -> @heads/master/josh@example.com - remote: - remote: To http://localhost:8002/real_repo.git * [new reference] master -> refs/stack/for/master $ echo contents2 > file3 $ git add file3 $ git commit -m "add file3" 1> /dev/null $ git push -o author=josh@example.com origin master:refs/stack/for/master - remote: josh-proxy - remote: response from upstream: - remote: rejecting to push 3ad32b3bd3bb778441e7eae43930d8dc6293eddc without id - remote: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 500 Internal Server Error + remote: upstream: response body: remote: + remote: rejecting to push 3ad32b3bd3bb778441e7eae43930d8dc6293eddc without id remote: error: hook declined to update refs/stack/for/master To http://localhost:8002/real_repo.git ! [remote rejected] master -> refs/stack/for/master (hook declined) error: failed to push some refs to 'http://localhost:8002/real_repo.git' [1] $ git push -o author=foo@example.com origin master:refs/stack/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: ec41aad..3ad32b3 master -> @heads/master/foo@example.com - remote: - remote: To http://localhost:8002/real_repo.git * [new reference] master -> refs/stack/for/master diff --git a/tests/proxy/push_stacked_gerrit.t b/tests/proxy/push_stacked_gerrit.t index 4ccd2b192..6cfdc7fa9 100644 --- a/tests/proxy/push_stacked_gerrit.t +++ b/tests/proxy/push_stacked_gerrit.t @@ -30,22 +30,24 @@ * Change-Id: 1234 * add file1 (origin/master, origin/HEAD) $ git push -o author=foo@example.com origin master:refs/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/for/master remote: To http://localhost:8001/real_repo.git remote: * [new branch] master -> @heads/master/foo@example.com - remote: - remote: To http://localhost:8002/real_repo.git * [new reference] master -> refs/for/master $ git push http://localhost:8001/real_repo.git :refs/for/master To http://localhost:8001/real_repo.git - [deleted] refs/for/master $ git push -o author=josh@example.com origin master:refs/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new branch] 1234 -> @changes/master/josh@example.com/1234 remote: To http://localhost:8001/real_repo.git @@ -54,19 +56,17 @@ remote: * [new reference] JOSH_PUSH -> refs/for/master remote: To http://localhost:8001/real_repo.git remote: * [new branch] master -> @heads/master/josh@example.com - remote: - remote: To http://localhost:8002/real_repo.git * [new reference] master -> refs/for/master $ echo contents2 > file3 $ git add file3 $ git commit -m "add file3" 1> /dev/null $ git push -o author=josh@example.com origin master:refs/for/master - remote: josh-proxy - remote: response from upstream: - remote: rejecting to push 3ad32b3bd3bb778441e7eae43930d8dc6293eddc without id - remote: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 500 Internal Server Error + remote: upstream: response body: remote: + remote: rejecting to push 3ad32b3bd3bb778441e7eae43930d8dc6293eddc without id remote: error: hook declined to update refs/for/master To http://localhost:8002/real_repo.git ! [remote rejected] master -> refs/for/master (hook declined) @@ -76,14 +76,14 @@ To http://localhost:8001/real_repo.git - [deleted] refs/for/master $ git push -o author=foo@example.com origin master:refs/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/for/master remote: To http://localhost:8001/real_repo.git remote: ec41aad..3ad32b3 master -> @heads/master/foo@example.com - remote: - remote: To http://localhost:8002/real_repo.git * [new reference] master -> refs/for/master diff --git a/tests/proxy/push_stacked_split.t b/tests/proxy/push_stacked_split.t index 36fb385c9..089d5a2da 100644 --- a/tests/proxy/push_stacked_split.t +++ b/tests/proxy/push_stacked_split.t @@ -34,8 +34,10 @@ * Change-Id: 1234 * add file1 (origin/master, origin/HEAD) $ git push -o split -o author=josh@example.com origin master:refs/split/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new branch] 1234 -> @changes/master/josh@example.com/1234 remote: To http://localhost:8001/real_repo.git @@ -44,8 +46,6 @@ remote: * [new branch] 1235 -> @changes/master/josh@example.com/1235 remote: To http://localhost:8001/real_repo.git remote: * [new branch] master -> @heads/master/josh@example.com - remote: - remote: To http://localhost:8002/real_repo.git * [new reference] master -> refs/split/for/master diff --git a/tests/proxy/push_stacked_sub.t b/tests/proxy/push_stacked_sub.t index 02deb66bf..a7d50bb18 100644 --- a/tests/proxy/push_stacked_sub.t +++ b/tests/proxy/push_stacked_sub.t @@ -29,54 +29,54 @@ * Change-Id: 1234 * add file1 (origin/master, origin/HEAD) $ git push -o author=josh@example.com origin master:refs/stack/for/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new branch] 1234 -> @changes/master/josh@example.com/1234 remote: To http://localhost:8001/real_repo.git remote: * [new branch] foo7 -> @changes/master/josh@example.com/foo7 remote: To http://localhost:8001/real_repo.git remote: * [new branch] master -> @heads/master/josh@example.com - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git * [new reference] master -> refs/stack/for/master $ git push -o author=josh@example.com origin master:refs/stack/for/other_branch - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 500 Internal Server Error + remote: upstream: response body: + remote: remote: Reference "refs/heads/other_branch" does not exist on remote. remote: If you want to create it, pass "-o base=" or "-o base=path/to/ref" remote: to specify a base branch/reference. remote: - remote: - remote: remote: error: hook declined to update refs/stack/for/other_branch To http://localhost:8002/real_repo.git:/sub1.git ! [remote rejected] master -> refs/stack/for/other_branch (hook declined) error: failed to push some refs to 'http://localhost:8002/real_repo.git:/sub1.git' [1] $ git push -o base=master -o author=josh@example.com origin master:refs/stack/for/other_branch - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new branch] 1234 -> @changes/other_branch/josh@example.com/1234 remote: To http://localhost:8001/real_repo.git remote: * [new branch] foo7 -> @changes/other_branch/josh@example.com/foo7 remote: To http://localhost:8001/real_repo.git remote: * [new branch] other_branch -> @heads/other_branch/josh@example.com - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git * [new reference] master -> refs/stack/for/other_branch $ echo contents2 > file3 $ git add file3 $ git commit -m "add file3" 1> /dev/null $ git push -o author=josh@example.com origin master:refs/stack/for/master - remote: josh-proxy - remote: response from upstream: - remote: rejecting to push a3065162ecee0fecc977ec04a275e10b5e15a39c without id - remote: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 500 Internal Server Error + remote: upstream: response body: remote: + remote: rejecting to push a3065162ecee0fecc977ec04a275e10b5e15a39c without id remote: error: hook declined to update refs/stack/for/master To http://localhost:8002/real_repo.git:/sub1.git ! [remote rejected] master -> refs/stack/for/master (hook declined) diff --git a/tests/proxy/push_subtree.t b/tests/proxy/push_subtree.t index a16d25674..70faaa30c 100644 --- a/tests/proxy/push_subtree.t +++ b/tests/proxy/push_subtree.t @@ -22,38 +22,38 @@ $ git add file2 $ git commit -m "add file2" 1> /dev/null $ git push origin HEAD:refs/heads/new_branch 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 500 Internal Server Error + remote: upstream: response body: + remote: remote: Reference "refs/heads/new_branch" does not exist on remote. remote: If you want to create it, pass "-o base=" or "-o base=path/to/ref" remote: to specify a base branch/reference. remote: - remote: - remote: remote: error: hook declined to update refs/heads/new_branch To http://localhost:8002/real_repo.git:/sub1.git ! [remote rejected] HEAD -> new_branch (hook declined) error: failed to push some refs to 'http://localhost:8002/real_repo.git:/sub1.git' $ git push -o base=refs/heads/master origin HEAD:refs/heads/new_branch 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new branch] JOSH_PUSH -> new_branch - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git * [new branch] HEAD -> new_branch $ curl -s http://localhost:8002/flush Flushed credential cache $ git push - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: bb282e9..81b10fb JOSH_PUSH -> master - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git 0b4cf6c..d8388f5 master -> master diff --git a/tests/proxy/push_subtree_two_repos.t b/tests/proxy/push_subtree_two_repos.t index a149f39f9..367d5d691 100644 --- a/tests/proxy/push_subtree_two_repos.t +++ b/tests/proxy/push_subtree_two_repos.t @@ -31,12 +31,12 @@ $ git add file2 $ git commit -m "add file2" 1> /dev/null $ git push 1> /dev/null - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: bb282e9..81b10fb JOSH_PUSH -> master - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git 0b4cf6c..d8388f5 master -> master @@ -56,12 +56,12 @@ Put a double slash in the URL to see that it also works $ git add file2 $ git commit -m "add file2" 1> /dev/null $ git push 1> /dev/null - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real/repo2.git remote: bcd5520..dcd1fcd JOSH_PUSH -> master - remote: - remote: To http://localhost:8002/real/repo2.git:/sub1.git e31c696..5c1144a master -> master diff --git a/tests/proxy/ssh.t b/tests/proxy/ssh.t index 6b022f81f..5f732f110 100644 --- a/tests/proxy/ssh.t +++ b/tests/proxy/ssh.t @@ -45,5 +45,82 @@ Clone from josh (with filter) $ git clone -q ssh://git@127.0.0.1:9001/$(pwd)/repo1-bare.git':[:/subdir].git' repo1-clone-josh2 $ ls repo1-clone-josh2 test2 + $ cat repo1-clone-josh2/test2 + test + +Change contents on main branch + + $ echo "changed data on main" > repo1-clone-josh2/test2 + $ git -C repo1-clone-josh2 add test2 + $ git -C repo1-clone-josh2 commit -q -m "changed data on main" + +Push over josh + ssh + + $ git -C repo1-clone-josh2 push origin master + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: + remote: To * (glob) + remote: 19f34e8..44c0713 JOSH_PUSH -> master + To * (glob) + f1a7421..44acd5a master -> master + +Check pushed contents on upstream + + $ git -C repo1-bare.git show refs/heads/master:subdir/test2 + changed data on main + +Create a new branch from master + + $ git -C repo1-clone-josh2 switch -q -c new-branch + $ echo "changed data on new-branch" > repo1-clone-josh2/test2 + $ git -C repo1-clone-josh2 add test2 + $ git -C repo1-clone-josh2 commit -q -m "changed data on new-branch" + $ git -C repo1-clone-josh2 push -q origin new-branch -o base=master + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: + remote: To */repo1-bare.git* (glob) + remote: * [new branch] JOSH_PUSH -> new-branch + +Check history of the new branch + + $ git -C repo1-bare.git log --oneline --graph refs/heads/new-branch + * 070bb54 changed data on new-branch + * 44c0713 changed data on main + * 19f34e8 test + +Push again: shouldn't need base option anymore + + $ echo "again for push without base" > repo1-clone-josh2/test2 + $ git -C repo1-clone-josh2 add test2 + $ git -C repo1-clone-josh2 commit -q -m "again for push without base" + $ git -C repo1-clone-josh2 push origin new-branch + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: + remote: To */repo1-bare.git* (glob) + remote: 070bb54..6ab23f4 JOSH_PUSH -> new-branch + To */repo1-bare.git:[:/subdir].git (glob) + f4efcfa..bbabdd5 new-branch -> new-branch + +Amend a commit and force push from the new branch + + $ echo "changed data to prepare for force-push" > repo1-clone-josh2/test2 + $ git -C repo1-clone-josh2 add test2 + $ git -C repo1-clone-josh2 commit -q --amend --no-edit + $ git -C repo1-clone-josh2 push -q origin new-branch -f -o base=master -o force + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: + remote: To */repo1-bare.git* (glob) + remote: + 6ab23f4...29f0344 JOSH_PUSH -> new-branch (forced update) + remote: REWRITE(7e66aa3858a63747a5ee43619505b739022d1c9c -> 2770d6208c0575bf5a4769bac0040a68335f1284) + +Kill ssh-agent $ kill ${SSH_AGENT_PID} diff --git a/tests/proxy/unrelated_leak.t b/tests/proxy/unrelated_leak.t index c512ea084..4954abde3 100644 --- a/tests/proxy/unrelated_leak.t +++ b/tests/proxy/unrelated_leak.t @@ -46,22 +46,22 @@ Flushed credential cache $ git add . $ git commit -m "edit file4" 1> /dev/null $ git push -o base=refs/heads/master origin master:refs/heads/from_filtered 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new branch] JOSH_PUSH -> from_filtered - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git * [new branch] master -> from_filtered $ git push origin master:refs/heads/master 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: db0fd21..e170e96 JOSH_PUSH -> master - remote: - remote: To http://localhost:8002/real_repo.git:/sub1.git 0b4cf6c..da0d1f3 master -> master diff --git a/tests/proxy/workspace.t b/tests/proxy/workspace.t index c846afadc..9cd33d984 100644 --- a/tests/proxy/workspace.t +++ b/tests/proxy/workspace.t @@ -136,13 +136,13 @@ $ git commit -m "add in filter" 1> /dev/null $ git push 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: dc5f7e8..bb76696 JOSH_PUSH -> master remote: REWRITE(b176252014d4a10d3ec078667ecf45dd9a140951 -> fa3b9622c1bcc8363c27d4eb05d1ae8dae15e871) - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws.git be06ec3..b176252 master -> master diff --git a/tests/proxy/workspace_create.t b/tests/proxy/workspace_create.t index 9fbc681de..99c065fb6 100644 --- a/tests/proxy/workspace_create.t +++ b/tests/proxy/workspace_create.t @@ -75,13 +75,13 @@ Flushed credential cache HEAD is now at 003a297 add workspace Pushing to http://localhost:8002/real_repo.git:workspace=ws.git POST git-receive-pack (440 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 5d605ce..82678b3 JOSH_PUSH -> master remote: REWRITE(1b46698f32d1d1db1eaeb34f8c9037778d65f3a9 -> 003a2970e4c23b64f915025e9adc2e6ed04bc63a) - remote: - remote: updating local tracking ref 'refs/remotes/origin/master' @@ -248,13 +248,13 @@ Flushed credential cache HEAD is now at 2a6aa2a add in filter Pushing to http://localhost:8002/real_repo.git:workspace=ws.git POST git-receive-pack (808 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: f021d4b..a1a7760 JOSH_PUSH -> master remote: REWRITE(d681a08f543313f2a8bd86fab920e2271d0403d1 -> 2a6aa2a100b34d0d56e4b5f19e9bfdc2cd6f7d54) - remote: - remote: updating local tracking ref 'refs/remotes/origin/master' @@ -275,13 +275,13 @@ Flushed credential cache HEAD is now at 60bd0e1 try to modify ws Pushing to http://localhost:8002/real_repo.git:workspace=ws.git POST git-receive-pack (466 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: a1a7760..108eb9a JOSH_PUSH -> master remote: REWRITE(b8012aab20a6c6a0c2dc3b428d3578aadc9c527f -> 60bd0e180735e169b5c853545d8b1272ed0fc319) - remote: - remote: updating local tracking ref 'refs/remotes/origin/master' diff --git a/tests/proxy/workspace_edit_commit.t b/tests/proxy/workspace_edit_commit.t index 5b7155c91..c683475df 100644 --- a/tests/proxy/workspace_edit_commit.t +++ b/tests/proxy/workspace_edit_commit.t @@ -124,13 +124,13 @@ 1 file changed, 1 insertion(+) $ git push origin HEAD:refs/for/master 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/for/master remote: REWRITE(e63efb2615e1c17f0d0b6e610da85da09438cd29 -> 9bd58f891b4f17736c1b51903837de717fce13a5) - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws.git * [new reference] HEAD -> refs/for/master @@ -158,13 +158,13 @@ > EOF $ git push origin HEAD:refs/for/master 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new reference] JOSH_PUSH -> refs/for/master remote: REWRITE(5645805dcc75cfe4922b9cb301c40a4a4b35a59d -> 9a28fa82a736714d831348bbf62b951be65331b7) - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws.git * [new reference] HEAD -> refs/for/master diff --git a/tests/proxy/workspace_errors.t b/tests/proxy/workspace_errors.t index 9554d6d25..72c51529f 100644 --- a/tests/proxy/workspace_errors.t +++ b/tests/proxy/workspace_errors.t @@ -54,8 +54,10 @@ Error: comment in the middle $ git add workspace.josh $ git commit -m "add workspace file" 1> /dev/null $ git push - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 500 Internal Server Error + remote: upstream: response body: + remote: remote: remote: Can't apply "add workspace file" (4f70c9a0179b1cae80148572c8dfc3ba1f2d43a2) remote: Invalid workspace: @@ -76,8 +78,6 @@ Error: comment in the middle remote: c = :/sub1 remote: remote: ---- - remote: - remote: remote: error: hook declined to update refs/heads/master To http://localhost:8002/real_repo.git:workspace=ws.git ! [remote rejected] master -> master (hook declined) @@ -93,8 +93,10 @@ Error in filter $ git add workspace.josh $ git commit -m "add workspace file" --amend 1> /dev/null $ git push - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 500 Internal Server Error + remote: upstream: response body: + remote: remote: remote: Can't apply "add workspace file" (74128cac082e518bc3ddec183bb11b16856406cd) remote: Invalid workspace: @@ -110,8 +112,6 @@ Error in filter remote: c = :/sub1 remote: remote: ---- - remote: - remote: remote: error: hook declined to update refs/heads/master To http://localhost:8002/real_repo.git:workspace=ws.git ! [remote rejected] master -> master (hook declined) @@ -136,8 +136,10 @@ No match for filters $ git add workspace.josh $ git commit -m "add workspace file" --amend 1> /dev/null $ git push origin HEAD:master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 5119a73..25943be JOSH_PUSH -> master remote: warnings: @@ -149,8 +151,6 @@ No match for filters remote: No match for "test/test = :/test:/" remote: No match for "::test/test/" remote: REWRITE(064643c5fdf5295695d383a511e4335ea3262fce -> 9cbc5874da793480ee59207ca72d9f0523b8b127) - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws.git 66a8b5e..064643c HEAD -> master diff --git a/tests/proxy/workspace_in_workspace.t b/tests/proxy/workspace_in_workspace.t index b2ced1217..732e0e627 100644 --- a/tests/proxy/workspace_in_workspace.t +++ b/tests/proxy/workspace_in_workspace.t @@ -126,13 +126,13 @@ $ git commit -m "add in filter" 1> /dev/null $ git push 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 176e8e0..11e2559 JOSH_PUSH -> master remote: REWRITE(5fa942ed9d35f280b35df2c4ef7acd23319271a5 -> 2cbcd105ead63a4fecf486b949db7f44710300e5) - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws.git 6be0d68..5fa942e master -> master @@ -198,13 +198,13 @@ HEAD is now at b3be5ad add ws2 Pushing to http://localhost:8002/real_repo.git:workspace=ws2.git POST git-receive-pack (424 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 11e2559..517813c JOSH_PUSH -> master remote: REWRITE(d31a8dce16b9b197a1411e750602e62d8d2f97ae -> b3be5ad252e0f493a404a8785653065d7e677f21) - remote: - remote: updating local tracking ref 'refs/remotes/origin/master' @@ -216,13 +216,13 @@ ! refs/heads/master -> refs/heads/master Pushing to http://localhost:8002/real_repo.git:workspace=ws2.git POST git-receive-pack (481 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 500 Internal Server Error + remote: upstream: response body: + remote: remote: remote: Can't apply "add workspace filter" (e2532f1207290ed9a961f9fc377a6b7afe415312) remote: Invalid workspace: not reversible - remote: - remote: remote: error: hook declined to update refs/heads/master error: failed to push some refs to 'http://localhost:8002/real_repo.git:workspace=ws2.git' diff --git a/tests/proxy/workspace_in_workspace_prefix.t b/tests/proxy/workspace_in_workspace_prefix.t index b29bccd0d..441b046a6 100644 --- a/tests/proxy/workspace_in_workspace_prefix.t +++ b/tests/proxy/workspace_in_workspace_prefix.t @@ -126,13 +126,13 @@ $ git commit -m "add in filter" 1> /dev/null $ git push 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 176e8e0..11e2559 JOSH_PUSH -> master remote: REWRITE(5fa942ed9d35f280b35df2c4ef7acd23319271a5 -> 2cbcd105ead63a4fecf486b949db7f44710300e5) - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws.git 6be0d68..5fa942e master -> master @@ -198,13 +198,13 @@ HEAD is now at b3be5ad add ws2 Pushing to http://localhost:8002/real_repo.git:workspace=ws2.git POST git-receive-pack (424 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 11e2559..517813c JOSH_PUSH -> master remote: REWRITE(d31a8dce16b9b197a1411e750602e62d8d2f97ae -> b3be5ad252e0f493a404a8785653065d7e677f21) - remote: - remote: updating local tracking ref 'refs/remotes/origin/master' @@ -216,13 +216,13 @@ ! refs/heads/master -> refs/heads/master Pushing to http://localhost:8002/real_repo.git:workspace=ws2.git POST git-receive-pack (487 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 500 Internal Server Error + remote: upstream: response body: + remote: remote: remote: Can't apply "add workspace filter" (a5a685ff773c9d3e2d4535a7c0b71b8752dc8b45) remote: Invalid workspace: not reversible - remote: - remote: remote: error: hook declined to update refs/heads/master error: failed to push some refs to 'http://localhost:8002/real_repo.git:workspace=ws2.git' diff --git a/tests/proxy/workspace_invalid_trailing_slash.t b/tests/proxy/workspace_invalid_trailing_slash.t index 1ed799f3c..649c6f472 100644 --- a/tests/proxy/workspace_invalid_trailing_slash.t +++ b/tests/proxy/workspace_invalid_trailing_slash.t @@ -52,13 +52,13 @@ Flushed credential cache $ git add . $ git commit -m "add workspace" 1> /dev/null $ git push origin HEAD:refs/heads/master -o merge 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 81c59c0..37c79e6 JOSH_PUSH -> master remote: REWRITE(85ee20960c56619305e098b301d8253888b6ce5b -> 705dcb4e33bd0dd3f95d5831fc8dc8a41ca3e566) - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws.git * [new branch] HEAD -> master @@ -125,8 +125,10 @@ Flushed credential cache $ git push 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 500 Internal Server Error + remote: upstream: response body: + remote: remote: remote: Can't apply "mod workspace" (b78eb888451be077531b50794384c2faec025765) remote: Invalid workspace: @@ -141,8 +143,6 @@ Flushed credential cache remote: a/ = :/sub1 remote: remote: ---- - remote: - remote: remote: error: hook declined to update refs/heads/master To http://localhost:8002/real_repo.git:workspace=ws.git ! [remote rejected] master -> master (hook declined) diff --git a/tests/proxy/workspace_modify.t b/tests/proxy/workspace_modify.t index 6d6adc8e1..d637a0ddc 100644 --- a/tests/proxy/workspace_modify.t +++ b/tests/proxy/workspace_modify.t @@ -75,13 +75,13 @@ Flushed credential cache HEAD is now at d91fa49 Merge from :workspace=ws Pushing to http://localhost:8002/real_repo.git:workspace=ws.git POST git-receive-pack (439 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 5d605ce..0ebcca7 JOSH_PUSH -> master remote: REWRITE(1b46698f32d1d1db1eaeb34f8c9037778d65f3a9 -> d91fa4981fe3546f44fa5a779ec6f69b20fdaa0f) - remote: - remote: updating local tracking ref 'refs/remotes/origin/master' @@ -251,13 +251,13 @@ Flushed credential cache HEAD is now at 3fc46d9 add in filter Pushing to http://localhost:8002/real_repo.git:workspace=ws.git POST git-receive-pack (807 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: f9be76c..c88a8ce JOSH_PUSH -> master remote: REWRITE(dce83c94807b93f44776c7a1e71cf4f4f8f222b5 -> 3fc46d98fe664e12a931c5c1365a1cd845a78a64) - remote: - remote: updating local tracking ref 'refs/remotes/origin/master' @@ -278,13 +278,13 @@ Flushed credential cache HEAD is now at 14c0592 try to modify ws Pushing to http://localhost:8002/real_repo.git:workspace=ws.git POST git-receive-pack (464 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: c88a8ce..381a4ab JOSH_PUSH -> master remote: REWRITE(7da1ae7f2b93967ad7ea421fa7db95b73b8aa07e -> 14c05920b084cdb89feaa847f9c99d764148ff9b) - remote: - remote: updating local tracking ref 'refs/remotes/origin/master' diff --git a/tests/proxy/workspace_modify_chain_prefix_subtree.t b/tests/proxy/workspace_modify_chain_prefix_subtree.t index c481ae7a4..679f0b62f 100644 --- a/tests/proxy/workspace_modify_chain_prefix_subtree.t +++ b/tests/proxy/workspace_modify_chain_prefix_subtree.t @@ -149,13 +149,13 @@ $ git commit -m "add in filter" 1> /dev/null $ git push 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: aaec05d..edefd7d JOSH_PUSH -> master remote: REWRITE(7de033196d3f74f40139647122f499286a97498b -> 44edc62d506b9805a3edfc74db15b1cc0bfc6871) - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws:prefix=pre:/pre.git 6712cb1..7de0331 master -> master @@ -172,13 +172,13 @@ $ git commit -m "try to modify ws" 1> /dev/null $ git push 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: edefd7d..0c66ddc JOSH_PUSH -> master remote: REWRITE(9f7fe44ebf4b96d3fc03aa7bffff6baa4a84eb63 -> 707a20731ff94c2dee063a8b274665b1cc730e26) - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws:prefix=pre:/pre.git 44edc62..9f7fe44 master -> master $ curl -s http://localhost:8002/flush diff --git a/tests/proxy/workspace_mv_folder.t b/tests/proxy/workspace_mv_folder.t index 00237fbae..40770da2a 100644 --- a/tests/proxy/workspace_mv_folder.t +++ b/tests/proxy/workspace_mv_folder.t @@ -75,13 +75,13 @@ Flushed credential cache HEAD is now at d91fa49 Merge from :workspace=ws Pushing to http://localhost:8002/real_repo.git:workspace=ws.git POST git-receive-pack (439 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 5d605ce..0ebcca7 JOSH_PUSH -> master remote: REWRITE(1b46698f32d1d1db1eaeb34f8c9037778d65f3a9 -> d91fa4981fe3546f44fa5a779ec6f69b20fdaa0f) - remote: - remote: updating local tracking ref 'refs/remotes/origin/master' @@ -161,13 +161,13 @@ Flushed credential cache HEAD is now at 251b9a3 mod workspace Pushing to http://localhost:8002/real_repo.git:workspace=ws.git POST git-receive-pack (530 bytes) - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 0ebcca7..57d15ef JOSH_PUSH -> master remote: REWRITE(5d8563b5319ef897a6aa971c0e4dd275a1139bf5 -> 251b9a34c94c69defbebdfc716a7eff98df80b51) - remote: - remote: updating local tracking ref 'refs/remotes/origin/master' diff --git a/tests/proxy/workspace_tags.t b/tests/proxy/workspace_tags.t index f5c9b1a5b..3a6026471 100644 --- a/tests/proxy/workspace_tags.t +++ b/tests/proxy/workspace_tags.t @@ -111,13 +111,13 @@ $ git commit -m "add in filter" 1> /dev/null $ git push 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: 176e8e0..11e2559 JOSH_PUSH -> master remote: REWRITE(5fa942ed9d35f280b35df2c4ef7acd23319271a5 -> 2cbcd105ead63a4fecf486b949db7f44710300e5) - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws.git 6be0d68..5fa942e master -> master $ git log --graph --oneline @@ -148,13 +148,13 @@ $ git tag tag_from_ws_1 $ git push origin tag_from_ws_1 -o base=refs/heads/master - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new tag] JOSH_PUSH -> tag_from_ws_1 remote: REWRITE(5fa942ed9d35f280b35df2c4ef7acd23319271a5 -> 2cbcd105ead63a4fecf486b949db7f44710300e5) - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws.git * [new tag] tag_from_ws_1 -> tag_from_ws_1 @@ -189,15 +189,15 @@ 1b46698 add workspace $ git tag tag_from_ws_2 $ git push origin tag_from_ws_2 -o base=refs/heads/master 2>&1 >/dev/null | sed -e 's/[ ]*$//g' - remote: josh-proxy - remote: response from upstream: + remote: josh-proxy: pre-receive hook + remote: upstream: response status: 200 OK + remote: upstream: response body: + remote: remote: To http://localhost:8001/real_repo.git remote: * [new tag] JOSH_PUSH -> tag_from_ws_2 remote: warnings: remote: No match for "c = :/sub1" remote: No match for "a/b = :/sub2" - remote: - remote: To http://localhost:8002/real_repo.git:workspace=ws.git * [new tag] tag_from_ws_2 -> tag_from_ws_2