Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo status color on project root directory #1144

Merged
merged 3 commits into from Feb 28, 2018

Conversation

Projects
None yet
3 participants
@captin411
Copy link

captin411 commented Jul 5, 2017

This makes it easier to identify which projects have uncommitted
changes when working with more than one project.

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

I occasionally work with software projects that have more than one project folder added to them.

In these cases, it is difficult to identify which repositories I have uncommitted changed on.

This change bubbles up the '.status-modified' and '.status-added' CSS classes to the '.project-root' elements so that the repo modification status can be clearly seen when all folders are collapsed.

Alternate Designs

The code changes in the directory.coffee file could alternatively be put into the atom core. It would require a change to the logic of 'repo.getDirectoryStatus()' method.

The reason I avoided changin Atom core are twofold:

  • first is my concern with unexpected consequences for other plugin developers who use the repo.getDirectoryStatus (is the root folder coming back with a status of 0 a feature or a bug?)
  • second, an update here allows people to get this new feature by updating the plugin instead of all of Atom

In short, there is a bug(?) in repo.getDirectoryStatus('/my/root') which will calculate the relative path as @relativize("/my/root") + "/" resulting in the string "/". Then all of the git statuses (formatted like "subdir/file.txt") are evaluated and if statusPath.indexOf(relative_git_root) == 0 then it will consider the status of the parent folder to be of a particular value.

The problem is that, in the case of the root folder, it will never match character 0 since none of the status paths ever have a leading "/".

Benefits

People who want to see the repo status at the root level will be able to do so - especially useful for those who use multi-project often.

Possible Drawbacks

It is aesthetic and people are opinionated -- so some people might not like it.

Applicable Issues

n/a

David Bartle added some commits Jul 4, 2017

David Bartle
Colorize project-root folders with git status
This makes it easier to identify which projects have uncommitted
changes when working with more than one project.
David Bartle
@captin411

This comment has been minimized.

Copy link
Author

captin411 commented Jul 5, 2017

Here is an example of the final result:

screen shot 2017-07-04 at 15 19 25

David Bartle
@sc23ui

sc23ui approved these changes Jul 5, 2017

@daviwil

This comment has been minimized.

Copy link
Member

daviwil commented Feb 28, 2018

Looks great, thanks a lot @captin411!

@daviwil daviwil merged commit 154b1e0 into atom:master Feb 28, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.