UploadPack does not implement relative shallow deepening (deepen-relative)
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- git, java
- 領域
- backend, networking
調査の方向性
Start in org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java, at computeShallowsAndUnshallows() and its deepen-relative TODO; read the v0/v1 and protocol-v2 fetch paths that call it. Add coverage for the in-process protocol-v2 linear history case described in the issue, including returned shallow and unshallow information. Done means relative deepening extends history from existing client boundaries and handles unreachable boundaries without error.
索引モデルが issue の本文から書いたものです。
説明
UploadPack.computeShallowsAndUnshallows() throws UnsupportedOperationException
on the deepen-relative capability (a long-standing TODO), so
git fetch --deepen=N is unsupported. Native clients doing relative deepening
against any JGit server (Gerrit, Gitiles, JGit daemon/HTTP) fail with an opaque
HTTP 500 / fatal: expected 'acknowledgments', while the same request
succeeds against git.git's upload-pack. Absolute --depth and --unshallow
work; only relative deepening is rejected.
Version
deepen-relative has never been implemented in UploadPack: the handler
still carries a TODO(jonathantanmy): Implement deepen-relative and throws
UnsupportedOperationException. This is a missing feature on current JGit
master, not a version-specific regression — the TODO and throw date to 2018.
The rejection lives in the shared computeShallowsAndUnshallows, reached from
both the v0/v1 and the protocol-v2 fetch paths, so it is not specific to one
protocol version. Confirmed on upstream master
(6c454443);
the runtime reproductions below ran on a local branch whose
computeShallowsAndUnshallows is byte-identical to master in that region.
Description
UploadPack.computeShallowsAndUnshallows() explicitly rejects the
deepen-relative capability:
if (req.getClientCapabilities().contains(OPTION_DEEPEN_RELATIVE)) {
// TODO(jonathantanmy): Implement deepen-relative
throw new UnsupportedOperationException();
}
This leaves relative shallow deepening unsupported. The intended client
operation is git fetch --deepen=N, which requests more history relative to
the client's existing shallow boundary; absolute-depth requests and relative
deepening have different semantics. deepen-relative is a standard part of the
Git pack protocol (Documentation/technical/pack-protocol.txt and
Documentation/gitprotocol-v2.txt in git.git).
Impact
Any native git client running git fetch --deepen=N against a JGit-backed
server — including Gerrit, Gitiles, and the JGit daemon/HTTP server — fails
with an opaque HTTP 500 (fatal: expected 'acknowledgments', exit 128), while
the same client succeeds against git.git's upload-pack. This is an interop
feature gap of moderate severity; a workaround exists (below) and no data is
lost.
Reproduction
Against a running JGit server a native client reproduces it directly. Using a
fresh temporary Gerrit site serving a linear 40-commit branch (native Git
2.54.0, Java 25.0.4, macOS):
git -c protocol.version=2 clone --depth=5 --single-branch \
--branch master --no-tags "$JGIT_REPO_URL" shallow-client
git -c protocol.version=2 -C shallow-client fetch --deepen=5 origin master
The clone succeeds; the relative fetch exits with status 128:
error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500
fatal: expected 'acknowledgments'
The packet trace confirms the client sent both deepen 5 and deepen-relative;
the client's history stays shallow at five commits. This HTTP 500 /
fatal: expected 'acknowledgments' is exactly what a native --deepen user
sees — the server-side UnsupportedOperationException surfaces as an opaque
500 with no useful diagnostic. Absolute deepening (--depth=10) and
--unshallow succeeded against the same server. The failure reproduces on
unmodified base UploadPack, independent of any local modifications to this
path.
The minimal isolating case is an in-process protocol-v2 request against
UploadPack, using linear history A <- B <- C with B as the client's
existing shallow boundary:
command=fetch
<delimiter>
want <C-object-id>
ofs-delta
no-progress
shallow <B-object-id>
have <B-object-id>
deepen 1
deepen-relative
done
<flush>
Each line is pkt-line encoded; <delimiter> and <flush> are the protocol
packets 0001 and 0000. Set UploadPack's extra parameters to version=2
before sending. The observed exception chain:
org.eclipse.jgit.transport.UploadPackInternalServerErrorException
Caused by: java.lang.UnsupportedOperationException
at org.eclipse.jgit.transport.UploadPack.computeShallowsAndUnshallows(...)
at org.eclipse.jgit.transport.UploadPack.fetchV2(...)
Expected behavior
Relative deepening extends history from the client's current shallow
boundaries, returns the required objects with correct shallow/unshallow
information, and leaves the repository connected up to its new boundaries. For
the linear example above, a five-commit shallow clone should extend to ten
commits, matching native git-upload-pack.
Beyond the linear case demonstrated here, a correct implementation must not
simply reinterpret the relative depth as an absolute one. For reference, native
Git derives a single offset from the shallowest existing boundary reachable
from the wanted tips and adds the requested depth, then recomputes boundaries
at that absolute depth (shallow.c, get_shallow_commits). It also returns no
new boundary — rather than erroring — when no wanted tip can reach any declared
client shallow. On the client, --deepen and --depth are mutually exclusive.
Current workaround
Where the desired absolute depth is known, request it explicitly:
git -C shallow-client fetch --depth=10 origin master
Alternatively, git fetch --unshallow requests the remaining history. Neither
is a general substitute for relative deepening across arbitrary histories.
Related reports
GitHub searches for deepen, deepening and deepen-relative across open and
closed JGit issues found no existing report.
Issue #182, "Shallow
Clone/Fetch Fails on Merge Commits with Limited Depth", concerns missing
objects during absolute-depth fetching across a merge — a different failure
from this explicit rejection of relative deepening.
- 主要言語
- Java
- スター
- 427
- フォーク
- 116
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
eclipse-jgit/jgit のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
eclipse-jgit/jgit#329 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
eclipse-jgit/jgit#327 ·
-
Repository.create(boolean bare) should provide a no-arg overload that uses isBare()再び着手できるかも @hardikyadav12 が 77 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
eclipse-jgit/jgit#297 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
eclipse-jgit/jgit#293 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
eclipse-jgit/jgit#288 ·
eclipse-jgit/jgit の issue をすべて見る
似ている issue
-
? - Needs Triage bot_watch bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/cudf-spark-jni#5594 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DataONEorg/dataone-indexer#390 ·