pcottle/learnGitBranching · info · CommandResult

msg

Error message

msg

What it means

Not a failure: the classic (graph-only levels) git status path builds playful '# ...' lines, accumulates them into msg, and returns them via a thrown CommandResult. This mirrors old git status comment-style output.

Source

Thrown at src/js/git/index.js:3117

  var lines = [];
  if (this.getDetachedHead()) {
    lines.push(intl.str('git-status-detached'));
  } else {
    var branchName = this.resolveNameNoPrefix('HEAD');
    lines.push(intl.str('git-status-onbranch', {branch: branchName}));
  }
  lines.push('Changes to be committed:');
  lines.push('');
  lines.push(TAB + 'modified: cal/OskiCostume.stl');
  lines.push('');
  lines.push(intl.str('git-status-readytocommit'));

  var msg = '';
  lines.forEach(function (line) {
    msg += '# ' + line + '\n';
  });

  throw new CommandResult({
    msg: msg
  });
};

GitEngine.prototype.logWithout = function(ref, omitBranch) {
  // slice off the ^branch
  omitBranch = omitBranch.slice(1);
  this.log(ref, Graph.getUpstreamSet(this, omitBranch));
};

GitEngine.prototype.revlist = function(refs) {
  var range = new RevisionRange(this, refs);

  // now go through and collect ids
  var bigLogStr = range.formatRevisions(function(c) {
    return c.id + '\n';
  });

View on GitHub (pinned to 5b09d0ff96)

Solutions

  1. No fix needed
  2. Catch CommandResult to read the status text
Defensive patterns

Strategy: try-catch

Try / catch

try { engine.status(); } catch (e) { if (e instanceof CommandResult) { display(e.msg); } else throw e; }

Prevention

When it happens

Trigger: Running git status in a level without the changes model; the lines are prefixed with '# ' and joined into msg, then thrown as the result (index.js:3112-3118).

Common situations: Normal usage in classic levels; expected output.

Related errors


AI-assisted analysis of pcottle/learnGitBranching@5b09d0ff96 (2026-08-27). Data as JSON: /api/errors/08a765020cba4570. Report an issue: GitHub.