"Cannot fetch git.git" (worktrees at fault? or origin/HEAD) ?
- From
Stefan Beller <sbeller@google.com>
- Date
- Oct 20, 2017, 01:43 UTC
- Message-ID
- <CAGZ79kYP0z1G_H3nwfmSHraWHMBOcik5LepUXKj0nveeBrihiw@mail.gmail.com>
So I ran "git fetch --all" inside git.git that you are all familiar with. All fetches failed with a similar error as: Fetching kernelorg fatal: bad object HEAD error: https://kernel.googlesource.com/pub/scm/git/git did not send all necessary objects
error: Could not fetch kernelorg
Working with an older version of Git (2.13.0) gives me
$ GIT_TRACE=/u/trace GIT_TRACE_PACKET=/u/out git fetch git://github.com/git/git From git://github.com/git/git * branch HEAD -> FETCH_HEAD
After fiddling around and some printf debugging, clean fsck(!) I could not make sense of it, so bisecting
$ git bisect bad d0c39a49ccb5dfe7feba4325c3374d99ab123c59 is the first bad commit commit d0c39a49ccb5dfe7feba4325c3374d99ab123c59 Author: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Date: Wed Aug 23 19:36:59 2017 +0700
revision.c: --all adds HEAD from all worktrees
Unless single_worktree is set, --all now adds HEAD from all worktrees.
Since reachable.c code does not use setup_revisions(), we need to call
other_head_refs_submodule() explicitly there to have the same effect on
"git prune", so that we won't accidentally delete objects needed by some
other HEADs.A new FIXME is added because we would need something like
int refs_other_head_refs(struct ref_store *, each_ref_fn, cb_data);
in addition to other_head_refs() to handle it, which might require
int get_submodule_worktrees(const char *submodule, int flags);
It could be a separate topic to reduce the scope of this one.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>And here we go, I do use worktrees nowadays! $ git worktree list /usr/local/google/home/sbeller/OSS/git 117ddefdb4 (detached HEAD) /u/git d0c39a49cc (detached HEAD) /usr/local/google/home/sbeller/OSS/git_origin_master b14f27f917 (detached HEAD) /usr/local/google/home/sbeller/OSS/submodule_remote_dot 3d9025bd69 (detached HEAD)
$ git show 3d9025bd69 fatal: ambiguous argument '3d9025bd69': unknown revision or path not in the working tree.
ok, so I presume I just delete that working tree to "fix my copy of git" sbeller@sbeller:/u/git$ rm -rf /usr/local/google/home/sbeller/OSS/submodule_remote_dot sbeller@sbeller:/u/git$ git worktree prune sbeller@sbeller:/u/git$ git worktree list /usr/local/google/home/sbeller/OSS/git 117ddefdb4 (detached HEAD) /u/git d0c39a49cc (detached HEAD) /usr/local/google/home/sbeller/OSS/git_origin_master b14f27f917 (detached HEAD) $ git bisect reset Previous HEAD position was d0c39a49cc... revision.c: --all adds HEAD from all worktrees HEAD is now at 660fb3dfa8... Sync with maint $ make install $ git fetch --all # works fine!
Any idea which direction we need to heading for a real fix?