mirror of
https://github.com/hanzoai/forge.git
synced 2026-10-30 15:00:39 +00:00
2978 files. The fork is 2026-07-15 (rebrand: gitea.dev -> github.com/hanzoai/git), so 2026 is the year, and "Copyright 2026 Hanzo AI, Inc." was already the form used by the handful of files that had ours. Shape is now: // Copyright 2026 Hanzo AI, Inc. All rights reserved. // Copyright 2015 The Gogs Authors. All rights reserved. // Copyright 2019 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT Ours on top, theirs retained verbatim. Retained because MIT requires it, and separately because they are true — those authors did write that code. Not renamed to "The Git Authors": Git is a different project under a different license, and putting its name here would attribute this code to people who have nothing to do with it. Adding our line is the fix; overwriting theirs would have been both a licence violation and a false statement. gofmt still reports import-order drift in some of these files. It predates this change (verified against a stash) and is left alone rather than burying a one-line-per-file legal change under 3000 files of unrelated reordering. Build clean. Co-authored-by: Hanzo Dev <[email protected]>
84 lines
1.8 KiB
Go
84 lines
1.8 KiB
Go
// Copyright 2026 Hanzo AI, Inc. All rights reserved.
|
|
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package gitrepo
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/hanzoai/git/modules/git/gitcmd"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func prepareRepoDirRenameConflict(t *testing.T) string {
|
|
repoDir := filepath.Join(t.TempDir(), "repo-dir-rename-conflict.git")
|
|
require.NoError(t, gitcmd.NewCommand("init", "--bare").AddDynamicArguments(repoDir).Run(t.Context()))
|
|
stdin := `blob
|
|
mark :1
|
|
data 2
|
|
b
|
|
|
|
blob
|
|
mark :2
|
|
data 2
|
|
c
|
|
|
|
reset refs/heads/master
|
|
commit refs/heads/master
|
|
mark :3
|
|
author test <[email protected]> 1769202331 -0800
|
|
committer test <[email protected]> 1769202331 -0800
|
|
data 2
|
|
O
|
|
M 100644 :1 z/b
|
|
M 100644 :2 z/c
|
|
|
|
commit refs/heads/split
|
|
mark :4
|
|
author test <[email protected]> 1769202336 -0800
|
|
committer test <[email protected]> 1769202336 -0800
|
|
data 2
|
|
A
|
|
from :3
|
|
M 100644 :2 w/c
|
|
M 100644 :1 y/b
|
|
D z/b
|
|
D z/c
|
|
|
|
blob
|
|
mark :5
|
|
data 2
|
|
d
|
|
|
|
commit refs/heads/add
|
|
mark :6
|
|
author test <[email protected]> 1769202342 -0800
|
|
committer test <[email protected]> 1769202342 -0800
|
|
data 2
|
|
B
|
|
from :3
|
|
M 100644 :5 z/d
|
|
`
|
|
require.NoError(t, gitcmd.NewCommand("fast-import").WithDir(repoDir).WithStdinBytes([]byte(stdin)).Run(t.Context()))
|
|
return repoDir
|
|
}
|
|
|
|
func TestMergeTreeDirectoryRenameConflictWithoutFiles(t *testing.T) {
|
|
repoDir := prepareRepoDirRenameConflict(t)
|
|
require.DirExists(t, repoDir)
|
|
repo := &mockRepository{path: repoDir}
|
|
|
|
mergeBase, err := MergeBase(t.Context(), repo, "add", "split")
|
|
require.NoError(t, err)
|
|
|
|
treeID, conflicted, conflictedFiles, err := MergeTree(t.Context(), repo, "add", "split", mergeBase)
|
|
require.NoError(t, err)
|
|
assert.True(t, conflicted)
|
|
assert.Empty(t, conflictedFiles)
|
|
assert.Equal(t, "5e3dd4cfc5b11e278a35b2daa83b7274175e3ab1", treeID)
|
|
}
|