refactor: migrate create_evolution_backup internals to git2, remove get_head_sha wrapper#290
Closed
Scott McMaster (scottmcmaster) wants to merge 2 commits into
Conversation
This was referenced Jun 3, 2026
Closed
Collaborator
Author
create_evolution_backup internals to git2, remove get_head_sha wrapper
Copilot started reviewing on behalf of
Scott McMaster (scottmcmaster)
June 3, 2026 07:56
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the create_evolution_backup implementation to use git2 for object/index/ref-level operations, and removes the now-dead get_head_sha helper from the git query layer.
Changes:
- Migrates
create_evolution_backupinternals from CLI plumbing (write-tree/commit-tree/update-ref) togit2while retaining CLIgit add --allstaging semantics. - Removes
get_head_sha(thin wrapper aroundget_ref_sha("HEAD")) and updates query-layer unit tests accordingly. - Adds/updates unit tests validating backup behavior (staging semantics and updating an existing backup branch).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/native/src-tauri/src/git/query.rs | Removes get_head_sha and updates unit tests to use get_ref_sha("HEAD") directly. |
| apps/native/src-tauri/src/git/exec.rs | Refactors create_evolution_backup to use git2 for tree/commit/ref creation and expands unit test coverage for backup semantics. |
Comment on lines
606
to
610
| fn get_ref_sha_and_head_sha_resolve_head_commit() { | ||
| let (temp, commit_id) = repo_with_initial_commit(); | ||
| let path = temp.path().to_string_lossy().to_string(); | ||
|
|
||
| assert_eq!(get_ref_sha(&path, "HEAD"), Some(commit_id.to_string())); |
3 tasks
Juanpe Bolívar (arximboldi)
approved these changes
Jun 3, 2026
Juanpe Bolívar (arximboldi)
left a comment
Contributor
There was a problem hiding this comment.
Again much nicer...
05263cf to
a013bd8
Compare
1a61c7c to
300abf5
Compare
Contributor
📋 PR Overview
🔬 Coverage
|
cooper (czxtm)
approved these changes
Jun 4, 2026
Contributor
Merge activity
|
22304aa to
fdb0f7d
Compare
ce2d427 to
d28a178
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Port the high-leverage / low-risk / easy-implementation parts of
create_evolution_backupto git2. That makesget_head_shadead code so remove it.Test Plan
Added and updated unit tests, did some manual evolve-and-discard testing.
Docs
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.