Page MenuHomePhabricator

Shallow Git clones fail under recent versions of Git
Closed, ResolvedPublic

Description

See https://discourse.phabricator-community.org/t/git-fetches-with-depth-over-http-results-in-500-errors/4317/. See D21484.

Diffusion currently detects a valid shallow clone (a clone with --depth) by examining stderr for the text:

The remote end hung up unexpectedly

In recent versions of Git (?), the emitted message appears to have changed slightly, and is now:

fatal: the remote end hung up unexpectedly

...which is no longer identified as the desired message (the pattern "The ..." does not match the text "the ..."), so Diffusion believes the request is invalid and emits an error (HTTP 500).

The specific change which affected behavior is almost certainly this one (July 2018):

https://github.com/git/git/commit/1a07e59c3e269418f3f5d186d166bf5ab5db6667

...which changed "The" to "the" in preparation for localization.

Event Timeline

epriestley created this task.
epriestley claimed this task.
epriestley added a subscriber: 20after4.

This appears fixed by D21484 (and @20after4 confirmed the fix on rPc0414732 -- thanks!) so I'm going to mark it as resolved.

Currently, git-http-backend could, say, segfault or get OOM killed while emitting a packfile frame that happened to end in 0000, and we'd incorrectly treat the response as successful. This is wildly unlikely, and we should still be in better shape than the old method (which did English language string testing against stderr). In the future, this pathway should get the full protocol-parsing proxy treatment out of T8093, which should allow us to correctly categorize responses as errors or non-errors in all cases.