git-link icon indicating copy to clipboard operation
git-link copied to clipboard

allow to type a branch name

Open parkouss opened this issue 8 years ago • 3 comments

Hi, first, thanks for this package!

I have a request - I am sometimes working on a local branch (not pushed to a remote location) and in this case using git-link generate a wrong url. Would it be possible to allow to chose the branch in some cases? I am thinking of something simple, e.g:

M-x git-link => do not prompt, generate link C-u M-x git-link => ask for the remote name first C-u C-u M-x git-link => ask for the remote and the branch name

Note that the first two options are already working this way, so it should not break the workflow for other users.

What do you think? I could work on a simple PR to implement this if you like the idea.

parkouss avatar Apr 03 '16 15:04 parkouss

Hi!

I am sometimes working on a local branch (not pushed to a remote location) and in this case using git-link generate a wrong url

Do you know about these options?

Would it be possible to allow to chose the branch in some cases?

Certainly seems reasonable.

I am thinking of something simple, e.g: M-x git-link => do not prompt, generate link C-u M-x git-link => ask for the remote name first C-u C-u M-x git-link => ask for the remote and the branch n

Also seems reasonable, though could this be done another way? Just curious.

What do you think? I could work on a simple PR to implement this if you like the idea.

Pull request it up! :neckbeard:

sshaw avatar Apr 14 '16 23:04 sshaw

C-u M-x git-link => ask for the remote name first C-u C-u M-x git-link => ask for the remote and the branch name

But... what if someone only wants to specify the branch name? May get complicated.

At some point I wanted to remove git-link-commit and incorporate it into git-link. That's a lot of prefix options. So I guess my question of "could this be done another way" may be somewhat more relevant.

Maybe it's sign that adding git-link-commit to git-link is a bad idea. Or, that prompting for branch is 😈.

sshaw avatar Apr 14 '16 23:04 sshaw

What about functions like these?

(defun git-link-master-branch ()
  (interactive)
  (let ((git-link-default-branch "master"))
    (call-interactively 'git-link)))
(defun git-link-at-commit ()
  (interactive)
  (let ((git-link-use-commit t))
    (call-interactively 'git-link)))

ibizaman avatar Mar 11 '18 18:03 ibizaman