仓库自 4234565ac(2026-09-04,"docs: 新增图融合规则说明文档")起,根目录 .gitattributes 声明了 PNG 走 Git LFS:
4234565ac
.gitattributes
*.png filter=lfs diff=lfs merge=lfs -text
但该规则只对此后新增/重新暂存的文件生效,不会追溯转换已有 blob。目前 master HEAD 上仍有 10 个 PNG 以裸二进制形式直接存储在 git 对象库中(blob 魔数为 89 50 4E 47,而非 version https://git-lfs 指针文件),均由规则引入之前的历史提交带入。
89 50 4E 47
version https://git-lfs
HEAD 上合计约 760KB;且 abefa59c8("产品文档中png文件改为英文名")等提交的旧版本 blob 仍留在历史中,pack 实际占用更大。
abefa59c8
git clone https://gitcode.com/cann/ops-nn.git && cd ops-nn for f in $(git ls-tree -r HEAD --name-only | grep -i '\.png$'); do git cat-file blob "HEAD:$f" | head -c 30 | grep -q 'version https://git-lfs' || echo "raw binary: $f" done
git add --renormalize .
git lfs migrate import --everything "*.png"
感谢反馈,我们已开始核对这个问题。
现象理解:.gitattributes 已声明 PNG 走 Git LFS,但规则生效前合入的部分图片可能仍以裸二进制存在于当前 master。 当前判断:初步判断,待复现确认。这属于仓库存储方式问题,一般不影响算子功能;所列图片是否仍不是 LFS 指针,需对照当前对象核实。 涉及范围:docs/zh/figures 等文档 PNG 与根目录 .gitattributes。 下一步:我们会核对这批 PNG 是否仍是裸二进制,评估迁移到 Git LFS。
docs/zh/figures
问题描述
仓库自
4234565ac(2026-09-04,"docs: 新增图融合规则说明文档")起,根目录.gitattributes声明了 PNG 走 Git LFS:但该规则只对此后新增/重新暂存的文件生效,不会追溯转换已有 blob。目前 master HEAD 上仍有 10 个 PNG 以裸二进制形式直接存储在 git 对象库中(blob 魔数为
89 50 4E 47,而非version https://git-lfs指针文件),均由规则引入之前的历史提交带入。受影响文件(master HEAD)
HEAD 上合计约 760KB;且
abefa59c8("产品文档中png文件改为英文名")等提交的旧版本 blob 仍留在历史中,pack 实际占用更大。影响
复现
git clone https://gitcode.com/cann/ops-nn.git && cd ops-nn for f in $(git ls-tree -r HEAD --name-only | grep -i '\.png$'); do git cat-file blob "HEAD:$f" | head -c 30 | grep -q 'version https://git-lfs' || echo "raw binary: $f" done建议
git add --renormalize .后提交一次,将这 10 个文件转为 LFS 指针(不重写历史,普通 MR 即可);git lfs migrate import --everything "*.png"彻底回收历史体积(需协调下游/fork);.gitattributesLFS 规则的文件逐一检查 blob 是否为 LFS 指针,非指针则拦截合入。