From b42703fc303bf6e0e433c63b41bd47898aaac8ac Mon Sep 17 00:00:00 2001 From: hiifong Date: Tue, 14 Jan 2025 23:25:52 +0800 Subject: [PATCH] Fix --- services/gitdiff/gitdiff_test.go | 12 ------------ .../testdata/parent-commit-not-exits/HEAD | 1 - .../testdata/parent-commit-not-exits/config | 8 -------- ...-345985523f4c8a8da9888000d67e90f90812b608.idx | Bin 1156 -> 0 bytes ...345985523f4c8a8da9888000d67e90f90812b608.pack | Bin 915 -> 0 bytes .../testdata/parent-commit-not-exits/packed-refs | 2 -- .../testdata/parent-commit-not-exits/shallow | 1 - 7 files changed, 24 deletions(-) delete mode 100644 services/gitdiff/testdata/parent-commit-not-exits/HEAD delete mode 100644 services/gitdiff/testdata/parent-commit-not-exits/config delete mode 100644 services/gitdiff/testdata/parent-commit-not-exits/objects/pack/pack-345985523f4c8a8da9888000d67e90f90812b608.idx delete mode 100644 services/gitdiff/testdata/parent-commit-not-exits/objects/pack/pack-345985523f4c8a8da9888000d67e90f90812b608.pack delete mode 100644 services/gitdiff/testdata/parent-commit-not-exits/packed-refs delete mode 100644 services/gitdiff/testdata/parent-commit-not-exits/shallow diff --git a/services/gitdiff/gitdiff_test.go b/services/gitdiff/gitdiff_test.go index 949a8ac59d141..1017d188dd53a 100644 --- a/services/gitdiff/gitdiff_test.go +++ b/services/gitdiff/gitdiff_test.go @@ -667,15 +667,3 @@ func TestNoCrashes(t *testing.T) { ParsePatch(db.DefaultContext, setting.Git.MaxGitDiffLines, setting.Git.MaxGitDiffLineCharacters, setting.Git.MaxGitDiffFiles, strings.NewReader(testcase.gitdiff), "") } } - -func TestParentCommitNotExits(t *testing.T) { - gitRepo, err := git.OpenRepository(git.DefaultContext, "./testdata/parent-commit-not-exits") - require.NoError(t, err) - defer gitRepo.Close() - - diff, err := GetDiff(git.DefaultContext, gitRepo, &DiffOptions{ - AfterCommitID: "d01637fe74c3727d9d1e5f691f343988d3e5342f", - }) - assert.ErrorContains(t, err, "object does not exist [id: af35b81c4c8bd963b77b51b207ae4dc90e1904af, rel_path: ]") - assert.Nil(t, diff) -} diff --git a/services/gitdiff/testdata/parent-commit-not-exits/HEAD b/services/gitdiff/testdata/parent-commit-not-exits/HEAD deleted file mode 100644 index b870d82622c1a..0000000000000 --- a/services/gitdiff/testdata/parent-commit-not-exits/HEAD +++ /dev/null @@ -1 +0,0 @@ -ref: refs/heads/main diff --git a/services/gitdiff/testdata/parent-commit-not-exits/config b/services/gitdiff/testdata/parent-commit-not-exits/config deleted file mode 100644 index 2be30482e697f..0000000000000 --- a/services/gitdiff/testdata/parent-commit-not-exits/config +++ /dev/null @@ -1,8 +0,0 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = true - ignorecase = true - precomposeunicode = true -[remote "origin"] - mirror = true diff --git a/services/gitdiff/testdata/parent-commit-not-exits/objects/pack/pack-345985523f4c8a8da9888000d67e90f90812b608.idx b/services/gitdiff/testdata/parent-commit-not-exits/objects/pack/pack-345985523f4c8a8da9888000d67e90f90812b608.idx deleted file mode 100644 index afcf3fc35eac0eb1c67419542b9025bd1b74adb1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1156 zcmexg;-AdGz`z8=qhK@ys2u`~Km$h#2IV1YVP>FNbj4F+CI7EesrtM15KCd;^=H#A zdV7~$5HtT*a=55=u3UVkyoqJU<)FH%08 znd$q?>ow5X(LlHJ0BLQL$krfxpRV4O9SscE>L&c;5ZcC3uDbP0_v%M${@pX$y{VSF J*tTljegIV?I=%n^ diff --git a/services/gitdiff/testdata/parent-commit-not-exits/objects/pack/pack-345985523f4c8a8da9888000d67e90f90812b608.pack b/services/gitdiff/testdata/parent-commit-not-exits/objects/pack/pack-345985523f4c8a8da9888000d67e90f90812b608.pack deleted file mode 100644 index 0969bc62f0f95b41c3e438c5ee10e21c22cbb284..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 915 zcmV;E18n?IK|@Ob00062000A)L3o^vlgF~7Rsclze8t^U9$i4Bsu|Y+B1z;R!j5ps z=^-Q}zJA7bdFO?DdAh52XIl{hh+_DPggimOoTxY!aT!;zkl{GKfCXK^jE6MESJ;xR zXxczlQFP7`#kt_}l4q!#WpkRyNyujCToyb;1P{+yg=NpJnOD%XZ8c9d_+I^Nhxyxd z{0Rt_VmO9iNfzLcgAgm`acs8@{l9g+)Q`3XfBY3uR&@(FssnsowS*w_7{O_`Q=hn5U$ca%i$KDBtPhENekq-G)~NOkZ2%Q5h~dF{V1j?@g-tYH?Rn{pKc-0mletmK>AqW4~h z)Zqvp_>@EiN7{*Ye5tl7VN1fJOXg^0%yOfSll;_gTgSbU9RtPlR=*Xk8|{eV$nwP1 z7h});x6(#RO9=WGuAc|;e9Ll%9n8}nMf8mKmJPo|+rOv_2Hp=mC{p+`D(%`xXI~up zpzQ3xs9-A34arN**eBtQx-sTc=yB=og8@HGogpcct~CRBdaeb2^p~$y zzh*FNf?2}-Wn$WsZ-*p_XG4)sQvABVcO&5q@4oOD$RopM;<4H0nLc=~dKr^)RHX4W zIVVr+Xd>wijo#c<4z)|Yza}!}Erjfyb%}DYObp=8<}B(|41~78sh;F=w<hM`py#9^BZqc7nNKgNpE7PoHqtOH7#;(u-Q-MF*s2!>w<=^`}Q)$Cf`W0 z3mL6<{9=*|pST9rjQhGot?izeSA|+43|RU8;c)HBpSHapOFbszYe)%MIYQTKy+s`a zNhV4XWvIio2}PX#0|P&NHD$1WoRO`|e;I>?OPOs5`vpc&Mrfr1c$_mdFfcPQQ3!H% zbn$i7%S~aJ8Y}sKol4c;t%q0&1Ft`ucG26r3;^O?4!yboc$`yK2uLhS%_~tz&d<%w pEK$hIFHuOX$Sf)50swd72_H0Bg;GCEijAp=fB@EhkogD_wg`k)zv}=1 diff --git a/services/gitdiff/testdata/parent-commit-not-exits/packed-refs b/services/gitdiff/testdata/parent-commit-not-exits/packed-refs deleted file mode 100644 index 8ae620fe0f4ff..0000000000000 --- a/services/gitdiff/testdata/parent-commit-not-exits/packed-refs +++ /dev/null @@ -1,2 +0,0 @@ -# pack-refs with: peeled fully-peeled sorted -d01637fe74c3727d9d1e5f691f343988d3e5342f refs/heads/main diff --git a/services/gitdiff/testdata/parent-commit-not-exits/shallow b/services/gitdiff/testdata/parent-commit-not-exits/shallow deleted file mode 100644 index b729f8db3772d..0000000000000 --- a/services/gitdiff/testdata/parent-commit-not-exits/shallow +++ /dev/null @@ -1 +0,0 @@ -d01637fe74c3727d9d1e5f691f343988d3e5342f