atom-archive / xray

An experimental next-generation Electron-based text editor
MIT License
8.48k stars 235 forks source link

Expose basePath in WorkTree.prototype.entries #178

Closed as-cii closed 5 years ago

as-cii commented 5 years ago

Previously, when a rename occurred, it was impossible to determine the original path of a file.

With this pull request, when calling WorkTree.prototype.entries, each entry will now contain a basePath field that can either be:

This will be useful when an external index that exposes a diff-based interface needs to be kept up-to-date, e.g.:

if (entry.basePath) {
  if (entry.visible) {
    index.rename(entry.basePath, entry.path);
  } else {
    index.remove(entry.basePath);
  }
}