diff options
author | zeripath <art27@cantab.net> | 2019-10-12 01:13:27 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-10-12 08:13:27 +0800 |
commit | 5e759b60cca3cd8484a6235fcc9120d18e8cd455 (patch) | |
tree | b9932067119f16197f69f12ec9b04aa74f68845a /modules/repofiles/update.go | |
parent | ac3613b791884f29c386bda2ccaad5c7434d822c (diff) | |
download | gitea-5e759b60cca3cd8484a6235fcc9120d18e8cd455.tar.gz gitea-5e759b60cca3cd8484a6235fcc9120d18e8cd455.zip |
Restore functionality for early gits (#7775)
* Change tests to make it possible to run TestGit with 1.7.2
* Make merge run on 1.7.2
* Fix tracking and staging branch name problem
* Ensure that git 1.7.2 works on tests
* ensure that there is no chance for conflicts
* Fix-up missing merge issues
* Final rm
* Ensure LFS filters run on the tests
* Do not sign commits from temp repo
* Restore tracking fetch change
* Apply suggestions from code review
* Update modules/repofiles/temp_repo.go
Diffstat (limited to 'modules/repofiles/update.go')
-rw-r--r-- | modules/repofiles/update.go | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/modules/repofiles/update.go b/modules/repofiles/update.go index ee1b16bce9..1a1fe6c389 100644 --- a/modules/repofiles/update.go +++ b/modules/repofiles/update.go @@ -313,12 +313,6 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up } } - // Check there is no way this can return multiple infos - filename2attribute2info, err := t.CheckAttribute("filter", treePath) - if err != nil { - return nil, err - } - content := opts.Content if bom { content = string(charset.UTF8BOM) + content @@ -341,16 +335,23 @@ func CreateOrUpdateRepoFile(repo *models.Repository, doer *models.User, opts *Up opts.Content = content var lfsMetaObject *models.LFSMetaObject - if setting.LFS.StartServer && filename2attribute2info[treePath] != nil && filename2attribute2info[treePath]["filter"] == "lfs" { - // OK so we are supposed to LFS this data! - oid, err := models.GenerateLFSOid(strings.NewReader(opts.Content)) + if setting.LFS.StartServer { + // Check there is no way this can return multiple infos + filename2attribute2info, err := t.CheckAttribute("filter", treePath) if err != nil { return nil, err } - lfsMetaObject = &models.LFSMetaObject{Oid: oid, Size: int64(len(opts.Content)), RepositoryID: repo.ID} - content = lfsMetaObject.Pointer() - } + if filename2attribute2info[treePath] != nil && filename2attribute2info[treePath]["filter"] == "lfs" { + // OK so we are supposed to LFS this data! + oid, err := models.GenerateLFSOid(strings.NewReader(opts.Content)) + if err != nil { + return nil, err + } + lfsMetaObject = &models.LFSMetaObject{Oid: oid, Size: int64(len(opts.Content)), RepositoryID: repo.ID} + content = lfsMetaObject.Pointer() + } + } // Add the object to the database objectHash, err := t.HashObject(strings.NewReader(content)) if err != nil { |