mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-11 14:36:06 +02:00
Merge remote-tracking branch 'upstream/main' into limit-repo-size
This commit is contained in:
@@ -495,7 +495,7 @@ func GetCommitFileStatus(ctx context.Context, repoPath, commitID string) (*Commi
|
||||
}()
|
||||
|
||||
stderr := new(bytes.Buffer)
|
||||
err := NewCommand(ctx, "log", "--name-status", "-c", "--pretty=format:", "--parents", "--no-renames", "-z", "-1").AddDynamicArguments(commitID).Run(&RunOpts{
|
||||
err := NewCommand(ctx, "log", "--name-status", "-m", "--pretty=format:", "--first-parent", "--no-renames", "-z", "-1").AddDynamicArguments(commitID).Run(&RunOpts{
|
||||
Dir: repoPath,
|
||||
Stdout: w,
|
||||
Stderr: stderr,
|
||||
|
||||
@@ -255,3 +255,26 @@ func TestParseCommitFileStatus(t *testing.T) {
|
||||
assert.Equal(t, kase.modified, fileStatus.Modified)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetCommitFileStatusMerges(t *testing.T) {
|
||||
bareRepo1Path := filepath.Join(testReposDir, "repo6_merge")
|
||||
|
||||
commitFileStatus, err := GetCommitFileStatus(DefaultContext, bareRepo1Path, "022f4ce6214973e018f02bf363bf8a2e3691f699")
|
||||
assert.NoError(t, err)
|
||||
|
||||
expected := CommitFileStatus{
|
||||
[]string{
|
||||
"add_file.txt",
|
||||
},
|
||||
[]string{
|
||||
"to_remove.txt",
|
||||
},
|
||||
[]string{
|
||||
"to_modify.txt",
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, commitFileStatus.Added, expected.Added)
|
||||
assert.Equal(t, commitFileStatus.Removed, expected.Removed)
|
||||
assert.Equal(t, commitFileStatus.Modified, expected.Modified)
|
||||
}
|
||||
|
||||
@@ -374,27 +374,25 @@ heaploop:
|
||||
break heaploop
|
||||
}
|
||||
parentRemaining.Remove(current.CommitID)
|
||||
if current.Paths != nil {
|
||||
for i, found := range current.Paths {
|
||||
if !found {
|
||||
continue
|
||||
for i, found := range current.Paths {
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
changed[i] = false
|
||||
if results[i] == "" {
|
||||
results[i] = current.CommitID
|
||||
if err := repo.LastCommitCache.Put(headRef, path.Join(treepath, paths[i]), current.CommitID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
changed[i] = false
|
||||
if results[i] == "" {
|
||||
results[i] = current.CommitID
|
||||
if err := repo.LastCommitCache.Put(headRef, path.Join(treepath, paths[i]), current.CommitID); err != nil {
|
||||
delete(path2idx, paths[i])
|
||||
remaining--
|
||||
if results[0] == "" {
|
||||
results[0] = current.CommitID
|
||||
if err := repo.LastCommitCache.Put(headRef, treepath, current.CommitID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
delete(path2idx, paths[i])
|
||||
delete(path2idx, "")
|
||||
remaining--
|
||||
if results[0] == "" {
|
||||
results[0] = current.CommitID
|
||||
if err := repo.LastCommitCache.Put(headRef, treepath, current.CommitID); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
delete(path2idx, "")
|
||||
remaining--
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ref: refs/heads/main
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
x�ÍM
|
||||
1†a×=Eö‚$µÍLAÄ«ô'Á‡‘iæþR½€›g÷~_ÝÖu1 ˜N¶‹@mZ)g�2…D‘j™Š*_“fŒÌs¥4ïòaÏm“np>—Áˆç€Ì>!œÑ#ºú½1ù;p]ìxÿæuyIwÑN4Ã
|
||||
@@ -0,0 +1,2 @@
|
||||
x█нM
|
||||
б0├aв9еЛ≥ЭM2 БU Ф╛∙=©т╦yv/╪С╤╝к гН0:@╠Р$╠│Uя╛╚.≈[й>╚ ■l⌠▀IлsЙxР╘З8'T╞╟R╧д╓S,╙╠$x.
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
xŤÎM
|
||||
1@a×=Eö‚¤?iń*mšÁÇ‘™xOŕćŰ=x˛.Ëlŕ™O¶©R˘Z80ŠÄ\[í*Ú%µb
|
||||
�&qď¶éË –IŠŽČšÔç�ť
|
||||
7ęĚÔ‹F쨜ĽwícŹuÓÝŕzx?¸ÜŔçš0ç
|
||||
ś1 :ům™ţ¸6LóSÝŔí>&
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
022f4ce6214973e018f02bf363bf8a2e3691f699
|
||||
@@ -0,0 +1 @@
|
||||
ae4b035e7c4afbc000576cee3f713ea0c2f1e1e2
|
||||
@@ -0,0 +1 @@
|
||||
d1792641396ff7630d35fbb0b74b86b0c71bca77
|
||||
@@ -0,0 +1 @@
|
||||
38ec3e0cdc88bde01014bda4a5dd9fc835f41439
|
||||
Reference in New Issue
Block a user