How to use the js-git/lib/modes.js.exec 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 / git-tree.js View on Github external
Object.keys(tree).forEach(function (key) {
        var entry = tree[key];

        // Copy non-rules as-is
        if (entry.mode !== modes.exec || !/\.rule$/.test(key)) {
          newTree[key] = entry;
          return;
        }

        var childPath = path ? path + "/" + key : key;
        var childRule = {
          path: childPath,
          root: root,
          hash: entry.hash
        };
        key = key.substring(0, key.length - 5);
        local[key] = loadRule(childPath, childRule);
      });
github creationix / tedit / src / git-tree.js View on Github external
var entry = tree[part];
          var newPath = partial ? partial + "/" + part : part;

          // If the child is a commit, make sure it's initialized
          if (entry && entry.mode === modes.commit) {
            if (!storage.hasRepo(newPath)) {
              if (callback) {
                return storage.initializeRepo(root, entry.hash, newPath, onLoad);
              }
              throw new Error("Missing repo at '" + newPath + "'");
            }
          }

          // When in baked mode, always be looking for executable rule entries.
          var ruleEntry = tree[part + ".rule"];
          if (bake && ruleEntry && ruleEntry.mode === modes.exec) {
            // Remember them for future reference.
            rules.push({
              path: newPath,
              root: root,
              hash: ruleEntry.hash
            });
          }

          if (!entry) {
            // If you get here, the entry didn't match
            // In raw-mode this is a no-find.
            if (!bake) break;
            // In bake mode, look for rule that may serve this path.
            return searchRules();
          }
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);
github creationix / tedit / src / ui / tree.js View on Github external
var repo = fs.findRepo(row.path);
    if (repo.fetch && config.current === config.head) {
      actions.push(
        {sep:true},
        {icon:"cw", label:"Sync with Remote", action: sync }
      );
      if (config.ahead && config.behind) {
        actions.push(
          {icon:"upload-cloud", label:"Force push", action: forcePush },
          {icon:"trash", label:"Discard Local Commits", action: discardCommits }
        );
      }
    }
  }
  else if (modes.isFile(row.mode)) {
    var label = (row.mode === modes.exec) ?
      "Make not Executable" :
      "Make Executable";
    actions.push(
      {sep:true},
      {icon:"asterisk", label: label, action: toggleExec}
    );
  }
  if (row.path) actions.push(
    {sep:true},
    {icon:"pencil", label:"Move " + type, action: moveEntry},
    {icon:"docs", label:"Copy " + type, action: copyEntry},
    {icon:"trash", label:"Delete " + type, action: removeEntry}
  );
  if (runtimes.length) {
    actions.push({sep:true});
    runtimes.forEach(function (runtime) {