alphapapa / magit-todos

Show source files' TODOs (and FIXMEs, etc) in Magit status buffer
GNU General Public License v3.0
729 stars 49 forks source link

Performance problems when using magit-todos with TRAMP #132

Open johnhamelink opened 2 years ago

johnhamelink commented 2 years ago

Hi there,

First of all, I've found this extension to be very helpful indeed, particularly on a project I've inherited which has lots of TODOs that were never logged in an issue tracker!

Recently, I've been venturing beyond my desk with the help of TRAMP. However, I've found that for some reason magit-todos is not very reliable in this scenario. Specifically, there seems to be a hang during magit-todos--scan-with-git-diff. I can confirm that both the host and guest machines have ripgrep installed.

The good news, is that I seem to be able to replicate the problem by using TRAMP against localhost:

M-x project-switch-project /sshx:john@jupiter:~/code/mc/be/v2/mb_v2_backend/
g ;; to go to magit-status
M-x magit-todos-list

;; The modeline says "Opening connection
;; magit-todos--scan-with-git-diff for john@jupiter using sshx..."
;; with a spinner which stays active until it times out

(switch-to-buffer " *magit-todos--scan-with-git-diff*-127449")
;; Produces: "fatal: invalid object name 'fatal'."

Also of note, Emacs is maxing out my CPU while this happens.

I'd like to debug this further. But I'm unsure how?

One thought I had was to disable magit-todos for projects that are remote. Would that be feasible given magit-todos-mode is a global-minor-mode?

alphapapa commented 2 years ago

Hi,

Thanks, I'm glad that you've found it useful.

I very rarely use TRAMP, and never with magit-todos, so I don't know how much help I can be. I'd suggest trying to use the other scanners and see if that makes a difference. Also, try it on a small project rather than a large one. See also #57.

One thought I had was to disable magit-todos for projects that are remote.

If you need to, that seems like a good idea, yes. We might need to add an option for that and then a check in the code where appropriate (i.e. before running scanners).

johnhamelink commented 2 years ago

Hi there,

I don't know how much help I can be.

Completely reasonable!

I'd suggest trying to use the other scanners and see if that makes a difference.

OK, next time I'm working out of office I'll give that a go and report back.

Thank you :)

mohkale commented 4 months ago

@alphapapa Would you consider supporting a PR to make magit-todos a non-global mode? I'd like to disable it in remote projects but still keep it in locals and atm there doesn't seem to be an inbetween option :thinking:.

alphapapa commented 4 months ago

@alphapapa Would you consider supporting a PR to make magit-todos a non-global mode? I'd like to disable it in remote projects but still keep it in locals and atm there doesn't seem to be an inbetween option 🤔.

The intended way to disable scanning in a repository is to set magit-todos-update to nil.