arl / tmux-gitbar

Git in your tmux status bar
GNU General Public License v3.0
169 stars 16 forks source link

Initial rc support #40

Closed alexkornitzer closed 7 years ago

alexkornitzer commented 7 years ago

This is basically a clone of functionality available in bash-git-prompt. ATM it only supports the ability to ignore repos in the same way as the aforementioned project.

The above kind of covers it, haven't updated the README incase you reject the changes or wish to change aspects of this. Have only ported the ignore feature as I use it. It currently supports TMUX_GITBAR_IGNORE and stores it in .tmux-gitbar-rc

arl commented 7 years ago

Hi Alex, I'm not against the idea, but why add a new configuration file? while we could add a new option to the current one (option that would default to disabled).

alexkornitzer commented 7 years ago

This file is more of a per repo configuration file, i.e. disable tmux-gitbar for certain repos.

arl commented 7 years ago

It makes sense. I'm ok with that, but i would prefer to have it called .tmgb-ignore. Can you update the PR please?

alexkornitzer commented 7 years ago

Yep I can so that, but that change only makes sense if there are no future plans to support other repo specific stuff like: GIT_PROMPT_FETCH_REMOTE_STATUS=0, and GIT_PROMPT_SHOW_UNTRACKED_FILES=no (taken from bash-git-prompt).

So I could name as above and then just check that the file exists and ignore its contents or I could name the file something like .tmgb-rc or .tmgb-local.conf and check for the IGNORE variable in the file?

arl commented 7 years ago

If one wants to ignore a repo, one won't need other conf options for this repo, so i guess checking for the existence of .tmgb-ignore in the repo would make the trick. If and when we will support repo-specific options, the configuration file shall have a different name, like .tmgbconf for example.

arl commented 7 years ago

Maybe .tmgbignore is better? so the repo-specific file could be .tmgbconfig and this woudl be kind of symmetric with git!

alexkornitzer commented 7 years ago

Could go straight with .tmgbconfig as if we are mirroring git style then you put the files you want to ignore in the .gitignore which would conflict the the style proposed above.

Also is tmgb meant to update when changing pane, as it does not do that for me! And is it possible to be more precise with the tmgb placement?

arl commented 7 years ago

Checking the existence of a file is straightforward, overall if one wants to have its repo ignored. Don't forget udpate-gitbar is run every time the user presses enter, so the less useless work it does, the best. Checking the existence of .tmgbignore is better for me than checking the existence of a file + actually reading it and looking for a specific value. I would stick with .tmgbignore

Prior to tmux 2.3, there was no way to know if the user switches pane, so the git bar updates to the repository corresponding to the current pane only after having pressed enter. I opened an issue about that: taking advantage of tmux 2.3 hook feature in order to update immediately when switching panes. At this point it's a bit of a major update because there won't be no more the need to install a $PROMPT_COMMAND.

About tmgb placement, there is only left or right for now. I feel like the status bar would be look bloated if we were mixing other information along with it, but that's just personal taste. But you can place tmux keywords inside the tmux status string

alexkornitzer commented 7 years ago

.tmgbignore approach done.

Ah right so that would require two implementations and a check for tmux version then, I assume?

Yeah, I can't think of an easy way to do it but I use tmuxline.vim and would ideally like it on the right but not as the rightmost element. Not a major problem though.

arl commented 7 years ago

Yes indeed.

arl commented 7 years ago

Before merging, I'd like to add about the new feature in the README, and add some basic tests. If you can do either of both, or both, that would be great. :D If not, I'll do it but I don't know when since i'm a bit overloaded currently. Thanks a lot Alex

alexkornitzer commented 7 years ago

Yeah I should be able to do that. Where do you want the feature in the README? and I assume I can append the tests into an already existing file?

arl commented 7 years ago

That's just perfect! Good job! Thanks a lot

alexkornitzer commented 7 years ago

No worries, had to make up for my botched last PR :)

arl commented 7 years ago

Ha ha... I've seen way worse ;-)

Le 23 nov. 2016 22:51, "Alex Kornitzer" notifications@github.com a écrit :

No worries, had to make up for my botched last PR :)

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/aurelien-rainone/tmux-gitbar/pull/40#issuecomment-262638609, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdF6qlb06SMZKCtOo6McZUaKR42eDszks5rBLVLgaJpZM4K6wvs .

rbuckley commented 6 years ago

What does the ignore actually do? I've put it in a large repo because it was causing me issues (taking several seconds to print the prompt because update_gitbar was running).

When I put .tmgbignore in the directory, the status on my tmux bar goes away, but I still see update_gitbar taking several seconds before the prompt is printed.

Thanks.

arl commented 6 years ago

Hi

Thanks for reporting!

.tmgbignore obviously should not do that, it should early exit as soon as possible, just after clearing tmux git status.

Out of curiosity, how large is your repo?

Could you post the output of:

time git status --porcelain -uall

If possible with and without tmux git bar. To disable, unexport PROMPT_COMMAND in a shell.

On Wed, 20 Jun 2018, 03:09 rbuckley, notifications@github.com wrote:

What does the ignore actually do? I've put it in a large repo because it was causing me issues (taking several seconds to print the prompt because update_gitbar was running).

When I put .tmgbignore in the directory, the status on my tmux bar goes away, but I still see update_gitbar taking several seconds before the prompt is printed.

Thanks.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/arl/tmux-gitbar/pull/40#issuecomment-398592591, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdF6sP4SmXJlW83S6deIm379AEfcD9Pks5t-aDdgaJpZM4K6wvs .

rbuckley commented 6 years ago

Hi, thanks for the quick response.

It is a large Android repo, about 28GB.

time outputs: With tmux gitbar real 0m4.564s user 0m1.396s sys 0m1.622s

After unexporting PROMPT_COMMAND real 0m3.629s user 0m1.190s sys 0m1.660s