Skip to content

refactor: migrate create_evolution_backup internals to git2, remove get_head_sha wrapper#290

Closed
Scott McMaster (scottmcmaster) wants to merge 2 commits into
06-03-scott-tag-commit-with-git2from
06-03-scott-improve-create_evolution_backup
Closed

refactor: migrate create_evolution_backup internals to git2, remove get_head_sha wrapper#290
Scott McMaster (scottmcmaster) wants to merge 2 commits into
06-03-scott-tag-commit-with-git2from
06-03-scott-improve-create_evolution_backup

Conversation

@scottmcmaster

@scottmcmaster Scott McMaster (scottmcmaster) commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Port the high-leverage / low-risk / easy-implementation parts of create_evolution_backup to git2. That makes get_head_sha dead code so remove it.

Test Plan

Added and updated unit tests, did some manual evolve-and-discard testing.

  • No test plan needed

Docs

  • Docs updated (companion PR in darkmatter/nixmac-web: #___)
  • No docs update needed

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Scott McMaster (scottmcmaster) commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • automerge - adds this PR to the back of the merge queue
  • urgent - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@scottmcmaster Scott McMaster (scottmcmaster) changed the title scott-improve-create_evolution_backup refactor: migrate create_evolution_backup internals to git2, remove get_head_sha wrapper Jun 3, 2026
@scottmcmaster Scott McMaster (scottmcmaster) marked this pull request as ready for review June 3, 2026 07:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_backup internals from CLI plumbing (write-tree/commit-tree/update-ref) to git2 while retaining CLI git add --all staging semantics.
  • Removes get_head_sha (thin wrapper around get_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()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again much nicer...

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

📋 PR Overview

Lines changed 133 (+91 / -42)
Files 0 added, 3 modified, 0 deleted
Draft / WIP no
Has Test Plan yes
No Test Plan Needed no
New UI components no
New Storybook stories no
New Rust modules no
New TS source files no
New tests no
package.json touched no
Cargo.toml touched no
Infra / CI touched no

🔬 Coverage

Report Lines Statements Functions Branches
apps/native/coverage/coverage-summary.json 26.3% 26.4% 24.2% 17.9%

Generated by 🚫 dangerJS against ce2d427

@graphite-app

graphite-app Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • Jun 5, 12:29 AM UTC: czxtm added this pull request to the Graphite merge queue.
  • Jun 5, 12:30 AM UTC: CI is running for this pull request on a draft pull request (#318) due to your merge queue CI optimization settings.
  • Jun 5, 12:33 AM UTC: The Graphite merge queue removed this pull request due to downstack failures on PR #281.
  • Jun 5, 12:33 AM UTC: The Graphite merge queue removed this pull request due to downstack failures on PR #281.
  • Jun 5, 1:30 AM UTC: czxtm added this pull request to the Graphite merge queue.
  • Jun 5, 1:31 AM UTC: CI is running for this pull request on a draft pull request (#321) due to your merge queue CI optimization settings.
  • Jun 5, 1:37 AM UTC: Merged by the Graphite merge queue via draft PR: #321.

@scottmcmaster Scott McMaster (scottmcmaster) force-pushed the 06-03-scott-tag-commit-with-git2 branch from 22304aa to fdb0f7d Compare June 5, 2026 00:46
@scottmcmaster Scott McMaster (scottmcmaster) force-pushed the 06-03-scott-improve-create_evolution_backup branch from ce2d427 to d28a178 Compare June 5, 2026 00:46
@graphite-app graphite-app Bot closed this Jun 5, 2026
@graphite-app graphite-app Bot deleted the 06-03-scott-improve-create_evolution_backup branch June 5, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants