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

Protect from an infinite loop #405

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hexmode
Copy link

@hexmode hexmode commented Jul 2, 2019

No description provided.

@vermiculus
Copy link
Owner

Please use only spaces – no tabs. You might also consider chort-circuiting this and.

Can you explain what problem you're fixing and how this patch resolves the issue?

@hexmode
Copy link
Author

hexmode commented Jul 3, 2019

Without this check before the recursion, I was getting an infinite loop.

@hexmode
Copy link
Author

hexmode commented Jul 3, 2019

Section from backtrace:

  magithub-repo(((owner (login . "source")) (name . "mw-rel")))
  (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo))
  (progn (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo)))
  (if (magithub-online-p) (progn (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo))))
  (or (magithub-cache :repo-demographics (cons 'or (cons (list 'magithub-request (list 'ghubp-get-repos-owner-repo (list 'quote sparse-repo))) '((and (not ...) sparse-repo))))) (if (magithub-online-p) (progn (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo)))) sparse-repo)
  (if sparse-repo (or (magithub-cache :repo-demographics (cons 'or (cons (list 'magithub-request (list 'ghubp-get-repos-owner-repo (list ... sparse-repo))) '((and ... sparse-repo))))) (if (magithub-online-p) (progn (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo)))) sparse-repo) nil)
  (let* ((sparse-repo (and t (or sparse-repo (magithub-source--sparse-repo))))) (if sparse-repo (or (magithub-cache :repo-demographics (cons 'or (cons (list 'magithub-request (list ... ...)) '(...)))) (if (magithub-online-p) (progn (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo)))) sparse-repo) nil))
  (if (and (stringp sparse-repo) (string-match "\\`\\(\\(?:[[:alnum:]]\\|-\\|\\.\\|_\\)+?\\)/\\(\\(?:[[:alnum..." sparse-repo)) (magithub-repo (list (list 'owner (cons 'login (match-string 1 sparse-repo))) (cons 'name (match-string 2 sparse-repo)))) (let* ((sparse-repo (and t (or sparse-repo (magithub-source--sparse-repo))))) (if sparse-repo (or (magithub-cache :repo-demographics (cons 'or (cons (list ... ...) '...))) (if (magithub-online-p) (progn (let (...) (magithub-repo sparse-repo)))) sparse-repo) nil)))
  magithub-repo(((owner (login . "source")) (name . "mw-rel")))
  (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo))
  (progn (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo)))
  (if (magithub-online-p) (progn (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo))))
  (or (magithub-cache :repo-demographics (cons 'or (cons (list 'magithub-request (list 'ghubp-get-repos-owner-repo (list 'quote sparse-repo))) '((and (not ...) sparse-repo))))) (if (magithub-online-p) (progn (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo)))) sparse-repo)
  (if sparse-repo (or (magithub-cache :repo-demographics (cons 'or (cons (list 'magithub-request (list 'ghubp-get-repos-owner-repo (list ... sparse-repo))) '((and ... sparse-repo))))) (if (magithub-online-p) (progn (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo)))) sparse-repo) nil)
  (let* ((sparse-repo (and t (or sparse-repo (magithub-source--sparse-repo))))) (if sparse-repo (or (magithub-cache :repo-demographics (cons 'or (cons (list 'magithub-request (list ... ...)) '(...)))) (if (magithub-online-p) (progn (let ((magithub-cache--refresh t)) (magithub-repo sparse-repo)))) sparse-repo) nil))
  (if (and (stringp sparse-repo) (string-match "\\`\\(\\(?:[[:alnum:]]\\|-\\|\\.\\|_\\)+?\\)/\\(\\(?:[[:alnum..." sparse-repo)) (magithub-repo (list (list 'owner (cons 'login (match-string 1 sparse-repo))) (cons 'name (match-string 2 sparse-repo)))) (let* ((sparse-repo (and t (or sparse-repo (magithub-source--sparse-repo))))) (if sparse-repo (or (magithub-cache :repo-demographics (cons 'or (cons (list ... ...) '...))) (if (magithub-online-p) (progn (let (...) (magithub-repo sparse-repo)))) sparse-repo) nil)))
  magithub-repo(((owner (login . "source")) (name . "mw-rel")))
  (if repo (magithub-repo repo) nil)
  (let* ((repo (and t (magithub-repo-from-remote--sparse remote)))) (if repo (magithub-repo repo) nil))
  magithub-repo-from-remote(#("work" 0 4 (face magit-branch-remote)))
  (let ((repo (magithub-repo-from-remote (magit-get-push-remote branch)))) (if (alist-get 'fork repo) (progn (let* ((guess-head (format "%s:%s" (magit-get-push-remote branch) branch)) (prs (magithub-cache :ci-status (list ... ...)))) (let* ((val (length prs))) (cond ((eql val 0) nil) ((eql val 1) (magit-set ... "branch" branch "magithub" "sourcePR") (car prs)) (t (signal ... ...))))))))
  magithub-pull-request-branch->pr--ghub("master")
  (condition-case err (magithub-pull-request-branch->pr--ghub branch) ((debug error) (message "Error: %S" err) nil))
  (and (magithub-online-p) (condition-case err (magithub-pull-request-branch->pr--ghub branch) ((debug error) (message "Error: %S" err) nil)))
  (or (magithub-pull-request-branch->pr--gitconfig branch) (and (magithub-online-p) (condition-case err (magithub-pull-request-branch->pr--ghub branch) ((debug error) (message "Error: %S" err) nil))))
  (if (or (magithub-pull-request-branch->pr--gitconfig branch) (and (magithub-online-p) (condition-case err (magithub-pull-request-branch->pr--ghub branch) ((debug error) (message "Error: %S" err) nil)))) (magit-rev-parse branch) (let* ((push-branch (and t (magit-get-push-branch branch)))) (if push-branch (if (magit-branch-p push-branch) (progn (cdr (magit-split-branch-name push-branch)))) nil)))
  magithub-ci-status--get-default-ref()
  (let* ((ref (magithub-ci-status--get-default-ref)) (checks (magithub-ci-status ref)) (indent (make-string 10 32))) (if checks (progn (let* ((type38 'magithub-ci-status) (section39 (funcall (if ... type38 ...) :type (if ... ... type38) :value (cons ... ref) :start (point-marker) :parent magit-insert-section--parent))) (eieio-oset section39 'hidden (let* ((value ...)) (if value (eq value ...) (let* ... ...)))) (let ((magit-insert-section--current section39) (magit-insert-section--parent section39) (magit-insert-section--oldroot (or magit-insert-section--oldroot ...))) (catch 'cancel-section (magit-insert-heading (format "%-10s%s %s %s%s" "Status:" ... ... ... ...)) (let (... ...) (if ... ... ...)) (run-hooks 'magit-insert-section-hook) (magit-insert-child-count section39) (set-marker-insertion-type (eieio-oref section39 ...) t) (let* (... ... ... ... ...) (save-excursion ... ...)) (if (eq section39 magit-root-section) (let ... ...) (eieio-oset ... ... ...))) section39)))))
  magithub-insert-ci-status-header()
  (progn (magithub-insert-ci-status-header))
  (if (and (magithub-settings-include-status-p) (magithub-usable-p) (let ((b (magit-get-current-branch))) (or (magit-get-upstream-remote b) (magit-get-push-remote b)))) (progn (magithub-insert-ci-status-header)))
  magithub-maybe-insert-ci-status-header()
  apply(magithub-maybe-insert-ci-status-header nil)
  magit-run-section-hook(magit-status-headers-hook)
  magit-insert-headers(magit-status-headers-hook)
  magit-insert-status-headers()
  apply(magit-insert-status-headers nil)
  magit-run-section-hook(magit-status-sections-hook)
  magit-status-refresh-buffer()
  apply(magit-status-refresh-buffer nil)
  magit-refresh-buffer()
  magit-setup-buffer-internal(magit-status-mode nil ((magit-buffer-diff-args ("--no-ext-diff")) (magit-buffer-diff-files nil) (magit-buffer-log-args ("-n256" "--decorate")) (magit-buffer-log-files nil)))
  magit-status-setup-buffer(".../src/")
  vc-dir(nil ((434 . 16) (("..." "describe" "--contains" "HEAD")) (("..." "describe" "--long" "--tags")) (("..." "show" "--no-patch" "--format=%s" #("work/master^{commit}" 0 11 (face magit-branch-remote)) "--") . "just before submodules work") (("..." "rev-parse" "--verify" #("work/master" 0 11 (face magit-branch-remote))) . "c0a9dae9f4b248391f841126c051f6967daec237") (("..." "show" "--no-patch" "--format=%s" #("origin/master^{commit}" 0 13 (face magit-branch-remote)) "--") . "just before submodules work") (("..." "rev-parse" "--verify" "--abbrev-ref" "master@{upstream}") . "origin/master") (("..." "show" "--no-patch" "--format=%h %s" "HEAD^{commit}" "--") . "5b72fcb238 snapshot") (("..." "symbolic-ref" "--short" "HEAD") . "master") (("..." "rev-parse" "--verify" "HEAD") . "5b72fcb238aacf6ac1e83e330325bd34257b6dd5") (("..." . config) . #<hash-table equal 41/65 0x1563f21c2709>) (("..." . magit-toplevel) . "...") ((".../src/" . magit-toplevel) . "...") (("..." "rev-parse" "--show-toplevel") . "...") (("..." "rev-parse" "--show-cdup") . "") ((".../src/" "rev-parse" "--show-cdup") . "../") ((".../src/" "rev-parse" "--show-toplevel") . "...")))
  funcall-interactively(vc-dir nil ((434 . 16) (("..." "describe" "--contains" "HEAD")) (("..." "describe" "--long" "--tags")) (("..." "show" "--no-patch" "--format=%s" #("work/master^{commit}" 0 11 (face magit-branch-remote)) "--") . "just before submodules work") (("..." "rev-parse" "--verify" #("work/master" 0 11 (face magit-branch-remote))) . "c0a9dae9f4b248391f841126c051f6967daec237") (("..." "show" "--no-patch" "--format=%s" #("origin/master^{commit}" 0 13 (face magit-branch-remote)) "--") . "just before submodules work") (("..." "rev-parse" "--verify" "--abbrev-ref" "master@{upstream}") . "origin/master") (("..." "show" "--no-patch" "--format=%h %s" "HEAD^{commit}" "--") . "5b72fcb238 snapshot") (("..." "symbolic-ref" "--short" "HEAD") . "master") (("..." "rev-parse" "--verify" "HEAD") . "5b72fcb238aacf6ac1e83e330325bd34257b6dd5") (("..." . config) . #<hash-table equal 41/65 0x1563f21c2709>) (("..." . magit-toplevel) . "...") ((".../src/" . magit-toplevel) . "...") (("..." "rev-parse" "--show-toplevel") . "...") (("..." "rev-parse" "--show-cdup") . "") ((".../src/" "rev-parse" "--show-cdup") . "../") ((".../src/" "rev-parse" "--show-toplevel") . "...")))
  call-interactively(vc-dir nil nil)
  command-execute(vc-dir)

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

Successfully merging this pull request may close these issues.

None yet

2 participants