@feng0531/dsh-code-review 0.22.2 → 0.22.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # 变更记录
2
2
 
3
+ ## 0.22.3
4
+
5
+ - 修复浅克隆遍历隐藏父节点使非根提交误用空基线:改读原始commit头,仅真实无父节点使用空侧;缺失父树失败,不自动fetch。
6
+ - 真实depth-1克隆验证非根失败及隐藏merge父节点仍要求区间;全量253通过。
7
+
3
8
  ## 0.22.2
4
9
 
5
10
  - 历史显式规则只从目标提交普通blob捕获,复用现有4文件、md/txt、UTF-8、16KiB单文件/32KiB总量及排除变更校验;不读取工作树。
package/README.md CHANGED
@@ -4,7 +4,9 @@
4
4
 
5
5
  ## 当前状态
6
6
 
7
- 当前代码版本为 0.22.2
7
+ 当前代码版本为 0.22.3
8
+
9
+ 单提交审查直接读取原始commit头的父节点,不受浅克隆遍历边界影响;缺失父树明确失败且不自动fetch,不能把非根提交当空旧侧。
8
10
 
9
11
  Git历史审查预览传 `commit`(相对唯一父提交,根提交空旧侧;merge需区间),或 `baseRevision` 与 `targetRevision`(精确端点树差异,非merge-base);两类互斥。预览/报告显示解析对象ID,执行复捕获hash验证引用变化。历史显式/自动直接导入上下文只捕获目标提交树普通blob,默认20总量且排除变更不能再进入;历史显式规则同样只从目标树blob捕获,最多4个md/txt、UTF-8、每个16KiB/合计32KiB,不混工作树,SVN不冒充此语义。
10
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-code-review",
3
- "version": "0.22.2",
3
+ "version": "0.22.3",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
@@ -13,7 +13,7 @@ export async function captureGitHistory(cwd, options={}) {
13
13
  const root=await realpath(utf8(await git(cwd,['rev-parse','--show-toplevel'])).trim());
14
14
  const resolve=async ref=>{if(typeof ref!=='string'||!ref||ref.length>256||ref.startsWith('-')||/[\s\0]/.test(ref))throw new Error('Invalid revision');const oid=utf8(await git(root,['rev-parse','--verify','--end-of-options',ref+'^{commit}'])).trim();if(!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(oid))throw new Error('Invalid commit object');return oid;};
15
15
  let base,target;
16
- if(commit!==undefined){if(baseRevision!==undefined||targetRevision!==undefined)throw new Error('Commit and range are mutually exclusive');target=await resolve(commit);const ancestry=utf8(await git(root,['rev-list','--parents','-n','1',target])).trim().split(' ');if(ancestry.length>2)throw new Error('Merge commit requires explicit revision range');base=ancestry[1]??null;}
16
+ if(commit!==undefined){if(baseRevision!==undefined||targetRevision!==undefined)throw new Error('Commit and range are mutually exclusive');target=await resolve(commit);const object=utf8(await git(root,['cat-file','commit',target]));const header=object.split('\n\n',1)[0];const parents=header.split('\n').filter(line=>line.startsWith('parent ')).map(line=>line.slice(7));if(parents.some(oid=>!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(oid)))throw new Error('Invalid commit parent');if(parents.length>1)throw new Error('Merge commit requires explicit revision range');base=parents[0]??null;}
17
17
  else {base=await resolve(baseRevision);target=await resolve(targetRevision);}
18
18
  const tree=async oid=>{const map=new Map();if(!oid)return map;const records=utf8(await git(root,['ls-tree','-rz','--full-tree',oid])).split('\0').filter(Boolean);if(records.length>10000)throw new Error('Historical tree entry limit exceeded');for(const r of records){const m=/^(\d{6}) (blob|commit) ([a-f0-9]+)\t([\s\S]+)$/.exec(r);if(!m)throw new Error('Invalid historical tree');relativePath(m[4]);map.set(m[4],{mode:m[1],type:m[2],oid:m[3]});}return map;};
19
19
  const left=await tree(base),right=await tree(target),names=[...new Set([...left.keys(),...right.keys()])].filter(p=>JSON.stringify(left.get(p))!==JSON.stringify(right.get(p))).sort();