-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Provide mechanism for configuring submodule aliases #15180
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
Closed
zeripath
wants to merge
11
commits into
go-gitea:main
from
zeripath:fix-15178-provide-aliases-for-submodules
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ecb943b
Provide mechanism for configuring submodule aliases
zeripath 6be130b
Merge branch 'master' into fix-15178-provide-aliases-for-submodules
zeripath b62f736
placate lint
zeripath f4579b9
Merge remote-tracking branch 'origin/main' into fix-15178-provide-ali…
zeripath 91d8499
Merge branch 'main' into fix-15178-provide-aliases-for-submodules
zeripath c8463b4
Merge branch 'main' into fix-15178-provide-aliases-for-submodules
techknowlogick d94b4bf
Merge remote-tracking branch 'origin/main' into fix-15178-provide-ali…
zeripath 2701412
Merge branch 'main' into fix-15178-provide-aliases-for-submodules
techknowlogick d168e9b
Update custom/conf/app.example.ini
zeripath aa86806
Merge remote-tracking branch 'origin/main' into fix-15178-provide-ali…
zeripath 3ab1816
Merge branch 'main' into fix-15178-provide-aliases-for-submodules
6543 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -577,6 +577,19 @@ PATH = | |
;; (Go-Git only) Don't cache objects greater than this in memory. (Set to 0 to disable.) | ||
;LARGE_OBJECT_THRESHOLD = 1048576 | ||
|
||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
; [git.submodule] | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
;; | ||
;; Submodule aliase | ||
; MAP_NAME_1 = [email protected] | ||
; MAP_VALUE_1 = https://example.com | ||
; MAP_NAME_2 = [email protected]/go-gitea/gitea | ||
; MAP_VALUE_2 = https://gitea.com/gitea/gitea | ||
; ... | ||
|
||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
[service] | ||
|
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 |
---|---|---|
|
@@ -840,13 +840,20 @@ NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take ef | |
- `VERBOSE_PUSH_DELAY`: **5s**: Only print verbose information if push takes longer than this delay. | ||
- `LARGE_OBJECT_THRESHOLD`: **1048576**: (Go-Git only), don't cache objects greater than this in memory. (Set to 0 to disable.) | ||
## Git - Timeout settings (`git.timeout`) | ||
|
||
- `DEFAUlT`: **360**: Git operations default timeout seconds. | ||
- `MIGRATE`: **600**: Migrate external repositories timeout seconds. | ||
- `MIRROR`: **300**: Mirror external repositories timeout seconds. | ||
- `CLONE`: **300**: Git clone from internal repositories timeout seconds. | ||
- `PULL`: **300**: Git pull from internal repositories timeout seconds. | ||
- `GC`: **60**: Git repository GC timeout seconds. | ||
|
||
## Git - Submodule alias settings (`git.submodule`) | ||
|
||
- List of `MAP_NAME_` and `MAP_VALUE_` pairs that map submodule urls or partial urls to web paths. For example: | ||
- `MAP_NAME_1 = [email protected]` & `MAP_VALUE_1 = https://external` would convert any submodules referring to `[email protected]` to `https://external` | ||
- `MAP_NAME_A = [email protected]:owner/repo` & `MAP_VALUE_A = https://external/externalowner/externalrepo` | ||
|
||
## Metrics (`metrics`) | ||
|
||
- `ENABLED`: **false**: Enables /metrics endpoint for prometheus. | ||
|
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 |
---|---|---|
|
@@ -7,37 +7,62 @@ package git | |
import ( | ||
"testing" | ||
|
||
"code.gitea.io/gitea/modules/setting" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGetRefURL(t *testing.T) { | ||
var kases = []struct { | ||
refURL string | ||
prefixURL string | ||
parentPath string | ||
SSHDomain string | ||
expect string | ||
refURL string | ||
prefixURL string | ||
parentPath string | ||
SSHDomain string | ||
expect string | ||
subModuleMap map[string]string | ||
}{ | ||
{"git://github.com/user1/repo1", "/", "user1/repo2", "", "http://github.com/user1/repo1"}, | ||
{"https://localhost/user1/repo1.git", "/", "user1/repo2", "", "https://localhost/user1/repo1"}, | ||
{"http://localhost/user1/repo1.git", "/", "owner/reponame", "", "http://localhost/user1/repo1"}, | ||
{"[email protected]:user1/repo1.git", "/", "owner/reponame", "", "http://github.com/user1/repo1"}, | ||
{"ssh://[email protected]:2222/zefie/lge_g6_kernel_scripts.git", "/", "zefie/lge_g6_kernel", "", "http://git.zefie.net/zefie/lge_g6_kernel_scripts"}, | ||
{"[email protected]:2222/zefie/lge_g6_kernel_scripts.git", "/", "zefie/lge_g6_kernel", "", "http://git.zefie.net/2222/zefie/lge_g6_kernel_scripts"}, | ||
{"[email protected]:go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "", "https://try.gitea.io/go-gitea/gitea"}, | ||
{"ssh://[email protected]:9999/go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "", "https://try.gitea.io/go-gitea/gitea"}, | ||
{"git://[email protected]:9999/go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "", "https://try.gitea.io/go-gitea/gitea"}, | ||
{"ssh://[email protected]:9999/go-gitea/gitea", "https://127.0.0.1:3000/", "go-gitea/sdk", "", "https://127.0.0.1:3000/go-gitea/gitea"}, | ||
{"https://gitea.com:3000/user1/repo1.git", "https://127.0.0.1:3000/", "user/repo2", "", "https://gitea.com:3000/user1/repo1"}, | ||
{"https://example.gitea.com/gitea/user1/repo1.git", "https://example.gitea.com/gitea/", "", "user/repo2", "https://example.gitea.com/gitea/user1/repo1"}, | ||
{"https://username:[email protected]/username/repository.git", "/", "username/repository2", "", "https://username:[email protected]/username/repository"}, | ||
{"somethingbad", "https://127.0.0.1:3000/go-gitea/gitea", "/", "", ""}, | ||
{"git@localhost:user/repo", "https://localhost/", "user2/repo1", "", "https://localhost/user/repo"}, | ||
{"../path/to/repo.git/", "https://localhost/", "user/repo2", "", "https://localhost/user/path/to/repo.git"}, | ||
{"ssh://[email protected]:2222/go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "ssh.gitea.io", "https://try.gitea.io/go-gitea/gitea"}, | ||
{"git://github.com/user1/repo1", "/", "user1/repo2", "", "http://github.com/user1/repo1", map[string]string{}}, | ||
{"https://localhost/user1/repo1.git", "/", "user1/repo2", "", "https://localhost/user1/repo1", map[string]string{}}, | ||
{"http://localhost/user1/repo1.git", "/", "owner/reponame", "", "http://localhost/user1/repo1", map[string]string{}}, | ||
{"[email protected]:user1/repo1.git", "/", "owner/reponame", "", "http://github.com/user1/repo1", map[string]string{}}, | ||
{"ssh://[email protected]:2222/zefie/lge_g6_kernel_scripts.git", "/", "zefie/lge_g6_kernel", "", "http://git.zefie.net/zefie/lge_g6_kernel_scripts", map[string]string{}}, | ||
{"[email protected]:2222/zefie/lge_g6_kernel_scripts.git", "/", "zefie/lge_g6_kernel", "", "http://git.zefie.net/2222/zefie/lge_g6_kernel_scripts", map[string]string{}}, | ||
{"[email protected]:go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "", "https://try.gitea.io/go-gitea/gitea", map[string]string{}}, | ||
{"ssh://[email protected]:9999/go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "", "https://try.gitea.io/go-gitea/gitea", map[string]string{}}, | ||
{"git://[email protected]:9999/go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "", "https://try.gitea.io/go-gitea/gitea", map[string]string{}}, | ||
{"ssh://[email protected]:9999/go-gitea/gitea", "https://127.0.0.1:3000/", "go-gitea/sdk", "", "https://127.0.0.1:3000/go-gitea/gitea", map[string]string{}}, | ||
{"https://gitea.com:3000/user1/repo1.git", "https://127.0.0.1:3000/", "user/repo2", "", "https://gitea.com:3000/user1/repo1", map[string]string{}}, | ||
{"https://example.gitea.com/gitea/user1/repo1.git", "https://example.gitea.com/gitea/", "", "user/repo2", "https://example.gitea.com/gitea/user1/repo1", map[string]string{}}, | ||
{"https://username:[email protected]/username/repository.git", "/", "username/repository2", "", "https://username:[email protected]/username/repository", map[string]string{}}, | ||
{"somethingbad", "https://127.0.0.1:3000/go-gitea/gitea", "/", "", "", map[string]string{}}, | ||
{"git@localhost:user/repo", "https://localhost/", "user2/repo1", "", "https://localhost/user/repo", map[string]string{}}, | ||
{"../path/to/repo.git/", "https://localhost/", "user/repo2", "", "https://localhost/user/path/to/repo.git", map[string]string{}}, | ||
{"ssh://[email protected]:2222/go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "ssh.gitea.io", "https://try.gitea.io/go-gitea/gitea", map[string]string{}}, | ||
{"ssh://[email protected]:2222/go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "try.gitea.io", "https://try.gitea.io/go-gitea/gitea", map[string]string{ | ||
"ssh://[email protected]:2222": "https://try.gitea.io", | ||
}}, | ||
{"[email protected]:go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "try.gitea.io", "https://try.gitea.io/go-gitea/gitea", map[string]string{ | ||
"[email protected]": "https://try.gitea.io", | ||
"ssh://[email protected]:2222": "Wrong", | ||
}}, | ||
{"ssh://[email protected]/go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "try.gitea.io", "https://try.gitea.io/go-gitea/gitea", map[string]string{ | ||
"ssh://[email protected]": "https://try.gitea.io", | ||
"ssh://[email protected]:2222": "Wrong", | ||
}}, | ||
{"ssh://[email protected]/go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "try.gitea.io", "https://try.gitea.io/go-gitea/gitea", map[string]string{ | ||
"[email protected]": "https://try.gitea.io", | ||
}}, | ||
{"ssh://[email protected]/go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "try.gitea.io", "https://try.gitea.io/go-gitea/gitea", map[string]string{ | ||
"[email protected]": "https://try.gitea.io", | ||
}}, | ||
{"ssh://[email protected]/go-gitea/gitea", "https://try.gitea.io/", "go-gitea/sdk", "try.gitea.io", "https://try.gitea.io/go-gitea/gitea", map[string]string{ | ||
"[email protected]:go-gitea/gitea": "https://try.gitea.io/go-gitea/gitea", | ||
}}, | ||
} | ||
|
||
orig := setting.Git.SubModuleMap | ||
for _, kase := range kases { | ||
setting.Git.SubModuleMap = kase.subModuleMap | ||
assert.EqualValues(t, kase.expect, getRefURL(kase.refURL, kase.prefixURL, kase.parentPath, kase.SSHDomain)) | ||
} | ||
setting.Git.SubModuleMap = orig | ||
} |
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
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.