Skip to content

Squash merge fails for any user without a global Git identity, despite a specified fallback #34

Closed

Description

@superman2003

Summary

A user who has never run git config --global user.name cannot squash-merge.
merge_changes fails with CommitIdentityNotConfigured instead of falling
back to the VibeX identity.

That is a normal state for a GUI-first user who has never used the Git CLI —
exactly the audience a desktop app orchestrating agents serves.

Root cause

crates/git/src/init_ops.rs has two resolvers:

// hard error when no identity is configured
pub(crate) fn configured_signature<'a>(&self, repo: &'a Repository) -> ... {
    ...
    Err(GitServiceError::CommitIdentityNotConfigured)
}

// falls back to VibeX <noreply@vibex.com>
fn signature_for_initial_commit<'a>(&self, repo: &'a Repository) -> ... {
    match self.configured_signature(repo) {
        Err(GitServiceError::CommitIdentityNotConfigured) => {
            git2::Signature::now(BOOTSTRAP_COMMIT_NAME, BOOTSTRAP_COMMIT_EMAIL)
        }
        ...
    }
}

Only the bootstrap commit uses the fallback. branch_workflow_ops.rs calls
the hard-erroring one:

let signature = self.configured_signature(&task_repo)?;

The intended behaviour is already specified

crates/git/tests/git_workflow.rs::squash_merge_libgit2_sets_author_without_user
spells it out, down to the exact identity:

// Verify merge_changes (libgit2 path) uses fallback author when no config exists
...
} else {
    assert_eq!(name.as_deref(), Some("VibeX"));
    assert_eq!(email.as_deref(), Some("noreply@vibex.com"));
}

The test has a has_global_git_identity() guard, so on any machine with a
global identity it takes the other branch and passes — which is why this has
gone unnoticed.

Reproduce

On a machine with no global user.name / user.email:

cargo test -p git --test git_workflow squash_merge_libgit2_sets_author_without_user

Note on a neighbouring contradiction

commit_without_user_config_succeeds in the same file asserts the opposite
for plain commits — that they succeed without an identity — while
configured_signature's own doc comment says "A missing identity is an
actionable error". That test is also non-hermetic (it only skips the
repo-local config, never isolating the global one).

#20 resolves it toward the documented error for plain commits and toward the
already-specified fallback for merges, on the reading that VibeX-authored
commits should not hard-fail while user-authored ones should ask the user to
configure Git. If that split is wrong, it is a one-line change either way.

Related: #21

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions