Wednesday, January 01, 2020

Nested Git repository support for Atom editor

Our 200 repository project for Chef consist of many nested repositories (one 'base' repo with essentials, which in turn contains 'cookbooks'). This was quite big frustration and super-inconvenient to use editors neither of which were supporting nested Git repos in full. Atom has in general good Chef support (via extensions), but nested Git repositories still not supported (at least by the time this article is written).

This is especially frustrating when several cookbooks modified and there are no indicators of what's already committed, what files were touched added, removed or modified in the end.

So, I've modified 'tree-view' component - one of core components Atom has, which is responsible for showing directory view on the left, so that now it shows statuses of all nested repositories (no matter how deep nesting is) giving good overview on the changes being made.

Here is example how it looks:

repo_highlights


Unfortunately Atom maintainers in the end closed suggested Pull Request -
https://github.com/atom/tree-view/pull/469

Reasoning is unclear and vague.
However, I've made release of tree-view from own fork.

Notes:

Works quite well even with >200 nested .git repos, though with some minor limitations:
  1. If there are a lot of nested. git repos then start-up time might noticeably increase(with ~200 repos it was 10 sec). The reason is that GitRepository object seems to be not fully async while refreshing status.
  2. Status refresh of GitRepositry objects on window_focus event is disabled, so if repos changed out of the Atom it might reflect wrong status. But there is option (right-click or assign shortcut) to force-refresh status of a subtree (recursively) or specific repo.

    or via command palette.



Download tree-view:
https://github.com/jarig/tree-view/releases/download/0.228.0-jarig/tree-view.zip

Installation instructions:
  • Unpack contents to ~\.atom\packages\tree-view
    (on windows C:\Users\[username]\.atom\packages\tree-view)
  • Re-open Atom
Atom might show bug icon in the status bar, asking to rebuild packages - do that in this case and tree-view will appear after Atom reload (ctrl+k to toggle tree-view back).




Verified to be working with Atom version 1.42.0