@@ -1,5 +1,6 @@
11use anyhow::{anyhow, bail, Context, Error};
22use arc_swap::access::DynAccess;
3+use arc_swap::ArcSwap;
34use futures_util::future::BoxFuture;
45use futures_util::FutureExt;
56use helix_core::auto_pairs::AutoPairs;
@@ -158,6 +159,7 @@ pub struct Document {
158159 language_server: Option<Arc<helix_lsp::Client>>,
159160
160161 diff_handle: Option<DiffHandle>,
162+ version_control_head: Option<Arc<ArcSwap<Box<str>>>>,
161163}
162164
163165use std::{fmt, mem};
@@ -404,6 +406,7 @@ impl Document {
404406 language_server: None,
405407 diff_handle: None,
406408 config,
409+ version_control_head: None,
407410 }
408411 }
409412 pub fn default(config: Arc<dyn DynAccess<Config>>) -> Self {
@@ -707,6 +710,8 @@ impl Document {
707710 None => self.diff_handle = None,
708711 }
709712
713+ self.version_control_head = provider_registry.get_current_head_name(&path);
714+
710715 Ok(())
711716 }
712717
@@ -1158,6 +1163,17 @@ impl Document {
11581163 }
11591164 }
11601165
1166+ pub fn version_control_head(&self) -> Option<Arc<Box<str>>> {
1167+ self.version_control_head.as_ref().map(|a| a.load_full())
1168+ }
1169+
1170+ pub fn set_version_control_head(
1171+ &mut self,
1172+ version_control_head: Option<Arc<ArcSwap<Box<str>>>>,
1173+ ) {
1174+ self.version_control_head = version_control_head;
1175+ }
1176+
11611177 #[inline]
11621178 /// Tree-sitter AST tree
11631179 pub fn syntax(&self) -> Option<&Syntax> {