How to use the js-git/lib/modes.js.isFile 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
readEntry(path, function (err, entry) {
      if (err) return callback(err);
      if (!entry.hash) return callback(err || new Error("Missing entry"));
      if (!modes.isFile(entry.mode)) return callback("Not a file");
      var repo = repos[entry.root];
      repo.loadAs("blob", entry.hash, function (err, blob) {
        if (!blob) return callback(err || new Error("Problem loading blob"));
        entry.blob = blob;
        callback(null, entry);
      });
    });
  }
github creationix / tedit / src / ui / tree.js View on Github external
makeUnique(row, name, mode, function (path) {
    if (modes.isFile(mode)) {
      activePath = path;
    }
    openPaths[row.path] = true;
    row.call(path, fs.writeEntry, {
      mode: mode,
      hash: hash
    });
  });
}
github creationix / tedit / src / ui / tree.js View on Github external
row.call(fs.prepEntry, newPath, function () {
        if (modes.isFile(row.mode)) activePath = path;
        row.call(copy, path);
        row.call(fs.copyEntry, path);
      });
    });
github creationix / tedit / src / ui / tree.js View on Github external
var config = fs.configs[row.path];
    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});