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

pull request stack is empty when abbrevCommit=true #368

Open
dansimau opened this issue Nov 26, 2023 · 0 comments
Open

pull request stack is empty when abbrevCommit=true #368

dansimau opened this issue Nov 26, 2023 · 0 comments

Comments

@dansimau
Copy link

As mentioned here:
#213 (comment)

Problem

git spr up returns pull request stack is empty — even when there are local commits to be pushed and PRs created — when the following git config is present:

[log]
    abbrevCommit=true

helpers.go:78 defines the following regexp for extracting the commit hash:

^commit ([a-f0-9]{40})

However, when using abbreviated commit hashes, this regexp doesn't match. Here is an example of log output with an abbreviated commit hash:

commit ca06022

Using the following config options, the commit hash length could be anywhere between 1-40 characters:

Solutions

  1. Modify the regexp to reflect that a commit hash can be between 1-40 chars, i.e.:
-       commitHashRegex := regexp.MustCompile(`^commit ([a-f0-9]{40})`)
+       commitHashRegex := regexp.MustCompile(`^commit ([a-f0-9]{1,40})`)
  1. Always add --no-abbrev-commit when running git log

I would go with option (1), because it is backwards-compatible with git versions prior to the --no-abbrev-commit flag appearing (didn't check when this was though).

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

No branches or pull requests

1 participant