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

browse-at-remote broken in MELPA / on master with 28.1 #97

Open
gigawhitlocks opened this issue Mar 21, 2023 · 9 comments
Open

browse-at-remote broken in MELPA / on master with 28.1 #97

gigawhitlocks opened this issue Mar 21, 2023 · 9 comments

Comments

@gigawhitlocks
Copy link

Hi I'm using Emacs 28.1 and I recently updated all my packages, and noticed that browse-at-remote is completely broken on master and in the version on MELPA. Whenever I run browse-at-remote I get the following traceback on the version from master manually installed, or the latest from MELPA fetched w/ use-package or package-install

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  browse-at-remote--get-remote-type("github.com")
  browse-at-remote--file-url("/home/iwhitlock/.emacs.d/ian.org" 3043)
  browse-at-remote-get-url()
  browse-at-remote()
  funcall-interactively(browse-at-remote)
  call-interactively(browse-at-remote nil nil)
  command-execute(browse-at-remote)

nota bene that this occurs even with a completely vanilla GitHub repository -- this one isn't doing anything fancy and merely points to my Emacs configs here on GitHub.

I am able to work around this issue by installing the last tagged release, so something between that and master appears to be breaking things.

I hope this report helps bring your attention to the issue and sorry that I don't know what else info might be helpful to resolve it!

@rmuslimov
Copy link
Owner

Hello, I'm wondering if you have something specific set in your config.

  1. Can you please share output of
git config --get browseAtRemote.type
  1. I assume if you call (setq debug-on-error '(wrong-type-argument) debug-on-signal t) before reproducing it will provide more details trace.

  2. Also curious what is in 'git remote'

I also just checked master from MELPA and it works fine for me. I guess it may be a local issue

@gigawhitlocks
Copy link
Author

gigawhitlocks commented Mar 21, 2023

  1. nothing set:
.emacs.d master ✓ ➜ git config --get browseAtRemote.type
.emacs.d master ✓ ➜ 
  1. Traceback looks the same w/ that flag set, unfortunately:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  browse-at-remote--get-remote-type("github.com")
  browse-at-remote--file-url("/home/iwhitlock/.emacs.d/ian.org" 3281)
  browse-at-remote-get-url()
  browse-at-remote()
  funcall-interactively(browse-at-remote)
  call-interactively(browse-at-remote nil nil)
  command-execute(browse-at-remote)
  1. Just the remote here on GitHub:
.emacs.d master ✓ ➜ git remote -v
origin  [email protected]:gigawhitlocks/emacs-configs.git (fetch)
origin  [email protected]:gigawhitlocks/emacs-configs.git (push)

Full Emacs version:
GNU Emacs 28.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2022-12-27

@gigawhitlocks
Copy link
Author

gigawhitlocks commented Mar 21, 2023

Oh okay, I found some additional info.

I have this setting for another repo (censored slightly):

  (add-to-list 'browse-at-remote-remote-type-regexps '("^bitbucket.private\\.tld$" . "stash"))

Having this setting breaks browse-at-remote across all repos, but it used to be a valid setting. I guess it was deprecated in favor of git config --get browseAtRemote.type?

In any case, removing this setting allows browse-at-remote to work again. Up to you if you want to call that a regression or a deprecated feature. Thanks for the attention to the issue. Sorry if I'm reporting a not-bug.

@rmuslimov
Copy link
Owner

I dont't it was deprecated, but i'm seeing that format of this defcustom is slightly diff from what you're adding https://github.com/rmuslimov/browse-at-remote/blob/master/browse-at-remote.el#L76

Can you try adjusting to format with :host / :type fields as in the example above

@gigawhitlocks
Copy link
Author

gigawhitlocks commented Mar 21, 2023

That does fix it! How strange. I wish I could remember where I got the first config line; it worked as expected for a long time. Thank you so much for helping out, I never really expect that from community maintainers ❤️

Hopefully this issue will help someone in the future searching Google and save you the trouble.

For future reference the working config line looks like:

  (add-to-list 'browse-at-remote-remote-type-regexps '(:host "^bitbucket.private\\.tld$" :type "stash"))

@the-sun-will-rise-tomorrow
Copy link

the-sun-will-rise-tomorrow commented Feb 8, 2024

I think this sort of breaking change could have been handled a bit more gracefully by this package... as it breaks all users who have customized browse-at-remote-remote-type-regexps.

The problem seems to be here: (string-match-p (plist-get plist :host) host).
(plist-get plist :host) will return nil for old-style definitions, which will not be accepted by string-match-p.

FYI @ilmotta (73c4526)

@drewwells
Copy link

Running into this issue on some but not all files in a repo today. I have no browse-at-remote customizations and it's just a regular github non-enterprise repo.

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  s-contains-p("://" nil)
  browse-at-remote--get-url-from-remote(nil)
  browse-at-remote--file-url("/home/drew/src/github.com/org/repo..." 30)
  browse-at-remote-get-url()
  browse-at-remote-kill()
  funcall-interactively(browse-at-remote-kill)
  call-interactively(browse-at-remote-kill nil nil)
  command-execute(browse-at-remote-kill)

This was setup as ssh, but I changed to https to try to resolve the problem

git remote -v
origin  https://github.com/org/repo (fetch)
origin  https://github.com/org/repo (push)

@the-sun-will-rise-tomorrow

@drewwells That looks like a very different issue. It seems your problem comes from using a local remote, and nothing with configuration. Please take care about posting unrelated issues in existing threads, as doing so notifies a lot of people who can't help you with your problem.

@drewwells
Copy link

It's not a local remote as can be seen in git remote -v above. I'm getting the same error that you referred to here #97 (comment)
A nil is being passed into s-contains-p

Best I can tell, this is an issue with using ssh vs https for connecting to the remote.

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

4 participants