diff options
| author | 2025-11-22 08:00:00 +0800 | |
|---|---|---|
| committer | 2025-11-22 08:00:00 +0800 | |
| commit | 0fb7e8ba2b7f872c2bc1ef737d78844e2e714da1 (patch) | |
| tree | 622a96220848532d33210a1db86eab1a24018b8a | |
| parent | README: Note on integer overflows (diff) | |
| signature | No signature | |
Remove the multi-pack-index tests which is unused anyway
| -rw-r--r-- | pack_test.go | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/pack_test.go b/pack_test.go index c23a9d9d..184a4e5c 100644 --- a/pack_test.go +++ b/pack_test.go @@ -147,76 +147,3 @@ func TestPackfileLarge(t *testing.T) { } } } - -func TestMultiPackIndex(t *testing.T) { - if testing.Short() { - t.Skip("skipping multi-pack-index test in short mode") - } - - repoPath, cleanup := setupTestRepo(t) - defer cleanup() - - gitCmd(t, repoPath, "config", "gc.auto", "0") - - workDir, cleanupWork := setupWorkDir(t) - defer cleanupWork() - - err := os.WriteFile(filepath.Join(workDir, "file1.txt"), []byte("content1"), 0o644) - if err != nil { - t.Fatalf("failed to write file1.txt: %v", err) - } - gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".") - gitCmd(t, repoPath, "--work-tree="+workDir, "commit", "-m", "Commit 1") - commit1Hash := gitCmd(t, repoPath, "rev-parse", "HEAD") - gitCmd(t, repoPath, "repack", "-d") - - err = os.WriteFile(filepath.Join(workDir, "file2.txt"), []byte("content2"), 0o644) - if err != nil { - t.Fatalf("failed to write file2.txt: %v", err) - } - gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".") - gitCmd(t, repoPath, "--work-tree="+workDir, "commit", "-m", "Commit 2") - commit2Hash := gitCmd(t, repoPath, "rev-parse", "HEAD") - gitCmd(t, repoPath, "repack", "-d") - - gitCmd(t, repoPath, "repack", "--write-midx") - - midxPath := filepath.Join(repoPath, "objects", "pack", "multi-pack-index") - if _, err := os.Stat(midxPath); os.IsNotExist(err) { - t.Fatalf("multi-pack-index file does not exist at %s", midxPath) - } - - repo, err := OpenRepository(repoPath) - if err != nil { - t.Fatalf("OpenRepository failed: %v", err) - } - defer func() { _ = repo.Close() }() - - hash1, _ := repo.ParseHash(commit1Hash) - obj1, err := repo.ReadObject(hash1) - if err != nil { - t.Fatalf("ReadObject commit1 failed: %v", err) - } - commit1 := obj1.(*StoredCommit) - if commit1.Hash() != hash1 { - t.Error("commit1 hash mismatch") - } - - if !bytes.Contains(commit1.Message, []byte("Commit 1")) { - t.Errorf("commit1 message doesn't contain 'Commit 1': got %q", commit1.Message) - } - - hash2, _ := repo.ParseHash(commit2Hash) - obj2, err := repo.ReadObject(hash2) - if err != nil { - t.Fatalf("ReadObject commit2 failed: %v", err) - } - commit2 := obj2.(*StoredCommit) - if commit2.Hash() != hash2 { - t.Error("commit2 hash mismatch") - } - - if !bytes.Contains(commit2.Message, []byte("Commit 2")) { - t.Errorf("commit2 message doesn't contain 'Commit 2': got %q", commit2.Message) - } -} |
