<commit_before>// --------------------------------------------------------------------
// ----------------------      GitGraph         -----------------------
// --------------------------------------------------------------------

function GitGraph(options) {
  // Options
  options = options || {};

  this.elementId = options.elementId || "gitGraph";
  this.colors = options.colors || ["#6963FF", "#47E8D4", "#6BDB52", "#E84BA5", "#FFA657"];
  this.commitsSpacing = options.commitsSpacing || 25;
  this.mergeCommit = options.mergeCommit || true;
  this.author = options.author || '<NAME> <<EMAIL>>';
  this.messageDisplay = options.messageDisplay || true;

  // Canvas init
  this.canvas = document.getElementById(this.elementId);
  this.context = this.canvas.getContext('2d');
  this.origin = options.origin || this.canvas.height - 10;

  // Navigations vars
  this.HEAD = null;
  this.branchs = [];
  this.commitOffset = 0;
  
  // Utilities
  this.columnMax = 0;

  // Error: no render()
  this.context.fillStyle = 'red';
  this.context.font = 'bold 15pt Calibri';
  this.context.fillText('Error: No render() at the end', 150, 100);
}

GitGraph.prototype.branch = function (options) {
  options = options || {};
  options.context = this.context;
  options.colors = this.colors;
  options.parentBranch = options.parentBranch || this.HEAD;

  // Calcul origin of branch
  if (options.parentBranch instanceof Branch) {
    options.origin = options.parentBranch.origin - (options.parentBranch.commits.length + 1) * this.commitsSpacing;
  } else {
    options.origin = this.origin;
  }

  options.parent = this;

  var branch = new Branch(options);
  this.branchs.push(branch);

  // Offset for first commit
  if (branch.parentBranch instanceof Branch && branch.column - branch.parentBranch.column == 1)
    this.commitOffset += this.commitsSpacing;

  return branch;
}

GitGraph.prototype.commit = function (options) {
  this.HEAD.commit(options);
}

GitGraph.prototype.render = function () {
  // Clear All
  this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);

  // Render
  for (var i = 0; i < this.branchs.length; i++) {
    this.branchs[i].updateSize();
    this.branchs[i].draw();
  }
}
<commit_msg>Some comments<commit_after>// --------------------------------------------------------------------
// ----------------------      GitGraph         -----------------------
// --------------------------------------------------------------------

function GitGraph(options) {
  // Options
  options = options || {};

  this.elementId = options.elementId || "gitGraph";
  this.colors = options.colors || ["#6963FF", "#47E8D4", "#6BDB52", "#E84BA5", "#FFA657"];
  this.commitsSpacing = options.commitsSpacing || 25;
  this.mergeCommit = options.mergeCommit || true;
  this.author = options.author || '<NAME> <<EMAIL>>';
  this.messageDisplay = options.messageDisplay || true;

  // Canvas init
  this.canvas = document.getElementById(this.elementId);
  this.context = this.canvas.getContext('2d');
  this.origin = options.origin || this.canvas.height - 10;

  // Navigations vars
  this.HEAD = null;
  this.branchs = [];
  this.commitOffset = 0;
  
  // Utilities
  this.columnMax = 0;

  // Error: no render()
  this.context.fillStyle = 'red';
  this.context.font = 'bold 15pt Calibri';
  this.context.fillText('Error: No render() at the end', 150, 100);
}

/**
 * Create new branch
 **/
GitGraph.prototype.branch = function (options) {
  options = options || {};
  options.context = this.context;
  options.colors = this.colors;
  options.parentBranch = options.parentBranch || this.HEAD;

  // Calcul origin of branch
  if (options.parentBranch instanceof Branch) {
    options.origin = options.parentBranch.origin - (options.parentBranch.commits.length + 1) * this.commitsSpacing;
  } else {
    options.origin = this.origin;
  }

  options.parent = this;

  var branch = new Branch(options);
  this.branchs.push(branch);

  // Offset for first commit
  if (branch.parentBranch instanceof Branch && branch.column - branch.parentBranch.column == 1)
    this.commitOffset += this.commitsSpacing;

  return branch;
}

/**
 * Commit on HEAD
 **/
GitGraph.prototype.commit = function (options) {
  this.HEAD.commit(options);
}

/**
 * Render the canvas
 **/
GitGraph.prototype.render = function () {
  // Clear All
  this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);

  // Render
  for (var i = 0; i < this.branchs.length; i++) {
    this.branchs[i].updateSize();
    this.branchs[i].draw();
  }
}

{'fraction_non_alphanumeric': 0.2207276736493936, 'fraction_numerical': 0.01631753031973539, 'mean_word_length': 2.4625954198473283, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3691752', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1364, 'n_words': 288}