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

gs fixes #310

Merged
merged 1 commit into from
Apr 19, 2021
Merged

gs fixes #310

merged 1 commit into from
Apr 19, 2021

Conversation

yhpark
Copy link
Contributor

@yhpark yhpark commented Apr 14, 2021

  • Branch names containing dots (.) are now correctly parsed.
    (although not sure why '.' was in the regex in the first place.)
  • Color/bold style is now correctly applied.
  • Fixed a bug where no-change status is not detected.

before:

image

after:

image
image

Copy link
Member

@ghthor ghthor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks fine.

if @git_status == ""
puts "%s#%s On branch: %s#{@branch}#{difference} %s| \033[0;32mNo changes (working directory clean)%s" % [
@c[:dark], @c[:rst], @c[:branch], @c[:dark], @c[:rst]
if @changes.size == 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is a functional change here, but I wonder why this was left as a string comparison.

@yhpark
Copy link
Contributor Author

yhpark commented Apr 20, 2021

@ghthor I just found there's an untended change introduced from this fix: if the branch is remote-tracking, git status --porcelain -b prints ## {local_branch}...{remote_branch} so the branch name is now parsed like branch...origin/branch. For me this is fine but if you want it the way before, changing the regex to something like ^## (?:Initial commit on )?(.*?)(?:\.\.\.| |$) would work.

ref: git doc says branch name cannot contain two or more consecutive dots.

@ghthor
Copy link
Member

ghthor commented Apr 20, 2021

I think the change is fine. Just to clarify with some output. The change to the @branch variable is purely for the output of gs and I think showing the remote tracking branch as part of the output is an improvement here.

From this master

$ gs
# On branch: master |  [*] => $e*
#
➤ Untracked files
#
#      untracked: [1] lib/fun.sh 
#

To This master...origin/master

$ gs
# On branch: master...origin/master  |  [*] => $e*
#
➤ Untracked files
#
#      untracked: [1] lib/fun.sh 
#

@yhpark yhpark deleted the gs-fix branch April 21, 2021 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants