@@ -813,6 +813,7 @@ impl Thread {
}
fn finalize_pending_checkpoint(&mut self, cx: &mut Context<Self>) {
+ dbg!("finalize_pending_checkpoint");
let pending_checkpoint = if self.is_generating() {
return;
} else if let Some(checkpoint) = self.pending_checkpoint.take() {
@@ -829,10 +830,13 @@ impl Thread {
pending_checkpoint: ThreadCheckpoint,
cx: &mut Context<Self>,
) {
+ dbg!("finalize_checkpoint");
let git_store = self.project.read(cx).git_store().clone();
let final_checkpoint = git_store.update(cx, |git_store, cx| git_store.checkpoint(cx));
cx.spawn(async move |this, cx| match final_checkpoint.await {
Ok(final_checkpoint) => {
+ dbg!(&pending_checkpoint.git_checkpoint);
+ dbg!(&final_checkpoint);
let equal = git_store
.update(cx, |store, cx| {
store.compare_checkpoints(
@@ -844,7 +848,7 @@ impl Thread {
.await
.unwrap_or(false);
- if !equal {
+ if dbg!(!equal) {
this.update(cx, |this, cx| {
this.insert_checkpoint(pending_checkpoint, cx)
})?;
@@ -860,6 +864,7 @@ impl Thread {
}
fn insert_checkpoint(&mut self, checkpoint: ThreadCheckpoint, cx: &mut Context<Self>) {
+ dbg!("insert_checkpoint");
self.checkpoints_by_message
.insert(checkpoint.message_id, checkpoint);
cx.emit(ThreadEvent::CheckpointChanged);
@@ -867,6 +872,7 @@ impl Thread {
}
pub fn last_restore_checkpoint(&self) -> Option<&LastRestoreCheckpoint> {
+ dbg!();
self.last_restore_checkpoint.as_ref()
}
@@ -1492,13 +1492,19 @@ impl GitRepository for RealGitRepository {
let mut excludes = exclude_files(git).await?;
git.run(&["add", "--all"]).await?;
- let tree = git.run(&["write-tree"]).await?;
+ dbg!("added all files");
+ let tree = git.run(&["write-tree"]).await;
+ dbg!(&tree);
+ let tree = tree?;
let checkpoint_sha = if let Some(head_sha) = head_sha.as_deref() {
+ dbg!(&["git", "commit-tree", &tree, "-p", head_sha, "-m", "Checkpoint"]));
git.run(&["commit-tree", &tree, "-p", head_sha, "-m", "Checkpoint"])
.await?
} else {
+ dbg!(&["git", "commit-tree", &tree, "-m", "Checkpoint"]);
git.run(&["commit-tree", &tree, "-m", "Checkpoint"]).await?
};
+ dbg!(&checkpoint_sha);
excludes.restore_original().await?;
@@ -1551,6 +1557,8 @@ impl GitRepository for RealGitRepository {
left: GitRepositoryCheckpoint,
right: GitRepositoryCheckpoint,
) -> BoxFuture<'_, Result<bool>> {
+ // todo! fail or short circuit
+
let working_directory = self.working_directory();
let git_binary_path = self.git_binary_path.clone();
@@ -1559,6 +1567,11 @@ impl GitRepository for RealGitRepository {
.spawn(async move {
let working_directory = working_directory?;
let git = GitBinary::new(git_binary_path, working_directory, executor);
+ log::error!(
+ "git diff-tree --quiet {} {}",
+ left.commit_sha,
+ right.commit_sha
+ );
let result = git
.run(&[
"diff-tree",
@@ -1567,6 +1580,7 @@ impl GitRepository for RealGitRepository {
&right.commit_sha.to_string(),
])
.await;
+ dbg!(&result);
match result {
Ok(_) => Ok(true),
Err(error) => {