Supplement · Git Engineering · 10-theory-04-transfer-protocol

Advertisement, negotiation và pack transfer

Fetch tìm tập object còn thiếu; transport, authentication và object negotiation là các lớp khác nhau.

Smart protocol

Server quảng bá capabilities/refs; client gửi wants và haves để tìm common history; server tạo pack cho missing reachable objects. Protocol v2 là command-oriented và tránh quảng bá mọi refs ngay từ đầu. HTTP/SSH chịu trách nhiệm channel và identity; receive/upload policy nằm server.

Performance

Nhiều refs, history phân kỳ sâu và thiếu bitmap làm negotiation/pack selection đắt. Shallow/partial filters đổi dữ liệu được phép thiếu. GIT_TRACE_PACKET=1, GIT_TRACE2_EVENT giúp đo nhưng log có thể chứa URL/header nhạy cảm.

Push correctness

Server kiểm old/new ref value, fast-forward policy, hooks và permissions rồi cập nhật refs. Atomic push tránh một phần refs thành công. --force-with-lease bảo vệ kỳ vọng old value tốt hơn --force, nhưng vẫn cần coordination.

Protocol v2 · Pack protocol · HTTP protocol · git-push
← Chương 03Chương 05 →