git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [BUG] "fatal: bad object .alternate" during fetch with alternates
@ 2019-11-06 19:48 Johannes Schindelin
  2019-11-06 20:59 ` Jeff King
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2019-11-06 19:48 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Hi Peff,

I only saw this problem arise on Sunday and wrote it off as a fluke
while fetching in parallel, but it persisted today, under more
controlled circumstances. I wanted to fast-forward a local branch:

$ git fetch origin master:master
fatal: bad object .alternate
error: https://github.com/git-for-windows/git did not send all necessary objects

`git grep`ing around, I saw that you added the code producing that error
message, in 39b44ba771a (check_everything_connected: assume alternate
ref tips are valid, 2019-07-01) and I verified manually through a
combination of debugging and instrumenting that
`add_one_alternate_ref()` is indeed responsible for that `.alternate`.

Now, I think the two factors that trigger this bug over here are:

- I had all the objects locally already, as I had pushed from a topic
  branch to `master` [*1*].

- My worktree's `.git/objects` is connected to an alternate that is
  connected to the current Git repository (yes, it is circular, long
  story...) and has refs pointing to commits its alternate that have
  been gc'ed away.

So I see two problems with this error message:

- It is not helpful. It should not say `.alternate`, it should mention
  the ref itself, and ideally even the path of the alternate.

- Shouldn't the code be made smart enough to simply ignore (maybe with a
  warning) refs that point to gc'ed commits?

Ciao,
Dscho

Footnote *1*: No, I do not usually push directly to `master`. The
scenario here is that I had rebased Git for Windows' patches on top of
v2.24.0, opened a PR for the PR build, everything checked out all right,
and then I wanted to "merge" the PR, _without_ an extra merge commit on
top.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-08  8:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 19:48 [BUG] "fatal: bad object .alternate" during fetch with alternates Johannes Schindelin
2019-11-06 20:59 ` Jeff King
2019-11-06 21:25   ` Jeff King
2019-11-06 21:42   ` Jeff King
2019-11-07 12:58     ` Johannes Schindelin
2019-11-08  8:54       ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).