-
Notifications
You must be signed in to change notification settings - Fork 422
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
feat(VCS): display the remote repository name #784
Conversation
- Only if LP_ENABLE_VCS_REMOTE is enabled (disabled by default, as the function parses a file and the output takes some room). - Introduces LP_MARK_VCS_REMOTE. - Re-use LP_COLOR_COMMITS and LP_COLOR_COMMITS_BEHIND. Refs: #782
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basics look good.
There was a bug in the function, and tests had to use a local remote on an existing branch. |
Co-authored-by: Mark Vander Stel <mvndrstl@gmail.com>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't comment on lines that didn't change, so I'll say it here:
- You are missing an empty definition for
_lp_svn_remote()
.
This is pretty much done, other than the large issue of the lp_vcs_dir
. But I can take care of that, and since the other stuff is pretty small, I can wrap it all up if you like.
Git SVN detection and the new remote branch detection were broken when in a worktree. Worktrees have two Git dirs: one is the main dir, which holds the DB and config. The other is the worktree specific dir, which holds directory specific information, like index and status like merge or rebase in progress.
@nojhan I pushed two commits to this PR to fix the issues I saw. If you could just take a quick look I can merge this. |
PR looks good (I'm trying hard to find something you forgot, like I always do, but I fail miserably). On the design side, I am now thinking that the remote name display should only occur when there are commits to be pushed or pulled, and not displayed (even with This would probably only require the last control flow section of What do you think of the idea? |
This would look like: if _lp_vcs_remote; then
# Commits behind but not ahead.
if [[ "$lp_vcs_commit_behind" -ne "0" && "$lp_vcs_commit_ahead" -eq "0" ]]; then
lp_vcs_details_color+="${LP_COLOR_COMMITS_BEHIND}${LP_MARK_VCS_REMOTE}${lp_vcs_remote}${NO_COL}"
# Commits ahead but not behind.
elif [[ "$lp_vcs_commit_behind" -eq "0" && "$lp_vcs_commit_ahead" -ne "0" ]]; then
lp_vcs_details_color+="${LP_COLOR_COMMITS}${LP_MARK_VCS_REMOTE}${lp_vcs_remote}${NO_COL}"
# Commits both ahead and behind: the mark is colored differently.
elif [[ "$lp_vcs_commit_behind" -ne "0" && "$lp_vcs_commit_ahead" -ne "0" ]]; then
lp_vcs_details_color+="${LP_COLOR_COMMITS_BEHIND}${LP_MARK_VCS_REMOTE}${LP_COLOR_COMMITS}${lp_vcs_remote}${NO_COL}"
# else: display nothing.
fi
fi |
Yeah I like that much more actually. I added bb32831 with that change. |
The related doc may be outdated after this change. |
Good call, I amended commit 98e861e with clarified docs. |
Refs: #782