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

WIP: Move git as modules/git #5991

wants to merge 226 commits into
base: master


Copy link

lunny commented Feb 7, 2019

This will still keep all the git commit histories.

Unknwon and others added some commits Nov 26, 2015

Merge pull request #3 from novaeye/patch-1
try to fix  Duplicate of files in directory (gogs#2254 )
Fix regression causing no submodule info
This fixes regression introduced in ebd9fb2,
that GetSubModules was always returning empty submodule info because
c.submoduleCache != nil check was always true since parseCommitData was setting
commit.submoduleCache = newObjectCache() so it was always not-nil.

Now we initialize submoduleCache in first GetSubModules call, next call will
return cached entries.
Do not fail in GetCommitsInfo with no .gitmodules
This fixes GetCommitsInfo returning

 GetSubModule (/somemodule): object does not exist [id: , rel_path: .gitmodules]

when /somemodule is a ref entry but no .gitmodules file is present. Instead
failing we just check for IsErrNotExist and return empty submodule url.

This also fixes HTTP 500 internal error in Gogs for case described above.

HoffmannP and others added some commits Nov 11, 2018

Blob api (#132)
* Add repo_blob

This adds a new Repository.GetBlob(id) method for use by gitea.

* This is a follow-up for PR #121 to implement blob_api including full test coverage

Signed-off-by: Berengar W. Lehr <>
Refactor branch list using src-d/go-git and add GetRefs function (#133)
* Refactor branch list using src-d/go-git and add GetRefs function

* Fix copyright

* Fix to reuse ObjectType

* Add function to filter refs by prefix

* Fix import order

* Optimize if structure
Improving / Exposing Git-Trees related features for Git-Trees API. (#123

* Exposed TreeEntry.mode, changed EntryMode to hex.

* Added reference parsing (HEAD, HEAD~1, etc) for trees

* Added missing description

* Added Tree.ListEntriesRecursive() - utilizes the git ls-tree -r command
command: fix NewCommand (#135)
Make an explicit copy of GlobalCommandArgs, otherwise append might
overwrite it.
Replace @JonasFranzDEV with @jonasfranz (#138)
* Replace @JonasFranzDEV with @jonasfranz

* Update MAINTAINERS file
GetCommit() returns a ErrNotExist if short commit ID does not exists (#…

* GetCommit() returns a ErrNotExist if short commit ID does not exists

Currently, GetCommit() returns a generic error if a short commit ID
does not exists in a repository.

When a commit is not found by git-rev-parse, it returns an errors
which contains "fatal: ambiguous argument". GetCommit() now search if
the error contains this string, and, if it does, returns an

The idea is to allow commits to be accessed from gitea with a short
commit ID.  Without this change, it would return a 500 Internal Server
Error when a short ID does not exists in the repository.

Signed-off-by: Alban Gruin <>

* GetCommit(): change the comparison for short commit messages

`fatal: ambiguous argument` can be the beginning of two errors in
git. This changes the comparison to something less ambiguous.

Signed-off-by: Alban Gruin <>
Add 'modules/git/' from commit '0aea7f12d36ed49bcac560b61301cff88e478…

git-subtree-dir: modules/git
git-subtree-mainline: 2d213b6
git-subtree-split: 0aea7f1

@lunny lunny added the kind/build label Feb 7, 2019

@lunny lunny changed the title Move git as modules/git WIP: Move git as modules/git Feb 7, 2019

zeripath added some commits Feb 7, 2019


This comment has been minimized.

Copy link

codecov-io commented Feb 9, 2019

Codecov Report

Merging #5991 into master will increase coverage by 0.65%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5991      +/-   ##
+ Coverage   38.72%   39.38%   +0.65%     
  Files         332      360      +28     
  Lines       48992    50816    +1824     
+ Hits        18973    20014    +1041     
- Misses      27271    27939     +668     
- Partials     2748     2863     +115
Impacted Files Coverage Δ
models/repo_branch.go 58.73% <ø> (ø) ⬆️
modules/git/tree.go 64.81% <ø> (ø)
models/repo_tag.go 62.5% <ø> (ø) ⬆️
routers/init.go 71.83% <ø> (ø) ⬆️
routers/repo/setting.go 10.35% <ø> (ø) ⬆️
modules/git/repo_tag.go 63.63% <ø> (ø)
modules/git/tree_entry.go 73.73% <ø> (ø)
models/graph.go 81.03% <ø> (ø) ⬆️
routers/repo/view.go 46.1% <ø> (-1.2%) ⬇️
modules/notification/base/null.go 22.72% <ø> (ø) ⬆️
... and 100 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c865f3...9558cc8. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 label Feb 9, 2019


This comment has been minimized.

Copy link

zeripath commented Feb 9, 2019

Hey @lunny I hope you don't mind that I took the liberty of getting this to build.

I think there's still a few things left:

  • Ensure that everything in modules/git/Makefile is covered by the main gitea Makefile.
  • There's a still a modules/git/docker folder which should probably be removed.

This comment has been minimized.

Copy link

zeripath commented Feb 10, 2019

I looked a bit more at this earlier today, there are issues in terms of the tests and benchmarks of the git module. These will add files to modules/git directory by default - these aren't cleaned and as some are go files will then cause other make tasks to fail.

They should probably be changed to download to a temporary directory which is deleted at the end of a test.


This comment has been minimized.

Copy link
Member Author

lunny commented Feb 11, 2019

@zeripath please feel free to submit your commits. This PR still needs many changes.


This comment has been minimized.

Copy link

zeripath commented Feb 11, 2019

They should already be there - I used my manager rights to push changes to your GitHub branch. If you pull from that locally you should get the changes.

@techknowlogick techknowlogick added this to the 1.9.0 milestone Feb 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment