pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.37k stars 127 forks source link

Can PRs have a default title? #444

Closed aaronmcadam closed 11 months ago

aaronmcadam commented 11 months ago

Issue Description

Type: feature request

Describe what happened (or what feature you want)

I'd like pr create to use a default title of the latest or first commit like the gh CLI works. This would save me a bit of time because I often need to rewrite the title based on a commit message.

Describe what you expected to happen

I expected the title to default to my latest or first commit message.

How to reproduce it (as minimally and precisely as possible)

  1. Run Octo pr create
  2. See that you have to manually input a title
  3. Wish that this functionality was in Octo.nvim

Tell us your environment

OS: macOS 14.1 23B74 arm64 Host: Mac14,6 Kernel: 23.1.0 Uptime: 23 hours, 37 mins Packages: 106 (brew) Shell: fish 3.6.1 Resolution: 3008x1692, 3008x1692 DE: Aqua WM: yabai Terminal: zellij CPU: Apple M2 Max GPU: Apple M2 Max Memory: 9036MiB / 98304MiB

Anything else we need to know?

joshmedeski commented 11 months ago

Looks like there is some logic already attempting to get a default title, perhaps it just needs updated? https://github.com/pwntester/octo.nvim/blob/e933611c74cb735c00d0db8ca94533bec1444bf0/lua/octo/commands.lua#L905

aaronmcadam commented 11 months ago

Looks like there is some logic already attempting to get a default title, perhaps it just needs updated?

https://github.com/pwntester/octo.nvim/blob/e933611c74cb735c00d0db8ca94533bec1444bf0/lua/octo/commands.lua#L905

Yeah, I know I saw it work once or twice before, but 99% of the time, it fails to get a default title.

aaronmcadam commented 11 months ago

According to this, it should already be taking the last commit: https://github.com/pwntester/octo.nvim/blob/e933611c74cb735c00d0db8ca94533bec1444bf0/lua/octo/commands.lua#L891C33-L891C33

aaronmcadam commented 11 months ago

ahh running the same git command locally, I get:

❯ git log -1 --pretty=%B
error: cannot run difftastic: No such file or directory
organise imports skip-ci

So the pretty formatted is failing to find my diff tool (difftastic)

vitorf7 commented 11 months ago

According to this, it should already be taking the last commit: https://github.com/pwntester/octo.nvim/blob/e933611c74cb735c00d0db8ca94533bec1444bf0/lua/octo/commands.lua#L891C33-L891C33

Interesting. If you were to normally open it in Github, most of the time for me it tends to use the first commit I believe, which is why my first commit tends to be the conventional commits title that I intend my PR to have as well as my squash-merge since I tend to then remove most of the body (although that is a different use case that I think someone has created an issue ticket as well for).

aaronmcadam commented 11 months ago

So fixing my git log command didn't help. I see the following messages when trying to create a new PR:

CleanShot 2023-11-03 at 16 58 59@2x

aaronmcadam commented 11 months ago

That OctoEditable xxx cleared looks suspect to me.

joshmedeski commented 11 months ago

Fixed it, a little pair programming with @aaronmcadam

pwntester commented 11 months ago

Thanks for the fix folks. Appreciate it!