mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-22 17:11:43 +03:00
emit git fetch event
This commit is contained in:
parent
1e3d0244db
commit
f83df47b77
@ -34,6 +34,13 @@ impl Event {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn git_fetch(project_id: &str) -> Self {
|
||||
Event {
|
||||
name: format!("project://{}/git/fetch", project_id),
|
||||
payload: serde_json::json!({}),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn git_head(project_id: &str, head: &str) -> Self {
|
||||
Event {
|
||||
name: format!("project://{}/git/head", project_id),
|
||||
|
@ -12,6 +12,7 @@ pub enum Event {
|
||||
GitFileChange(path::PathBuf),
|
||||
GitIndexChange,
|
||||
GitActivity,
|
||||
GitFetch,
|
||||
GitHeadChange(String),
|
||||
|
||||
ProjectFileChange(path::PathBuf),
|
||||
@ -31,6 +32,7 @@ impl Display for Event {
|
||||
Event::Tick(ts) => write!(f, "Tick({:?})", ts),
|
||||
Event::Flush(session) => write!(f, "Flush({})", session.id),
|
||||
Event::Fetch => write!(f, "Fetch"),
|
||||
Event::GitFetch => write!(f, "GitFetch"),
|
||||
Event::FileChange(_) => write!(f, "FileChange"),
|
||||
Event::GitFileChange(_) => write!(f, "GitFileChange"),
|
||||
Event::GitIndexChange => write!(f, "GitIndexChange"),
|
||||
|
@ -33,6 +33,10 @@ impl Handler {
|
||||
.with_context(|| "failed to open project repository for project")?;
|
||||
|
||||
match path.as_ref().to_str().unwrap() {
|
||||
"FETCH_HEAD" => {
|
||||
log::info!("{}: git fetch", project.id);
|
||||
Ok(vec![events::Event::GitFetch])
|
||||
}
|
||||
"logs/HEAD" => {
|
||||
log::info!("{}: git activity", project.id);
|
||||
Ok(vec![events::Event::GitActivity])
|
||||
|
@ -132,6 +132,12 @@ impl<'handler> Handler {
|
||||
.context("failed to send git head event")?;
|
||||
Ok(vec![])
|
||||
}
|
||||
events::Event::GitFetch => {
|
||||
self.events_sender
|
||||
.send(app_events::Event::git_fetch(&self.project_id))
|
||||
.context("failed to send git fetch event")?;
|
||||
Ok(vec![])
|
||||
}
|
||||
events::Event::GitIndexChange => {
|
||||
self.events_sender
|
||||
.send(app_events::Event::git_index(&self.project_id))
|
||||
|
Loading…
Reference in New Issue
Block a user