-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Restore functionality for early gits #7775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lunny
merged 17 commits into
go-gitea:master
from
zeripath:fix-7754-Make-merge-work-on-1.7.2
Oct 12, 2019
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
9a69d80
Change tests to make it possible to run TestGit with 1.7.2
zeripath 9b4fcc7
Make merge run on 1.7.2
zeripath 29758ec
Fix tracking and staging branch name problem
zeripath bdb32c9
ensure that there is no chance for conflicts
zeripath d6841c5
Fix-up missing merge issues
zeripath f501939
Ensure that git 1.7.2 works on tests
zeripath 04c67ed
Final rm
zeripath afca25d
Ensure LFS filters run on the tests
zeripath 709c48b
Do not sign commits from temp repo
zeripath da76fa2
Merge branch 'master' into fix-7754-Make-merge-work-on-1.7.2
zeripath c456747
Merge branch 'master' into fix-7754-Make-merge-work-on-1.7.2
zeripath 215b8a1
Restore tracking fetch change
zeripath eca4132
Apply suggestions from code review
zeripath 5169165
Update modules/repofiles/temp_repo.go
zeripath ab08f15
Merge branch 'master' into fix-7754-Make-merge-work-on-1.7.2
lunny bf0d659
Merge branch 'master' into fix-7754-Make-merge-work-on-1.7.2
lafriks 7c0fc09
Merge branch 'master' into fix-7754-Make-merge-work-on-1.7.2
zeripath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ import ( | |
|
||
"code.gitea.io/gitea/models" | ||
"code.gitea.io/gitea/modules/git" | ||
"code.gitea.io/gitea/modules/setting" | ||
api "code.gitea.io/gitea/modules/structs" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
@@ -135,13 +136,33 @@ func standardCommitAndPushTest(t *testing.T, dstPath string) (little, big string | |
func lfsCommitAndPushTest(t *testing.T, dstPath string) (littleLFS, bigLFS string) { | ||
t.Run("LFS", func(t *testing.T) { | ||
PrintCurrentTest(t) | ||
setting.CheckLFSVersion() | ||
if !setting.LFS.StartServer { | ||
t.Skip() | ||
return | ||
} | ||
prefix := "lfs-data-file-" | ||
_, err := git.NewCommand("lfs").AddArguments("install").RunInDir(dstPath) | ||
assert.NoError(t, err) | ||
_, err = git.NewCommand("lfs").AddArguments("track", prefix+"*").RunInDir(dstPath) | ||
assert.NoError(t, err) | ||
err = git.AddChanges(dstPath, false, ".gitattributes") | ||
assert.NoError(t, err) | ||
oldGlobals := allowLFSFilters() | ||
err = git.CommitChanges(dstPath, git.CommitChangesOptions{ | ||
Committer: &git.Signature{ | ||
Email: "[email protected]", | ||
Name: "User Two", | ||
When: time.Now(), | ||
}, | ||
Author: &git.Signature{ | ||
Email: "[email protected]", | ||
Name: "User Two", | ||
When: time.Now(), | ||
}, | ||
Message: fmt.Sprintf("Testing commit @ %v", time.Now()), | ||
}) | ||
git.GlobalCommandArgs = oldGlobals | ||
|
||
littleLFS, bigLFS = commitAndPushTest(t, dstPath, prefix) | ||
|
||
|
@@ -185,20 +206,25 @@ func rawTest(t *testing.T, ctx *APITestContext, little, big, littleLFS, bigLFS s | |
resp := session.MakeRequest(t, req, http.StatusOK) | ||
assert.Equal(t, littleSize, resp.Body.Len()) | ||
|
||
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/raw/branch/master/", littleLFS)) | ||
resp = session.MakeRequest(t, req, http.StatusOK) | ||
assert.NotEqual(t, littleSize, resp.Body.Len()) | ||
assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier) | ||
setting.CheckLFSVersion() | ||
if setting.LFS.StartServer { | ||
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/raw/branch/master/", littleLFS)) | ||
resp = session.MakeRequest(t, req, http.StatusOK) | ||
assert.NotEqual(t, littleSize, resp.Body.Len()) | ||
assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier) | ||
} | ||
|
||
if !testing.Short() { | ||
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/raw/branch/master/", big)) | ||
resp = session.MakeRequest(t, req, http.StatusOK) | ||
assert.Equal(t, bigSize, resp.Body.Len()) | ||
|
||
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/raw/branch/master/", bigLFS)) | ||
resp = session.MakeRequest(t, req, http.StatusOK) | ||
assert.NotEqual(t, bigSize, resp.Body.Len()) | ||
assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier) | ||
if setting.LFS.StartServer { | ||
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/raw/branch/master/", bigLFS)) | ||
resp = session.MakeRequest(t, req, http.StatusOK) | ||
assert.NotEqual(t, bigSize, resp.Body.Len()) | ||
assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier) | ||
} | ||
} | ||
}) | ||
} | ||
|
@@ -217,18 +243,23 @@ func mediaTest(t *testing.T, ctx *APITestContext, little, big, littleLFS, bigLFS | |
resp := session.MakeRequestNilResponseRecorder(t, req, http.StatusOK) | ||
assert.Equal(t, littleSize, resp.Length) | ||
|
||
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/media/branch/master/", littleLFS)) | ||
resp = session.MakeRequestNilResponseRecorder(t, req, http.StatusOK) | ||
assert.Equal(t, littleSize, resp.Length) | ||
setting.CheckLFSVersion() | ||
if setting.LFS.StartServer { | ||
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/media/branch/master/", littleLFS)) | ||
resp = session.MakeRequestNilResponseRecorder(t, req, http.StatusOK) | ||
assert.Equal(t, littleSize, resp.Length) | ||
} | ||
|
||
if !testing.Short() { | ||
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/media/branch/master/", big)) | ||
resp = session.MakeRequestNilResponseRecorder(t, req, http.StatusOK) | ||
assert.Equal(t, bigSize, resp.Length) | ||
|
||
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/media/branch/master/", bigLFS)) | ||
resp = session.MakeRequestNilResponseRecorder(t, req, http.StatusOK) | ||
assert.Equal(t, bigSize, resp.Length) | ||
if setting.LFS.StartServer { | ||
req = NewRequest(t, "GET", path.Join("/", username, reponame, "/media/branch/master/", bigLFS)) | ||
resp = session.MakeRequestNilResponseRecorder(t, req, http.StatusOK) | ||
assert.Equal(t, bigSize, resp.Length) | ||
} | ||
} | ||
}) | ||
} | ||
|
@@ -274,6 +305,8 @@ func generateCommitWithNewData(size int, repoPath, email, fullName, prefix strin | |
} | ||
|
||
//Commit | ||
// Now here we should explicitly allow lfs filters to run | ||
oldGlobals := allowLFSFilters() | ||
err = git.AddChanges(repoPath, false, filepath.Base(tmpFile.Name())) | ||
if err != nil { | ||
return "", err | ||
|
@@ -291,6 +324,7 @@ func generateCommitWithNewData(size int, repoPath, email, fullName, prefix strin | |
}, | ||
Message: fmt.Sprintf("Testing commit @ %v", time.Now()), | ||
}) | ||
git.GlobalCommandArgs = oldGlobals | ||
return filepath.Base(tmpFile.Name()), err | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.