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

Add git-info module and update the magicmace theme accordingly #104

Closed
wants to merge 3 commits into from
Closed

Add git-info module and update the magicmace theme accordingly #104

wants to merge 3 commits into from

Conversation

ericbn
Copy link
Member

@ericbn ericbn commented Dec 2, 2016

Module code was based on the Prezto git module function and further refactored and simplified.

What changed:

  • Commit format only in 'detached HEAD' state, so $(coalesce "%b" "%c") is not needed, because you only get one of those.
  • Removed the added, deleted, modified, renamed and unmerged verbose contexts.
  • git status is only used in verbose mode.
  • In non-verbose mode, the untracked context is not available, and also untracked files are not considered for computing the dirty context. Using git status or checking for untracked files is expensive.

The change in the magicmace theme shows the simplification power of this module: a reduction of 28 lines of code.

I hope this solves @stefanosc's #82. I've been using this in my custom prompt for a few months.

based on the Prezto git module
[function](https://github.com/sorin-ionescu/prezto/blob/master/modules/git/functions/git-info)
and further refactored and simplified.

What changed:
- Commit format only in 'detached HEAD' state, so
  `$(coalesce "%b" "%c")` is not needed, because you only get one of
  those.
- Removed the `added`, `deleted`, `modified`, `renamed` and `unmerged`
  verbose contexts.
- `git status` is only used in verbose mode.
- In non-verbose mode, the `untracked` context is not available, and
  also untracked files are not considered for computing the `dirty`
  context. Using `git status` or checking for untracked files is
  [expensive](https://gist.github.com/sindresorhus/3898739).
@Eriner
Copy link
Member

Eriner commented Dec 3, 2016

@ericbn Thanks for the PR! The results look great. I'm going to look over this tomorrow and give others some time to look this over this as well.

to fix the "Special Action Contexts" title mistakenly being "Untracked
Contexts", and other minor changes.
@bartekrutkowski
Copy link

@Eriner How's the review going? This is the only thing that stops me migrating from prezto to zim personally ;)

@Eriner
Copy link
Member

Eriner commented Dec 23, 2016

@bartekrutkowski @ericbn Sorry about the delays, the code LGTM for the most part, beyond a few stylistic nitpicks that I can clean up after I merge. I probably won't get around to merging this until after the holidays, but I promise I will get this merged soon after!

@Eriner
Copy link
Member

Eriner commented Jan 6, 2017

@ericbn do you have any issue with me changing the title of your commits during the merge? I'd like them to match the format of the other commits, specifically [module] what changed

@Eriner Eriner added in progress question Further information is requested and removed RFC labels Jan 6, 2017
@ericbn
Copy link
Member Author

ericbn commented Jan 6, 2017 via email

@rjcoelho
Copy link

rjcoelho commented Jan 6, 2017

@Eriner why not make git-info a zsh plugin (into a separate repo) to be used by all. See https://github.com/unixorn/awesome-zsh-plugins/blob/master/Writing_Plugins.md.

I fell we are duplicating code by maintaining a {prezto,zim,omg}/git-info module which most prompts need.

@Eriner
Copy link
Member

Eriner commented Jan 7, 2017

In regards to @rjcoelho's suggestion, I'm all for making a plugin/library that's usable by other frameworks. Putting this work in its own repo sound good to me. @ericbn are you willing to push these commits to zimframework/git-info and maintain that module? :)

@ericbn
Copy link
Member Author

ericbn commented Jan 16, 2017

Sure, I can maintain zimframework/git-info. Since Eriner/zim is still being used, can we merge this PR too?

@Eriner
Copy link
Member

Eriner commented Jan 16, 2017

Yep, done! I'm leaving this open until I get around to creating that repo for you.

@ericbn
Copy link
Member Author

ericbn commented Jan 16, 2017

@Eriner, I was able to create https://github.com/zimframework/git-info, so it looks like I have the required permissions.

@Eriner
Copy link
Member

Eriner commented Jan 16, 2017

Oh, duh, I forgot I added you as a maintainer ;) Thanks!

@Eriner Eriner closed this Jan 16, 2017
@ericbn ericbn deleted the git-info branch January 16, 2017 18:34
@ericbn ericbn added enhancement New feature or request and removed feature labels May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Development

Successfully merging this pull request may close these issues.

4 participants