mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-08 10:58:33 +03:00
Merge pull request #1426 from gitbutlerapp/update-branch-upstream
Update branch upstream
This commit is contained in:
commit
78ed6319fa
@ -968,7 +968,7 @@ fn build_session_tree(gb_repository: &Repository) -> Result<git::Oid> {
|
||||
|
||||
// add all files in the working directory to the in-memory index, skipping for matching entries in the repo index
|
||||
for file_path in
|
||||
fs::list_files(&gb_repository.session_path()).context("failed to list session files")?
|
||||
fs::list_files(gb_repository.session_path()).context("failed to list session files")?
|
||||
{
|
||||
let file_path = std::path::Path::new(&file_path);
|
||||
if file_path.starts_with("wd/") {
|
||||
|
@ -67,8 +67,8 @@ impl FileOwnership {
|
||||
let mut hunks = self
|
||||
.hunks
|
||||
.iter()
|
||||
.cloned()
|
||||
.filter(|hunk| !another.hunks.contains(hunk))
|
||||
.cloned()
|
||||
.collect::<Vec<Hunk>>();
|
||||
|
||||
another.hunks.iter().for_each(|hunk| {
|
||||
|
@ -56,8 +56,8 @@ impl Ownership {
|
||||
.files
|
||||
.iter()
|
||||
.filter(|o| !o.is_full()) // only consider explicit ownership
|
||||
.cloned()
|
||||
.find(|o| o.file_path == ownership.file_path);
|
||||
.find(|o| o.file_path == ownership.file_path)
|
||||
.cloned();
|
||||
|
||||
self.files
|
||||
.retain(|o| o.is_full() || o.file_path != ownership.file_path);
|
||||
|
@ -2116,7 +2116,7 @@ pub fn push(
|
||||
let branch_reader = branch::Reader::new(¤t_session_reader);
|
||||
let branch_writer = branch::Writer::new(gb_repository);
|
||||
|
||||
let mut vbranch = branch_reader
|
||||
let vbranch = branch_reader
|
||||
.read(branch_id)
|
||||
.context("failed to read branch")
|
||||
.map_err(PushError::Other)?;
|
||||
@ -2146,10 +2146,12 @@ pub fn push(
|
||||
|
||||
project_repository.push(&vbranch.head, &remote_branch, with_force, credentials)?;
|
||||
|
||||
vbranch.upstream = Some(remote_branch.clone());
|
||||
vbranch.upstream_head = Some(vbranch.head);
|
||||
branch_writer
|
||||
.write(&vbranch)
|
||||
.write(&branch::Branch {
|
||||
upstream: Some(remote_branch.clone()),
|
||||
upstream_head: Some(vbranch.head),
|
||||
..vbranch
|
||||
})
|
||||
.context("failed to write target branch after push")?;
|
||||
|
||||
project_repository.fetch(remote_branch.remote(), credentials)?;
|
||||
|
Loading…
Reference in New Issue
Block a user