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

Fatal error when remote does not support shallow cloning #777

Closed
hlissner opened this issue Jun 3, 2021 · 6 comments
Closed

Fatal error when remote does not support shallow cloning #777

hlissner opened this issue Jun 3, 2021 · 6 comments

Comments

@hlissner
Copy link

hlissner commented Jun 3, 2021

What's wrong

When performing a shallow clone of paredit (from the repo in its MELPA recipe: https://mumble.net/~campbell/git/paredit.git), I get this error:

$ git clone --origin origin --no-checkout https\://mumble.net/\~campbell/git/paredit.git /home/hlissner/.emacs.d/straight/repos/paredit/ --depth 1 --no-single-branch --no-tags

Cloning into '/home/hlissner/.emacs.d/straight/repos/paredit'...
fatal: dumb http transport does not support shallow capabilities

[Return code: 128]

The remote server does not support shallow cloning, it seems, which causes straight to abort with a fatal error.

Judging from straight-vc-git--clone-internal's docstring:

If DEPTH is an integer, pass it to the --depth option of git-clone to perform a shallow clone. If this fails, try again to clone without the option --depth and --branch, as a fallback.

It seems this should gracefully degrade to a full clone.

Directions to reproduce

Either:

  1. git clone --depth=1 https://mumble.net/~campbell/git/paredit.git

Or:

(setq straight-repository-branch "develop")
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))
(setq straight-vc-git-default-clone-depth 1)
(straight-use-package 'paredit)

Version information

  • Emacs version: 28.0.50
  • Operating system: NixOS 21.11
@hlissner hlissner added the bug label Jun 3, 2021
progfolio added a commit to progfolio/straight.el that referenced this issue Jun 3, 2021
Because of the change in radian-software#714, we weren't triggering the recursive
full clone when a shallow clone failed. straight--process-run returned
the process result list (nonzero-exit-code etc...) instead of throwing
an error.

See: radian-software#777
@progfolio
Copy link
Contributor

Thanks, Henrik.
Confimed with the following test case:

Test Case
(straight-bug-report
  :user-dir "paredit.straight"
  :post-bootstrap 
  (setq straight-vc-git-default-clone-depth 1)
  (straight-use-package 'paredit)
  (let
      ((default-directory
         (straight--repos-dir "paredit")))
    (message "paredit repo depth: %s"
             (straight--process-output "git" "rev-list" "HEAD" "--count"))))
  • Test run at: 2021-06-02 21:21:48
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> fix/vc-git-clone-internal-recurse, fork/fix/vc-git-clone-internal-recurse) 00be648 2021-06-02
  • emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars) of 2021-05-25
Output
Test run with version: prerelease (HEAD -> develop, origin/develop) 7ca94a7 2021-06-01
Cloning paredit...

Error: (error "Failed to run \"git\"; see buffer *straight-process*")

I've got a patch that seems to take care of it here:

Test Case
(straight-bug-report
  :user-dir "paredit.straight"
  :pre-bootstrap 
  (setq straight-repository-branch "fix/vc-git-clone-internal-recurse" straight-repository-user "progfolio")
  :post-bootstrap 
  (setq straight-vc-git-default-clone-depth 1)
  (straight-use-package 'paredit)
  (let
      ((default-directory
         (straight--repos-dir "paredit")))
    (message "paredit repo depth: %s"
             (straight--process-output "git" "rev-list" "HEAD" "--count"))))
  • Test run at: 2021-06-02 21:25:18
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> fix/vc-git-clone-internal-recurse, fork/fix/vc-git-clone-internal-recurse) 00be648 2021-06-02
  • emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars) of 2021-05-25
Output
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> fix/vc-git-clone-internal-recurse, origin/fix/vc-git-clone-internal-recurse) 00be648 2021-06-02
Cloning paredit...
Cloning paredit...done
Building paredit...
Building paredit...done

paredit repo depth: 224
Packages:
"org-elpa"                n/a                  n/a
"melpa"                   n/a                  master 45a02d8e 2021-06-03
"gnu-elpa-mirror"         n/a                  master 6417888 2021-05-29
"el-get"                  melpa                master d76ac84a 2021-04-28
"emacsmirror-mirror"      n/a                  master a3cf645 2021-05-29
"straight"                n/a                  fix/vc-git-clone-internal-recurse 00be648 2021-06-02
"paredit"                 melpa                master 8330a41 2020-05-29

progfolio added a commit that referenced this issue Jun 3, 2021
Because of the change in #714, we weren't triggering the recursive
full clone when a shallow clone failed. straight--process-run returned
the process result list (nonzero-exit-code etc...) instead of throwing
an error.

See: #777
@progfolio
Copy link
Contributor

Should be fixed on latest "develop". Testing appreciated.

@hlissner
Copy link
Author

hlissner commented Jun 3, 2021

https://github.com/raxod502/straight.el/blob/e4349291d8b9e9d888bc384b68339456b18b59f3/straight.el#L2481

This line throws (wrong-type-argument . listp) since apply expects its final argument to be a list.

@xeruf
Copy link

xeruf commented Jun 3, 2021

Same issue with nov - had to manually perform a non-shallow clone.

@progfolio
Copy link
Contributor

progfolio commented Jun 3, 2021

This line throws (wrong-type-argument . listp) since apply expects its final argument to be a list.

Oops. Should've caught that in #776. Thank you. Merged #779, which should fix this.

@hlissner
Copy link
Author

hlissner commented Jun 4, 2021

Can confirm this works perfectly now! Thank you for your work on straight and quick response!

@hlissner hlissner closed this as completed Jun 4, 2021
progfolio added a commit that referenced this issue Jun 11, 2021
* Update Org mode references (#774)

See: #771

* straight-use-package: guard against void native-comp deny list (#773)

See: #772

* Remove advice to load org-contrib as a means to load Org (#775)

org-contrib does not contain Org

See: #774

* vc-git--clone-internal: lower git version requirement; refactor (#776)

git's init -b switch requires git version >= 2.28.
We can replicate this by renaming the master, which will work on older
git versions, too.

Use straight--process-run instead of straight--process-output, as we're
not doing anything with the process output.

See: #768

* vc-git--clone-internal: properly recurse when shallow clone fails (#778)

Because of the change in #714, we weren't triggering the recursive
full clone when a shallow clone failed. straight--process-run returned
the process result list (nonzero-exit-code etc...) instead of throwing
an error.

See: #777

* vc-git--clone-internal: Remove vestigial function application (#779)

* vc-git--clone-internal: properly recurse for failed shallow clone with pinned commit (#783)


See: #782

* Add info program path customizations, straight--execuatable-find (#784)

straight-makeinfo-executable: defcustom to set custom makeinfo path
straight-install-info-executable: defcustom to set custom install-info path

straight--executable-find: Wrapper for executable-find which allows us
to throw uniform errors if a required executable is not found on the exec-path.

* Add straight-remove-unused-repos (#785)

Obsolete straight-x-clean-unused-repos
See: #49

* Add straight-dependencies, straight-dependents (#787)

See: #503

Co-authored-by: chrikoehn <ckoehn@informatik.uni-hamburg.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants