diff --git a/josh-core/src/filter/mod.rs b/josh-core/src/filter/mod.rs index 2156f952..907261be 100644 --- a/josh-core/src/filter/mod.rs +++ b/josh-core/src/filter/mod.rs @@ -571,7 +571,12 @@ fn apply_to_commit2( .collect::>>(); if let Some(redirect) = resolve_workspace_redirect(repo, &commit.tree()?, ws_path) { - return apply_to_commit2(&to_op(redirect), &commit, transaction); + if let Some(r) = apply_to_commit2(&to_op(redirect), &commit, transaction)? { + transaction.insert(filter, commit.id(), r, true); + return Ok(Some(r)); + } else { + return Ok(None); + } } let normal_parents = some_or!(normal_parents, { return Ok(None) }); @@ -758,6 +763,11 @@ fn apply2<'a>( let wsj_file = to_filter(Op::File(Path::new("workspace.josh").to_owned())); let base = to_filter(Op::Subdir(path.to_owned())); let wsj_file = chain(base, wsj_file); + + if let Some(redirect) = resolve_workspace_redirect(repo, &tree, path) { + return apply(transaction, redirect, tree); + } + apply( transaction, compose(wsj_file, compose(get_workspace(repo, &tree, path), base)), diff --git a/tests/filter/workspace_redirect.t b/tests/filter/workspace_redirect.t index 10ea8430..b16ec6ed 100644 --- a/tests/filter/workspace_redirect.t +++ b/tests/filter/workspace_redirect.t @@ -39,6 +39,7 @@ ] [2] :workspace=ws $ josh-filter -s :workspace=ws_new master --update refs/heads/filtered_new + [1] :workspace=ws_new [2] :[ a = :/sub1 ::sub2/subsub/ @@ -142,6 +143,7 @@ a = :/sub1 ::sub2/subsub/ ] - [2] :workspace=ws + [2] :workspace=ws_new [3] :exclude[::ws] [3] :exclude[::ws_new] + [3] :workspace=ws