zed-industries/zed · error

commit contains submodule/gitlink hunk

Error message

commit contains submodule/gitlink hunk

What it means

generate_evaluation_example_from_ordered_commit refuses commits whose diff contains a submodule/gitlink hunk; such entries cannot be replayed as text edits, so example generation from that commit is unsupported.

Source

Thrown at crates/edit_prediction_cli/src/split_commit.rs:656

/// Main function to generate an evaluation example from an ordered commit.
///
/// # Arguments
/// * `commit` - Chronologically ordered unified diff of the commit
/// * `repository_url` - URL of the repository
/// * `commit_hash` - Hash of the commit
/// * `split_point` - Point at which the commit will be split (None for random)
/// * `seed` - Optional seed for randomness
/// * `sample_num` - Optional sample number for generating unique names
pub fn generate_evaluation_example_from_ordered_commit(
    commit: &str,
    repository_url: &str,
    commit_hash: &str,
    split_point: Option<SplitPoint>,
    seed: Option<u64>,
    sample_num: Option<usize>,
) -> Result<ExampleSpec> {
    anyhow::ensure!(
        !has_submodule_gitlink_hunk(commit),
        "commit contains submodule/gitlink hunk"
    );

    let mut rng: Box<dyn rand::RngCore> = match seed {
        Some(seed) => Box::new(rand::rngs::StdRng::seed_from_u64(seed)),
        None => Box::new(rand::rngs::ThreadRng::default()),
    };

    // Parse and normalize the commit
    let mut patch = Patch::parse_unified_diff(commit);

    // Filter header to only keep lines starting with "//"
    let header_lines: Vec<&str> = patch
        .header
        .lines()
        .filter(|line| line.starts_with("//"))
        .collect();

View on GitHub (pinned to f4178619ac)

Solutions

  1. Pick a commit without submodule changes
  2. Filter out gitlink hunks from the diff before generation if supported
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/edit_prediction_cli/src/split_commit.rs:656 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/42e991c0c26b08c6. Report an issue: GitHub.