This is a possible regression from #776 and #779: straight fails to check out a pinned commit of a package whose remote does not support shallow cloning.
The resulting error is:
fatal: Could not parse object 'b3c7cc28e95fe25ce7b443e5f49e2e45360944a3'.
Judging from *straight-process*, it appears git reset --hard ... occurs before the repo is successfully fetched:
$ cd /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/
$ git init
Initialized empty Git repository in /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/.git/
[Return code: 0]
$ cd /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/
$ git remote add origin https\://depp.brause.cc/nov.el.git
[Return code: 0]
$ cd /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/
$ git branch -r
[Return code: 0]
$ cd /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/
$ git remote show origin
* remote origin
Fetch URL: https://depp.brause.cc/nov.el.git
Push URL: https://depp.brause.cc/nov.el.git
HEAD branch: master
Remote branch:
master new (next fetch will store in remotes/origin)
[Return code: 0]
$ cd /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/
$ git branch -m master
[Return code: 0]
$ cd /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/
$ git fetch origin b3c7cc28e95fe25ce7b443e5f49e2e45360944a3 --depth 1 --no-tags
fatal: dumb http transport does not support shallow capabilities
[Return code: 128]
$ cd /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/
$ git branch -r
[Return code: 0]
$ cd /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/
$ git remote show origin
* remote origin
Fetch URL: https://depp.brause.cc/nov.el.git
Push URL: https://depp.brause.cc/nov.el.git
HEAD branch: master
Remote branch:
master new (next fetch will store in remotes/origin)
[Return code: 0]
$ cd /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/
$ git reset --hard b3c7cc28e95fe25ce7b443e5f49e2e45360944a3
fatal: Could not parse object 'b3c7cc28e95fe25ce7b443e5f49e2e45360944a3'.
[Return code: 128]
$ cd /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/
$ git checkout -B master origin/master
fatal: 'origin/master' is not a commit and a branch 'master' cannot be created from it
[Return code: 128]
$ cd /home/hlissner/projects/conf/doom-emacs/.local/straight/repos/nov.el/
$ git checkout HEAD
error: pathspec 'HEAD' did not match any file(s) known to git
[Return code: 1]
(setq straight-repository-branch "develop")
;; To simulate a lockfile
(define-advice straight--lockfile-read-all
(:override (&rest _) mock-lockfile)
'(("nov.el" . "b3c7cc28e95fe25ce7b443e5f49e2e45360944a3")))
(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))
(straight-use-package '(nov :depth 1))
(This will fail the same way for paredit as well)
Thanks again for the excellent bug report and your patience.
The lock file mocking advice is particularly handy.
I'll probably steal that to write some tests at some point.
I've got a patch with #783 that looks like it should do the job:
Test Case
(straight-bug-report
:user-dir "shallow.straight"
:pre-bootstrap
(setq straight-repository-user "progfolio"
straight-repository-branch "fix/vc-git-fetch-shallow")
(define-advice straight--lockfile-read-all
(:override (&rest _) mock-lockfile)
'(("nov.el" . "b3c7cc28e95fe25ce7b443e5f49e2e45360944a3")))
:post-bootstrap
(straight-use-package '(nov :depth 1))
(straight-use-package '(paredit :depth 1)))
2021-06-04 18:04:52gnu/linuxprerelease (HEAD -> fix/vc-git-fetch-shallow, fork/fix/vc-git-fetch-shallow) 4828eec 2021-06-04GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars)
of 2021-05-25Output
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-fetch-shallow, origin/fix/vc-git-fetch-shallow) 4828eec 2021-06-04
Cloning nov.el...
Cloning nov.el...done
Building nov...
Building nov β Cloning dash.el...
Building nov β Cloning dash.el...done
Building nov β Building dash...
Building nov β Building dash...done
Building nov β Cloning esxml...
Building nov β Cloning esxml...done
Building nov β Building esxml...
Building nov β Building esxml β Cloning emacs-kv...
Building nov β Building esxml β Cloning emacs-kv...done
Building nov β Building esxml β Building kv...
Building nov β Building esxml β Building kv...done
Building nov β Building esxml...
Building nov β Building esxml...done
Building nov...
Building nov...done
Cloning paredit...
Cloning paredit...done
Building paredit...
Building paredit...done
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-fetch-shallow 4828eec 2021-06-04
"nov" melpa master b3c7cc2 2021-03-23
"dash" melpa master aab346e 2021-06-02
"esxml" melpa master 9f96449 2021-03-23
"kv" melpa master 7211484 2014-01-08
"paredit" melpa master 8330a41 2020-05-29
Merged into "develop". As always, testing is appreciated.
I can confirm that this has fixed the issue. Thanks yet again!