don't
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(knot): apply merge check against target branch

Signed-off-by: tjh <x@tjh.dev>

tjh d26847d2 37e99bf6

+24 -6
+24 -6
crates/knot/src/model/repository/merge_check.rs
··· 4 4 use lexicon::sh_tangled::repo::merge_check::{ConflictInfo, Input, Output}; 5 5 6 6 use crate::{ 7 - model::{errors, repository::TempWorktree}, 7 + model::{ 8 + errors, 9 + repository::{ResolveRevspec as _, ResolvedRevspec, TempWorktree}, 10 + }, 8 11 public::xrpc::{XrpcError, XrpcResponse}, 9 12 }; 10 13 11 14 impl super::TangledRepository { 12 - pub fn merge_check(&self, params: Input) -> Result<XrpcResponse<Json<Output>>, XrpcError> { 13 - let worktree = TempWorktree::new(&self.repository, Some(&self.knot.git_config)) 14 - .map_err(errors::Internal)?; 15 + pub fn merge_check( 16 + &self, 17 + Input { 18 + did: _, 19 + name: _, 20 + patch, 21 + branch, 22 + }: Input, 23 + ) -> Result<XrpcResponse<Json<Output>>, XrpcError> { 24 + let ResolvedRevspec { commit, immutable } = 25 + self.repository.resolve_revspec(&Some(branch.as_ref()))?; 26 + 27 + let worktree = TempWorktree::new_from( 28 + &self.repository, 29 + Some(&self.knot.git_config), 30 + Some(&commit.id), 31 + ) 32 + .map_err(errors::Internal)?; 15 33 16 34 let mut child = self 17 35 .git() ··· 45 27 .map_err(errors::Internal)?; 46 28 47 29 let mut stdin = child.stdin.take().expect("handle present"); 48 - let writer = std::thread::spawn(move || stdin.write_all(params.patch.as_bytes())); 30 + let writer = std::thread::spawn(move || stdin.write_all(patch.as_bytes())); 49 31 let output = child.wait_with_output().map_err(errors::Internal)?; 50 32 51 33 writer ··· 65 47 message, 66 48 error: None, 67 49 }), 68 - immutable: false, 50 + immutable, 69 51 }) 70 52 } 71 53 }