How to use the js-git/lib/modes.commit function in js-git

To help you get started, we’ve selected a few js-git examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github creationix / tedit / src / data / git-tree.js View on Github external
function resolvePath(path, bake, callback) {
    var mode = modes.commit;
    var hash = storage.getRootHash();
    var root = "";

    var parts = path.split("/").filter(Boolean);
    path = parts.join("/");
    var index = 0;
    var partial = "";

    // In baked mode, we need to remember tree rules.
    var rules = bake ? [] : null;

    // Start the walk loop.
    return walk();

    function walk() {
      while (index < parts.length) {
github creationix / tedit / src / ui / tree-6.js View on Github external
], function (result) {
    if (!result) return;
    var url = result.url;
    // Assume github if user/name combo is given
    if (/^[^\/:@]+\/[^\/:@]+$/.test(url)) {
      url = "git@github.com:" + url + ".git";
    }
    var name = result.name || result.url.substring(result.url.lastIndexOf("/") + 1);
    var ref = result.ref || "refs/heads/master";
    makeUnique(row, name, modes.commit, function (path) {
      row.call(path, fs.addRepo, { url: url, ref: ref });
    });
  });
}
github creationix / tedit / src / data / git-tree.js View on Github external
}

          if (bake && (entry.mode === modes.sym)) {
             if (!check("blob", entry.hash)) return;
             var blob = storage.get(entry.hash);
             var link = binary.toUnicode(blob);
             var rest = parts.slice(index + 1).join("/");
             var linkPath = pathJoin(partial, link, rest);
             return resolvePath(linkPath, bake, callback);
          }

          // We're good, move on!
          mode = entry.mode;
          hash = entry.hash;
          partial = newPath;
          if (mode === modes.commit) root = partial;
          index++;
        }
      }

      return done(index >= parts.length);
    }
github creationix / tedit / src / ui / tree.js View on Github external
function onChange(hash) {
  renderChild("", modes.commit, hash);
  // Run any hooks
  Object.keys(hooks).forEach(function (root) {
    hooks[root](hash);
  });
}
github creationix / tedit / src / ui / tree-6.js View on Github external
function onChange(hash) {
  renderChild("", modes.commit, hash);
  // Run any hooks
  Object.keys(hooks).forEach(function (root) {
    hooks[root](hash);
  });
}
github creationix / wheaty / wheaty.js View on Github external
Object.keys(tree).map(function (name) {
      var entry = tree[name];
      if (entry.mode === modes.tree || entry.mode === modes.commit) name += "/";
      var icon = iconNames[entry.mode];
      if (icon === "icon-doc") {
        if (name === "LICENSE" || name === "README") {
          icon = "icon-doc-text";
        }
        else {
          var mime = getMime(name);
          if (/\bimage\b/.test(mime)) icon = "icon-file-image";
          else if (/\baudio\b/.test(mime)) icon = "icon-file-audio";
          else if (/\bvideo\b/.test(mime)) icon = "icon-file-video";
          else if (/(?:script|xml|html|source|json)/.test(mime)) icon = "icon-file-code";
          else if (/\btext\b/.test(mime)) icon = "icon-doc-text";
          else if (/zip\b/.test(mime)) icon = "icon-file-archive";
          else console.log(mime);
        }
      }
github creationix / tedit / src / ui / tree.js View on Github external
function init() {
    if ((mode === modes.tree || mode === modes.commit) && openPaths[path]) openTree(row);
    if (activePath && activePath === path) activateDoc(row, !selected);
  }
github creationix / tedit / src / ui / tree-6.js View on Github external
fs.init(onChange, function (err, hash) {
  if (err) throw err;
  openPaths[""] = true;
  rootRow = renderChild("", modes.commit, hash);
  rootEl.appendChild(rootRow.el);
});
github creationix / tedit / src / ui / tree.js View on Github external
fs.init(onChange, function (err, hash) {
  if (err) throw err;
  openPaths[""] = true;
  rootRow = renderChild("", modes.commit, hash);
  rootEl.appendChild(rootRow.el);
});
github creationix / tedit / src / ui / row.js View on Github external
function updateIcon() {
    var value =
      (errorMessage ? "icon-attention" :
      busy ? "icon-spin1 animate-spin" :
      mode === modes.sym ? "icon-link" :
      mode === modes.file ? "icon-doc" :
      mode === modes.exec ? "icon-cog" :
      mode === modes.commit ? "icon-fork" :
      open ? "icon-folder-open" : "icon-folder") +
        (mode === modes.commit ? " tight" : "");
    $.icon.setAttribute("class", value);
    var title = modes.toType(mode) + " " + hash;
    if (errorMessage) title += "\n" + errorMessage;
    $.icon.setAttribute("title", title);
    if (mode !== modes.commit) {
      if ($.folder) {
        $.row.removeChild($.folder);
        delete $.folder;
      }
    }
    else {
      if (!$.folder) {
        $.row.insertBefore(domBuilder(["i$folder"], $), $.icon);
      }
      $.folder.setAttribute("class", "icon-folder" + (open ? "-open" : ""));
      $.folder.setAttribute("title", "tree " + treeHash);