1mod ids;
2mod queries;
3mod tables;
4#[cfg(test)]
5pub mod tests;
6
7use crate::{Error, Result};
8use anyhow::{Context as _, anyhow};
9use collections::{BTreeMap, BTreeSet, HashMap, HashSet};
10use dashmap::DashMap;
11use futures::StreamExt;
12use project_repository_statuses::StatusKind;
13use rpc::ExtensionProvides;
14use rpc::{
15 ConnectionId, ExtensionMetadata,
16 proto::{self},
17};
18use sea_orm::{
19 ActiveValue, Condition, ConnectionTrait, DatabaseConnection, DatabaseTransaction,
20 FromQueryResult, IntoActiveModel, IsolationLevel, JoinType, QueryOrder, QuerySelect, Statement,
21 TransactionTrait,
22 entity::prelude::*,
23 sea_query::{Alias, Expr, OnConflict},
24};
25use semver::Version;
26use serde::{Deserialize, Serialize};
27use std::ops::RangeInclusive;
28use std::{
29 future::Future,
30 marker::PhantomData,
31 ops::{Deref, DerefMut},
32 rc::Rc,
33 sync::Arc,
34};
35use time::PrimitiveDateTime;
36use tokio::sync::{Mutex, OwnedMutexGuard};
37use util::paths::PathStyle;
38use worktree_settings_file::LocalSettingsKind;
39
40#[cfg(test)]
41pub use tests::TestDb;
42
43pub use ids::*;
44pub use queries::contributors::ContributorSelector;
45pub use sea_orm::ConnectOptions;
46pub use tables::user::Model as User;
47pub use tables::*;
48
49#[cfg(test)]
50pub struct DatabaseTestOptions {
51 pub executor: gpui::BackgroundExecutor,
52 pub runtime: tokio::runtime::Runtime,
53 pub query_failure_probability: parking_lot::Mutex<f64>,
54}
55
56/// Database gives you a handle that lets you access the database.
57/// It handles pooling internally.
58pub struct Database {
59 options: ConnectOptions,
60 pool: DatabaseConnection,
61 rooms: DashMap<RoomId, Arc<Mutex<()>>>,
62 projects: DashMap<ProjectId, Arc<Mutex<()>>>,
63 notification_kinds_by_id: HashMap<NotificationKindId, &'static str>,
64 notification_kinds_by_name: HashMap<String, NotificationKindId>,
65 #[cfg(test)]
66 test_options: Option<DatabaseTestOptions>,
67}
68
69// The `Database` type has so many methods that its impl blocks are split into
70// separate files in the `queries` folder.
71impl Database {
72 /// Connects to the database with the given options
73 pub async fn new(options: ConnectOptions) -> Result<Self> {
74 sqlx::any::install_default_drivers();
75 Ok(Self {
76 options: options.clone(),
77 pool: sea_orm::Database::connect(options).await?,
78 rooms: DashMap::with_capacity(16384),
79 projects: DashMap::with_capacity(16384),
80 notification_kinds_by_id: HashMap::default(),
81 notification_kinds_by_name: HashMap::default(),
82 #[cfg(test)]
83 test_options: None,
84 })
85 }
86
87 pub fn options(&self) -> &ConnectOptions {
88 &self.options
89 }
90
91 #[cfg(test)]
92 pub fn reset(&self) {
93 self.rooms.clear();
94 self.projects.clear();
95 }
96
97 pub async fn transaction<F, Fut, T>(&self, f: F) -> Result<T>
98 where
99 F: Send + Fn(TransactionHandle) -> Fut,
100 Fut: Send + Future<Output = Result<T>>,
101 {
102 let body = async {
103 let (tx, result) = self.with_transaction(&f).await?;
104 match result {
105 Ok(result) => match tx.commit().await.map_err(Into::into) {
106 Ok(()) => Ok(result),
107 Err(error) => Err(error),
108 },
109 Err(error) => {
110 tx.rollback().await?;
111 Err(error)
112 }
113 }
114 };
115
116 self.run(body).await
117 }
118
119 /// The same as room_transaction, but if you need to only optionally return a Room.
120 async fn optional_room_transaction<F, Fut, T>(
121 &self,
122 f: F,
123 ) -> Result<Option<TransactionGuard<T>>>
124 where
125 F: Send + Fn(TransactionHandle) -> Fut,
126 Fut: Send + Future<Output = Result<Option<(RoomId, T)>>>,
127 {
128 let body = async {
129 let (tx, result) = self.with_transaction(&f).await?;
130 match result {
131 Ok(Some((room_id, data))) => {
132 let lock = self.rooms.entry(room_id).or_default().clone();
133 let _guard = lock.lock_owned().await;
134 match tx.commit().await.map_err(Into::into) {
135 Ok(()) => Ok(Some(TransactionGuard {
136 data,
137 _guard,
138 _not_send: PhantomData,
139 })),
140 Err(error) => Err(error),
141 }
142 }
143 Ok(None) => match tx.commit().await.map_err(Into::into) {
144 Ok(()) => Ok(None),
145 Err(error) => Err(error),
146 },
147 Err(error) => {
148 tx.rollback().await?;
149 Err(error)
150 }
151 }
152 };
153
154 self.run(body).await
155 }
156
157 async fn project_transaction<F, Fut, T>(
158 &self,
159 project_id: ProjectId,
160 f: F,
161 ) -> Result<TransactionGuard<T>>
162 where
163 F: Send + Fn(TransactionHandle) -> Fut,
164 Fut: Send + Future<Output = Result<T>>,
165 {
166 let room_id = Database::room_id_for_project(self, project_id).await?;
167 let body = async {
168 let lock = if let Some(room_id) = room_id {
169 self.rooms.entry(room_id).or_default().clone()
170 } else {
171 self.projects.entry(project_id).or_default().clone()
172 };
173 let _guard = lock.lock_owned().await;
174 let (tx, result) = self.with_transaction(&f).await?;
175 match result {
176 Ok(data) => match tx.commit().await.map_err(Into::into) {
177 Ok(()) => Ok(TransactionGuard {
178 data,
179 _guard,
180 _not_send: PhantomData,
181 }),
182 Err(error) => Err(error),
183 },
184 Err(error) => {
185 tx.rollback().await?;
186 Err(error)
187 }
188 }
189 };
190
191 self.run(body).await
192 }
193
194 /// room_transaction runs the block in a transaction. It returns a RoomGuard, that keeps
195 /// the database locked until it is dropped. This ensures that updates sent to clients are
196 /// properly serialized with respect to database changes.
197 async fn room_transaction<F, Fut, T>(
198 &self,
199 room_id: RoomId,
200 f: F,
201 ) -> Result<TransactionGuard<T>>
202 where
203 F: Send + Fn(TransactionHandle) -> Fut,
204 Fut: Send + Future<Output = Result<T>>,
205 {
206 let body = async {
207 let lock = self.rooms.entry(room_id).or_default().clone();
208 let _guard = lock.lock_owned().await;
209 let (tx, result) = self.with_transaction(&f).await?;
210 match result {
211 Ok(data) => match tx.commit().await.map_err(Into::into) {
212 Ok(()) => Ok(TransactionGuard {
213 data,
214 _guard,
215 _not_send: PhantomData,
216 }),
217 Err(error) => Err(error),
218 },
219 Err(error) => {
220 tx.rollback().await?;
221 Err(error)
222 }
223 }
224 };
225
226 self.run(body).await
227 }
228
229 async fn with_transaction<F, Fut, T>(&self, f: &F) -> Result<(DatabaseTransaction, Result<T>)>
230 where
231 F: Send + Fn(TransactionHandle) -> Fut,
232 Fut: Send + Future<Output = Result<T>>,
233 {
234 let tx = self
235 .pool
236 .begin_with_config(Some(IsolationLevel::ReadCommitted), None)
237 .await?;
238
239 let mut tx = Arc::new(Some(tx));
240 let result = f(TransactionHandle(tx.clone())).await;
241 let tx = Arc::get_mut(&mut tx)
242 .and_then(|tx| tx.take())
243 .context("couldn't complete transaction because it's still in use")?;
244
245 Ok((tx, result))
246 }
247
248 async fn run<F, T>(&self, future: F) -> Result<T>
249 where
250 F: Future<Output = Result<T>>,
251 {
252 #[cfg(test)]
253 {
254 use rand::prelude::*;
255
256 let test_options = self.test_options.as_ref().unwrap();
257 test_options.executor.simulate_random_delay().await;
258 let fail_probability = *test_options.query_failure_probability.lock();
259 if test_options.executor.rng().random_bool(fail_probability) {
260 return Err(anyhow!("simulated query failure"))?;
261 }
262
263 test_options.runtime.block_on(future)
264 }
265
266 #[cfg(not(test))]
267 {
268 future.await
269 }
270 }
271}
272
273/// A handle to a [`DatabaseTransaction`].
274pub struct TransactionHandle(pub(crate) Arc<Option<DatabaseTransaction>>);
275
276impl Deref for TransactionHandle {
277 type Target = DatabaseTransaction;
278
279 fn deref(&self) -> &Self::Target {
280 self.0.as_ref().as_ref().unwrap()
281 }
282}
283
284/// [`TransactionGuard`] keeps a database transaction alive until it is dropped.
285/// It wraps data that depends on the state of the database and prevents an additional
286/// transaction from starting that would invalidate that data.
287pub struct TransactionGuard<T> {
288 data: T,
289 _guard: OwnedMutexGuard<()>,
290 _not_send: PhantomData<Rc<()>>,
291}
292
293impl<T> Deref for TransactionGuard<T> {
294 type Target = T;
295
296 fn deref(&self) -> &T {
297 &self.data
298 }
299}
300
301impl<T> DerefMut for TransactionGuard<T> {
302 fn deref_mut(&mut self) -> &mut T {
303 &mut self.data
304 }
305}
306
307impl<T> TransactionGuard<T> {
308 /// Returns the inner value of the guard.
309 pub fn into_inner(self) -> T {
310 self.data
311 }
312}
313
314#[derive(Clone, Debug, PartialEq, Eq)]
315pub enum Contact {
316 Accepted { user_id: UserId, busy: bool },
317 Outgoing { user_id: UserId },
318 Incoming { user_id: UserId },
319}
320
321impl Contact {
322 pub fn user_id(&self) -> UserId {
323 match self {
324 Contact::Accepted { user_id, .. } => *user_id,
325 Contact::Outgoing { user_id } => *user_id,
326 Contact::Incoming { user_id, .. } => *user_id,
327 }
328 }
329}
330
331pub type NotificationBatch = Vec<(UserId, proto::Notification)>;
332
333pub struct CreatedChannelMessage {
334 pub message_id: MessageId,
335 pub participant_connection_ids: HashSet<ConnectionId>,
336 pub notifications: NotificationBatch,
337}
338
339pub struct UpdatedChannelMessage {
340 pub message_id: MessageId,
341 pub participant_connection_ids: Vec<ConnectionId>,
342 pub notifications: NotificationBatch,
343 pub reply_to_message_id: Option<MessageId>,
344 pub timestamp: PrimitiveDateTime,
345 pub deleted_mention_notification_ids: Vec<NotificationId>,
346 pub updated_mention_notifications: Vec<rpc::proto::Notification>,
347}
348
349#[derive(Clone, Debug, PartialEq, Eq, FromQueryResult, Serialize, Deserialize)]
350pub struct Invite {
351 pub email_address: String,
352 pub email_confirmation_code: String,
353}
354
355#[derive(Clone, Debug, Deserialize)]
356pub struct NewSignup {
357 pub email_address: String,
358 pub platform_mac: bool,
359 pub platform_windows: bool,
360 pub platform_linux: bool,
361 pub editor_features: Vec<String>,
362 pub programming_languages: Vec<String>,
363 pub device_id: Option<String>,
364 pub added_to_mailing_list: bool,
365 pub created_at: Option<DateTime>,
366}
367
368#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, FromQueryResult)]
369pub struct WaitlistSummary {
370 pub count: i64,
371 pub linux_count: i64,
372 pub mac_count: i64,
373 pub windows_count: i64,
374 pub unknown_count: i64,
375}
376
377/// The parameters to create a new user.
378#[derive(Debug, Serialize, Deserialize)]
379pub struct NewUserParams {
380 pub github_login: String,
381 pub github_user_id: i32,
382}
383
384/// The result of creating a new user.
385#[derive(Debug)]
386pub struct NewUserResult {
387 pub user_id: UserId,
388}
389
390/// The result of updating a channel membership.
391#[derive(Debug)]
392pub struct MembershipUpdated {
393 pub channel_id: ChannelId,
394 pub new_channels: ChannelsForUser,
395 pub removed_channels: Vec<ChannelId>,
396}
397
398/// The result of setting a member's role.
399#[derive(Debug)]
400
401pub enum SetMemberRoleResult {
402 InviteUpdated(Channel),
403 MembershipUpdated(MembershipUpdated),
404}
405
406/// The result of inviting a member to a channel.
407#[derive(Debug)]
408pub struct InviteMemberResult {
409 pub channel: Channel,
410 pub notifications: NotificationBatch,
411}
412
413#[derive(Debug)]
414pub struct RespondToChannelInvite {
415 pub membership_update: Option<MembershipUpdated>,
416 pub notifications: NotificationBatch,
417}
418
419#[derive(Debug)]
420pub struct RemoveChannelMemberResult {
421 pub membership_update: MembershipUpdated,
422 pub notification_id: Option<NotificationId>,
423}
424
425#[derive(Debug, PartialEq, Eq, Hash)]
426pub struct Channel {
427 pub id: ChannelId,
428 pub name: String,
429 pub visibility: ChannelVisibility,
430 /// parent_path is the channel ids from the root to this one (not including this one)
431 pub parent_path: Vec<ChannelId>,
432 pub channel_order: i32,
433}
434
435impl Channel {
436 pub fn from_model(value: channel::Model) -> Self {
437 Channel {
438 id: value.id,
439 visibility: value.visibility,
440 name: value.clone().name,
441 parent_path: value.ancestors().collect(),
442 channel_order: value.channel_order,
443 }
444 }
445
446 pub fn to_proto(&self) -> proto::Channel {
447 proto::Channel {
448 id: self.id.to_proto(),
449 name: self.name.clone(),
450 visibility: self.visibility.into(),
451 parent_path: self.parent_path.iter().map(|c| c.to_proto()).collect(),
452 channel_order: self.channel_order,
453 }
454 }
455
456 pub fn root_id(&self) -> ChannelId {
457 self.parent_path.first().copied().unwrap_or(self.id)
458 }
459}
460
461#[derive(Debug, PartialEq, Eq, Hash)]
462pub struct ChannelMember {
463 pub role: ChannelRole,
464 pub user_id: UserId,
465 pub kind: proto::channel_member::Kind,
466}
467
468impl ChannelMember {
469 pub fn to_proto(&self) -> proto::ChannelMember {
470 proto::ChannelMember {
471 role: self.role.into(),
472 user_id: self.user_id.to_proto(),
473 kind: self.kind.into(),
474 }
475 }
476}
477
478#[derive(Debug, PartialEq)]
479pub struct ChannelsForUser {
480 pub channels: Vec<Channel>,
481 pub channel_memberships: Vec<channel_member::Model>,
482 pub channel_participants: HashMap<ChannelId, Vec<UserId>>,
483 pub invited_channels: Vec<Channel>,
484
485 pub observed_buffer_versions: Vec<proto::ChannelBufferVersion>,
486 pub latest_buffer_versions: Vec<proto::ChannelBufferVersion>,
487}
488
489#[derive(Debug)]
490pub struct RejoinedChannelBuffer {
491 pub buffer: proto::RejoinedChannelBuffer,
492 pub old_connection_id: ConnectionId,
493}
494
495#[derive(Clone)]
496pub struct JoinRoom {
497 pub room: proto::Room,
498 pub channel: Option<channel::Model>,
499}
500
501pub struct RejoinedRoom {
502 pub room: proto::Room,
503 pub rejoined_projects: Vec<RejoinedProject>,
504 pub reshared_projects: Vec<ResharedProject>,
505 pub channel: Option<channel::Model>,
506}
507
508pub struct ResharedProject {
509 pub id: ProjectId,
510 pub old_connection_id: ConnectionId,
511 pub collaborators: Vec<ProjectCollaborator>,
512 pub worktrees: Vec<proto::WorktreeMetadata>,
513}
514
515pub struct RejoinedProject {
516 pub id: ProjectId,
517 pub old_connection_id: ConnectionId,
518 pub collaborators: Vec<ProjectCollaborator>,
519 pub worktrees: Vec<RejoinedWorktree>,
520 pub updated_repositories: Vec<proto::UpdateRepository>,
521 pub removed_repositories: Vec<u64>,
522 pub language_servers: Vec<LanguageServer>,
523}
524
525impl RejoinedProject {
526 pub fn to_proto(&self) -> proto::RejoinedProject {
527 let (language_servers, language_server_capabilities) = self
528 .language_servers
529 .clone()
530 .into_iter()
531 .map(|server| (server.server, server.capabilities))
532 .unzip();
533 proto::RejoinedProject {
534 id: self.id.to_proto(),
535 worktrees: self
536 .worktrees
537 .iter()
538 .map(|worktree| proto::WorktreeMetadata {
539 id: worktree.id,
540 root_name: worktree.root_name.clone(),
541 visible: worktree.visible,
542 abs_path: worktree.abs_path.clone(),
543 })
544 .collect(),
545 collaborators: self
546 .collaborators
547 .iter()
548 .map(|collaborator| collaborator.to_proto())
549 .collect(),
550 language_servers,
551 language_server_capabilities,
552 }
553 }
554}
555
556#[derive(Debug)]
557pub struct RejoinedWorktree {
558 pub id: u64,
559 pub abs_path: String,
560 pub root_name: String,
561 pub visible: bool,
562 pub updated_entries: Vec<proto::Entry>,
563 pub removed_entries: Vec<u64>,
564 pub updated_repositories: Vec<proto::RepositoryEntry>,
565 pub removed_repositories: Vec<u64>,
566 pub diagnostic_summaries: Vec<proto::DiagnosticSummary>,
567 pub settings_files: Vec<WorktreeSettingsFile>,
568 pub scan_id: u64,
569 pub completed_scan_id: u64,
570}
571
572pub struct LeftRoom {
573 pub room: proto::Room,
574 pub channel: Option<channel::Model>,
575 pub left_projects: HashMap<ProjectId, LeftProject>,
576 pub canceled_calls_to_user_ids: Vec<UserId>,
577 pub deleted: bool,
578}
579
580pub struct RefreshedRoom {
581 pub room: proto::Room,
582 pub channel: Option<channel::Model>,
583 pub stale_participant_user_ids: Vec<UserId>,
584 pub canceled_calls_to_user_ids: Vec<UserId>,
585}
586
587pub struct RefreshedChannelBuffer {
588 pub connection_ids: Vec<ConnectionId>,
589 pub collaborators: Vec<proto::Collaborator>,
590}
591
592pub struct Project {
593 pub id: ProjectId,
594 pub role: ChannelRole,
595 pub collaborators: Vec<ProjectCollaborator>,
596 pub worktrees: BTreeMap<u64, Worktree>,
597 pub repositories: Vec<proto::UpdateRepository>,
598 pub language_servers: Vec<LanguageServer>,
599 pub path_style: PathStyle,
600}
601
602pub struct ProjectCollaborator {
603 pub connection_id: ConnectionId,
604 pub user_id: UserId,
605 pub replica_id: ReplicaId,
606 pub is_host: bool,
607 pub committer_name: Option<String>,
608 pub committer_email: Option<String>,
609}
610
611impl ProjectCollaborator {
612 pub fn to_proto(&self) -> proto::Collaborator {
613 proto::Collaborator {
614 peer_id: Some(self.connection_id.into()),
615 replica_id: self.replica_id.0 as u32,
616 user_id: self.user_id.to_proto(),
617 is_host: self.is_host,
618 committer_name: self.committer_name.clone(),
619 committer_email: self.committer_email.clone(),
620 }
621 }
622}
623
624#[derive(Debug, Clone)]
625pub struct LanguageServer {
626 pub server: proto::LanguageServer,
627 pub capabilities: String,
628}
629
630#[derive(Debug)]
631pub struct LeftProject {
632 pub id: ProjectId,
633 pub should_unshare: bool,
634 pub connection_ids: Vec<ConnectionId>,
635}
636
637pub struct Worktree {
638 pub id: u64,
639 pub abs_path: String,
640 pub root_name: String,
641 pub visible: bool,
642 pub entries: Vec<proto::Entry>,
643 pub legacy_repository_entries: BTreeMap<u64, proto::RepositoryEntry>,
644 pub diagnostic_summaries: Vec<proto::DiagnosticSummary>,
645 pub settings_files: Vec<WorktreeSettingsFile>,
646 pub scan_id: u64,
647 pub completed_scan_id: u64,
648}
649
650#[derive(Debug)]
651pub struct WorktreeSettingsFile {
652 pub path: String,
653 pub content: String,
654 pub kind: LocalSettingsKind,
655}
656
657pub struct NewExtensionVersion {
658 pub name: String,
659 pub version: semver::Version,
660 pub description: String,
661 pub authors: Vec<String>,
662 pub repository: String,
663 pub schema_version: i32,
664 pub wasm_api_version: Option<String>,
665 pub provides: BTreeSet<ExtensionProvides>,
666 pub published_at: PrimitiveDateTime,
667}
668
669pub struct ExtensionVersionConstraints {
670 pub schema_versions: RangeInclusive<i32>,
671 pub wasm_api_versions: RangeInclusive<semver::Version>,
672}
673
674impl LocalSettingsKind {
675 pub fn from_proto(proto_kind: proto::LocalSettingsKind) -> Self {
676 match proto_kind {
677 proto::LocalSettingsKind::Settings => Self::Settings,
678 proto::LocalSettingsKind::Tasks => Self::Tasks,
679 proto::LocalSettingsKind::Editorconfig => Self::Editorconfig,
680 proto::LocalSettingsKind::Debug => Self::Debug,
681 }
682 }
683
684 pub fn to_proto(self) -> proto::LocalSettingsKind {
685 match self {
686 Self::Settings => proto::LocalSettingsKind::Settings,
687 Self::Tasks => proto::LocalSettingsKind::Tasks,
688 Self::Editorconfig => proto::LocalSettingsKind::Editorconfig,
689 Self::Debug => proto::LocalSettingsKind::Debug,
690 }
691 }
692}
693
694fn db_status_to_proto(
695 entry: project_repository_statuses::Model,
696) -> anyhow::Result<proto::StatusEntry> {
697 use proto::git_file_status::{Tracked, Unmerged, Variant};
698
699 let (simple_status, variant) =
700 match (entry.status_kind, entry.first_status, entry.second_status) {
701 (StatusKind::Untracked, None, None) => (
702 proto::GitStatus::Added as i32,
703 Variant::Untracked(Default::default()),
704 ),
705 (StatusKind::Ignored, None, None) => (
706 proto::GitStatus::Added as i32,
707 Variant::Ignored(Default::default()),
708 ),
709 (StatusKind::Unmerged, Some(first_head), Some(second_head)) => (
710 proto::GitStatus::Conflict as i32,
711 Variant::Unmerged(Unmerged {
712 first_head,
713 second_head,
714 }),
715 ),
716 (StatusKind::Tracked, Some(index_status), Some(worktree_status)) => {
717 let simple_status = if worktree_status != proto::GitStatus::Unmodified as i32 {
718 worktree_status
719 } else if index_status != proto::GitStatus::Unmodified as i32 {
720 index_status
721 } else {
722 proto::GitStatus::Unmodified as i32
723 };
724 (
725 simple_status,
726 Variant::Tracked(Tracked {
727 index_status,
728 worktree_status,
729 }),
730 )
731 }
732 _ => {
733 anyhow::bail!("Unexpected combination of status fields: {entry:?}");
734 }
735 };
736 Ok(proto::StatusEntry {
737 repo_path: entry.repo_path,
738 simple_status,
739 status: Some(proto::GitFileStatus {
740 variant: Some(variant),
741 }),
742 })
743}
744
745fn proto_status_to_db(
746 status_entry: proto::StatusEntry,
747) -> (String, StatusKind, Option<i32>, Option<i32>) {
748 use proto::git_file_status::{Tracked, Unmerged, Variant};
749
750 let (status_kind, first_status, second_status) = status_entry
751 .status
752 .clone()
753 .and_then(|status| status.variant)
754 .map_or(
755 (StatusKind::Untracked, None, None),
756 |variant| match variant {
757 Variant::Untracked(_) => (StatusKind::Untracked, None, None),
758 Variant::Ignored(_) => (StatusKind::Ignored, None, None),
759 Variant::Unmerged(Unmerged {
760 first_head,
761 second_head,
762 }) => (StatusKind::Unmerged, Some(first_head), Some(second_head)),
763 Variant::Tracked(Tracked {
764 index_status,
765 worktree_status,
766 }) => (
767 StatusKind::Tracked,
768 Some(index_status),
769 Some(worktree_status),
770 ),
771 },
772 );
773 (
774 status_entry.repo_path,
775 status_kind,
776 first_status,
777 second_status,
778 )
779}