Skip to content

Trying to fetch only non-existant refs results in "Could not decode server reply" #1405

Closed
@udoprog

Description

@udoprog

Current behavior 😯

If you try to fetch a non-existant ref over https (github specifically), you get a vague error indicating that:

Error: Could not decode server reply

Caused by:
    0: Failed to read from line reader
    1: failed to fill whole buffer

Expected behavior 🤔

I'm not sure what to expect. But I hoped that the protocols involved would indicate that the references do not exist, and a better error message propagated to the user. Alternatively that the outcome would simply not be populated, and any refs specified which does not exist are simply ignored which is what happens if you do specify refs that exist alongside ones which do not.

Maybe this isn't an error at all, and I'm simply expected to enumerate the remote refs before attempting to fetch them, all though this would be racy since the refs can change between enumeration and fetching.

Git behavior

git fetch https://github.com/dtolnay/rust-toolchain refs/tags/stable
fatal: couldn't find remote ref refs/tags/stable

Steps to reproduce 🕹

Note that I can only reproduce this on Linux , on Windows it seems to work as expected for some reason.

I've set up a minimal repro here where I try to fetch refs/tags/stable from dtolnay/rust-toolchain. Note that refs/heads/stable is actually what exists.

See: https://github.com/udoprog/playground/tree/gix-issue2

Rust version:

rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-unknown-linux-gnu
release: 1.79.0
LLVM version: 18.1.7

Metadata

Metadata

Assignees

Labels

acknowledgedan issue is accepted as shortcoming to be fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions