mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-26 23:59:19 +03:00
rm usnused code
This commit is contained in:
parent
c16b772739
commit
e5d8282339
@ -83,13 +83,20 @@ fn main() {
|
|||||||
|
|
||||||
fn run_clear(butler: ButlerCli) {
|
fn run_clear(butler: ButlerCli) {
|
||||||
// make sure there is a session
|
// make sure there is a session
|
||||||
butler
|
let session = butler
|
||||||
.gb_repository
|
.gb_repository
|
||||||
.get_or_create_current_session()
|
.get_or_create_current_session()
|
||||||
.expect("failed to get or create currnt session");
|
.expect("failed to get or create currnt session");
|
||||||
let branch_path = butler.gb_repository.branches_path();
|
let session_reader = sessions::Reader::open(&butler.gb_repository, &session)
|
||||||
// delete 'butler' directory under path
|
.expect("failed to open current session reader");
|
||||||
std::fs::remove_dir_all(branch_path).unwrap();
|
let branch_writer = virtual_branches::branch::Writer::new(&butler.gb_repository);
|
||||||
|
let iterator =
|
||||||
|
virtual_branches::Iterator::new(&session_reader).expect("failed to read branches");
|
||||||
|
for branch in iterator.flatten() {
|
||||||
|
branch_writer
|
||||||
|
.delete(&branch)
|
||||||
|
.unwrap_or_else(|e| panic!("failed to delete branch: {:?}", e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_reset(butler: ButlerCli) {
|
fn run_reset(butler: ButlerCli) {
|
||||||
|
@ -541,10 +541,6 @@ impl Repository {
|
|||||||
self.git_repository.path().join("gitbutler")
|
self.git_repository.path().join("gitbutler")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn branches_path(&self) -> std::path::PathBuf {
|
|
||||||
self.root().join("branches")
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn session_path(&self) -> std::path::PathBuf {
|
pub(crate) fn session_path(&self) -> std::path::PathBuf {
|
||||||
self.root().join("session")
|
self.root().join("session")
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use core::fmt;
|
use core::fmt;
|
||||||
use std::{cell::Cell, collections::HashMap, env, io::Write, process::Command};
|
use std::{cell::Cell, collections::HashMap, env, io::Write, process::Command};
|
||||||
|
|
||||||
use anyhow::{bail, Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use git2::{CredentialType, Diff};
|
use git2::{CredentialType, Diff};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::io::BufRead;
|
use std::io::BufRead;
|
||||||
@ -229,20 +229,6 @@ impl<'repository> Repository<'repository> {
|
|||||||
|
|
||||||
// end merge conflict state stuff
|
// end merge conflict state stuff
|
||||||
|
|
||||||
pub fn get_head_commit(&self) -> Result<git2::Commit> {
|
|
||||||
let repo = &self.git_repository;
|
|
||||||
let head = repo.head().context("failed to get head")?;
|
|
||||||
let name = head.name().unwrap();
|
|
||||||
if name != "refs/heads/gitbutler/integration" {
|
|
||||||
bail!("we are no longer on our integration branch");
|
|
||||||
}
|
|
||||||
let head_oid = head.target().context("failed to get head oid")?;
|
|
||||||
let head_commit = repo
|
|
||||||
.find_commit(head_oid)
|
|
||||||
.context("failed to find head commit")?;
|
|
||||||
Ok(head_commit)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn git_status(&self) -> Result<HashMap<String, FileStatus>> {
|
pub fn git_status(&self) -> Result<HashMap<String, FileStatus>> {
|
||||||
let staged_statuses = self.staged_statuses()?;
|
let staged_statuses = self.staged_statuses()?;
|
||||||
let unstaged_statuses = self.unstaged_statuses()?;
|
let unstaged_statuses = self.unstaged_statuses()?;
|
||||||
|
Loading…
Reference in New Issue
Block a user