@@ -1,5 +1,6 @@
1use anyhow::{anyhow, bail, Context, Error};
1use anyhow::{anyhow, bail, Context, Error};
2use arc_swap::access::DynAccess;
2use arc_swap::access::DynAccess;
3use futures_util::future::BoxFuture;
4use futures_util::future::BoxFuture;
4use futures_util::FutureExt;
5use futures_util::FutureExt;
5use helix_core::auto_pairs::AutoPairs;
6use helix_core::auto_pairs::AutoPairs;
@@ -158,6 +159,7 @@ pub struct Document {
158 language_server: Option<Arc<helix_lsp::Client>>,
159 language_server: Option<Arc<helix_lsp::Client>>,
160 diff_handle: Option<DiffHandle>,
161 diff_handle: Option<DiffHandle>,
162+ version_control_head: Option<Arc<ArcSwap<Box<str>>>>,
163use std::{fmt, mem};
165use std::{fmt, mem};
@@ -404,6 +406,7 @@ impl Document {
404 language_server: None,
406 language_server: None,
405 diff_handle: None,
407 diff_handle: None,
409+ version_control_head: None,
409 pub fn default(config: Arc<dyn DynAccess<Config>>) -> Self {
412 pub fn default(config: Arc<dyn DynAccess<Config>>) -> Self {
@@ -707,6 +710,8 @@ impl Document {
707 None => self.diff_handle = None,
710 None => self.diff_handle = None,
713+ self.version_control_head = provider_registry.get_current_head_name(&path);
@@ -1158,6 +1163,17 @@ impl Document {
1166+ pub fn version_control_head(&self) -> Option<Arc<Box<str>>> {
1167+ self.version_control_head.as_ref().map(|a| a.load_full())
1170+ pub fn set_version_control_head(
1172+ version_control_head: Option<Arc<ArcSwap<Box<str>>>>,
1174+ self.version_control_head = version_control_head;
1161 #[inline]
1177 #[inline]
1162 /// Tree-sitter AST tree
1178 /// Tree-sitter AST tree
1163 pub fn syntax(&self) -> Option<&Syntax> {
1179 pub fn syntax(&self) -> Option<&Syntax> {