aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gopkg.lock19
-rw-r--r--cmd/admin.go2
-rw-r--r--cmd/hook.go2
-rw-r--r--cmd/serv.go2
-rw-r--r--integrations/api_releases_test.go2
-rw-r--r--integrations/git_helper_for_declarative_test.go2
-rw-r--r--integrations/git_test.go2
-rw-r--r--integrations/ssh_key_test.go2
-rw-r--r--models/action.go2
-rw-r--r--models/action_test.go2
-rw-r--r--models/git_diff.go2
-rw-r--r--models/gpg_key.go2
-rw-r--r--models/graph.go2
-rw-r--r--models/graph_test.go2
-rw-r--r--models/issue_comment.go2
-rw-r--r--models/migrations/v28.go2
-rw-r--r--models/migrations/v39.go2
-rw-r--r--models/migrations/v82.go2
-rw-r--r--models/pull.go2
-rw-r--r--models/release.go4
-rw-r--r--models/release_test.go2
-rw-r--r--models/repo.go2
-rw-r--r--models/repo_branch.go2
-rw-r--r--models/repo_indexer.go2
-rw-r--r--models/repo_mirror.go2
-rw-r--r--models/repo_tag.go2
-rw-r--r--models/status.go2
-rw-r--r--models/update.go2
-rw-r--r--models/update_test.go2
-rw-r--r--models/user.go2
-rw-r--r--models/webhook_dingtalk.go3
-rw-r--r--models/webhook_discord.go2
-rw-r--r--models/webhook_slack.go2
-rw-r--r--models/wiki.go7
-rw-r--r--modules/base/tool.go3
-rw-r--r--modules/context/api.go3
-rw-r--r--modules/context/repo.go2
-rw-r--r--modules/git/README.md3
-rw-r--r--modules/git/blob.go (renamed from vendor/code.gitea.io/git/blob.go)0
-rw-r--r--modules/git/blob_test.go80
-rw-r--r--modules/git/cache.go (renamed from vendor/code.gitea.io/git/cache.go)0
-rw-r--r--modules/git/command.go (renamed from vendor/code.gitea.io/git/command.go)4
-rw-r--r--modules/git/command_test.go41
-rw-r--r--modules/git/commit.go (renamed from vendor/code.gitea.io/git/commit.go)0
-rw-r--r--modules/git/commit_archive.go (renamed from vendor/code.gitea.io/git/commit_archive.go)0
-rw-r--r--modules/git/commit_info.go (renamed from vendor/code.gitea.io/git/commit_info.go)0
-rw-r--r--modules/git/commit_info_test.go117
-rw-r--r--modules/git/commit_test.go38
-rw-r--r--modules/git/error.go (renamed from vendor/code.gitea.io/git/error.go)0
-rw-r--r--modules/git/git.go (renamed from vendor/code.gitea.io/git/git.go)0
-rw-r--r--modules/git/hook.go (renamed from vendor/code.gitea.io/git/hook.go)13
-rw-r--r--modules/git/parse.go (renamed from vendor/code.gitea.io/git/parse.go)0
-rw-r--r--modules/git/parse_test.go58
-rw-r--r--modules/git/ref.go (renamed from vendor/code.gitea.io/git/ref.go)0
-rw-r--r--modules/git/repo.go (renamed from vendor/code.gitea.io/git/repo.go)0
-rw-r--r--modules/git/repo_blame.go (renamed from vendor/code.gitea.io/git/repo_blame.go)0
-rw-r--r--modules/git/repo_blob.go (renamed from vendor/code.gitea.io/git/repo_blob.go)0
-rw-r--r--modules/git/repo_blob_test.go66
-rw-r--r--modules/git/repo_branch.go (renamed from vendor/code.gitea.io/git/repo_branch.go)0
-rw-r--r--modules/git/repo_branch_test.go39
-rw-r--r--modules/git/repo_commit.go (renamed from vendor/code.gitea.io/git/repo_commit.go)4
-rw-r--r--modules/git/repo_commit_test.go59
-rw-r--r--modules/git/repo_hook.go (renamed from vendor/code.gitea.io/git/repo_hook.go)2
-rw-r--r--modules/git/repo_object.go (renamed from vendor/code.gitea.io/git/repo_object.go)0
-rw-r--r--modules/git/repo_pull.go (renamed from vendor/code.gitea.io/git/repo_pull.go)0
-rw-r--r--modules/git/repo_pull_test.go30
-rw-r--r--modules/git/repo_ref.go (renamed from vendor/code.gitea.io/git/repo_ref.go)0
-rw-r--r--modules/git/repo_ref_test.go49
-rw-r--r--modules/git/repo_tag.go (renamed from vendor/code.gitea.io/git/repo_tag.go)0
-rw-r--r--modules/git/repo_tag_test.go44
-rw-r--r--modules/git/repo_test.go26
-rw-r--r--modules/git/repo_tree.go (renamed from vendor/code.gitea.io/git/repo_tree.go)2
-rw-r--r--modules/git/sha1.go (renamed from vendor/code.gitea.io/git/sha1.go)0
-rw-r--r--modules/git/signature.go (renamed from vendor/code.gitea.io/git/signature.go)0
-rw-r--r--modules/git/submodule.go (renamed from vendor/code.gitea.io/git/submodule.go)0
-rw-r--r--modules/git/submodule_test.go29
-rw-r--r--modules/git/tag.go (renamed from vendor/code.gitea.io/git/tag.go)0
-rw-r--r--modules/git/tests/repos/repo1_bare/HEAD1
-rw-r--r--modules/git/tests/repos/repo1_bare/config4
-rw-r--r--modules/git/tests/repos/repo1_bare/description1
-rwxr-xr-xmodules/git/tests/repos/repo1_bare/hooks/applypatch-msg.sample15
-rwxr-xr-xmodules/git/tests/repos/repo1_bare/hooks/commit-msg.sample24
-rwxr-xr-xmodules/git/tests/repos/repo1_bare/hooks/post-update.sample8
-rwxr-xr-xmodules/git/tests/repos/repo1_bare/hooks/pre-applypatch.sample14
-rwxr-xr-xmodules/git/tests/repos/repo1_bare/hooks/pre-commit.sample49
-rwxr-xr-xmodules/git/tests/repos/repo1_bare/hooks/pre-push.sample53
-rwxr-xr-xmodules/git/tests/repos/repo1_bare/hooks/pre-rebase.sample169
-rwxr-xr-xmodules/git/tests/repos/repo1_bare/hooks/pre-receive.sample24
-rwxr-xr-xmodules/git/tests/repos/repo1_bare/hooks/prepare-commit-msg.sample36
-rwxr-xr-xmodules/git/tests/repos/repo1_bare/hooks/update.sample128
-rw-r--r--modules/git/tests/repos/repo1_bare/info/exclude6
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/0b/9f291245f6c596fd30bee925fe94fe0cbadd60bin0 -> 54 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/11/93ff46343f4f6a0522e2b28b871e905178c1f0bin0 -> 23 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/15/3f451b9ee7fa1da317ab17a127e9fd9d384310bin0 -> 31 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/18/4d49c75a0b202b1d2ea2fcb5861c329321fcd6bin0 -> 56 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/21/6bf54c2f2e2916b830ebe09e8c58a6ed52d86bbin0 -> 28 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/28/39944139e0de9737a044f78b0e4b40d989a9e31
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/2e/65efe2a145dda7ee51d1741299f848e5bf752ebin0 -> 16 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/30/4c56b3bef33d0afeb8515ee803c839daf30ab8bin0 -> 85 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/34/d1da713bf7de1c535e1d7d3ca985afd84bc7e5bin0 -> 23 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/37/991dec2c8e592043f47155ce4808d4580f91231
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/38/441bf2c4d4c27efff94728c9eb33266f44a702bin0 -> 134 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/3a/d28a9149a2864384548f3d17ed7f38014c9e8abin0 -> 638 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/50/13716a9da8e66ea21059a84f1b4311424d2b7fbin0 -> 31 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/59/dfb0bb505a601006e31fed53d2e24e44fca9cabin0 -> 144 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/5c/80b0245c1c6f8343fa418ec374b13b5d4ee6583
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/62/d735f9efa9cf5b7df6bac9917b80e4779f4315bin0 -> 111 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/64/3a35374408002fcf2f0e8d42d262a1e0e2f80ebin0 -> 32 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/6c/493ff740f9380390d5c9ddef4af18697ac9375bin0 -> 21 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/6f/bd69e9823458e6c4a2fc5c0f6bc022b2f2acd11
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/7e/3b688f3369ca28ebafbda9f8ef39713dd12fc8bin0 -> 85 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/80/06ff9adbf0cb94da7dad9e537e53817f9fa5c0bin0 -> 176 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/82/26f571dcc2d2f33a7179d929b10b9c39faa631bin0 -> 71 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/83/b9c4da46ed59098a009f8640c77eac97b71dfebin0 -> 115 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/8d/92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2bin0 -> 153 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/95/bb4d39648ee7e325106df01a621c530863a653bin0 -> 121 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/98/1ff127cc331753bba28e1377c35934f1ca9b56bin0 -> 56 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/9c/9aef8dd84e02bc7ec12641deb4c930a7c301852
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/b1/4df6442ea5a1b382985a6549b85d435376c351bin0 -> 18 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/b1/fc9917b618c924cf4aa421dae74e8bf9b556d3bin0 -> 176 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/b7/5f44edbd9252c32bf9faa0c1257ffb3b126c24bin0 -> 80 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/c8/c90111bdc18b3afd2b2906007059e95ac8fdc3bin0 -> 111 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/d0/845fe2f85710b50d673dafe98236bf9f2023dabin0 -> 50 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/e2/129701f1a4d54dc44f03c93bca0a2aec7c5449bin0 -> 21 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/objects/f1/a6cb52b2d16773290cefe49ad0684b50a4f930bin0 -> 111 bytes
-rw-r--r--modules/git/tests/repos/repo1_bare/refs/heads/branch11
-rw-r--r--modules/git/tests/repos/repo1_bare/refs/heads/branch21
-rw-r--r--modules/git/tests/repos/repo1_bare/refs/heads/master1
-rw-r--r--modules/git/tests/repos/repo1_bare/refs/tags/test1
-rw-r--r--modules/git/tree.go (renamed from vendor/code.gitea.io/git/tree.go)4
-rw-r--r--modules/git/tree_blob.go (renamed from vendor/code.gitea.io/git/tree_blob.go)4
-rw-r--r--modules/git/tree_entry.go (renamed from vendor/code.gitea.io/git/tree_entry.go)2
-rw-r--r--modules/git/tree_entry_test.go98
-rw-r--r--modules/git/utils.go (renamed from vendor/code.gitea.io/git/utils.go)0
-rw-r--r--modules/notification/base/notifier.go2
-rw-r--r--modules/notification/base/null.go2
-rw-r--r--modules/notification/notification.go2
-rw-r--r--modules/notification/ui/ui.go2
-rw-r--r--modules/setting/git.go3
-rw-r--r--modules/setting/setting.go2
-rw-r--r--modules/test/context_tests.go5
-rw-r--r--modules/uploader/delete.go2
-rw-r--r--modules/uploader/update.go2
-rw-r--r--modules/uploader/upload.go5
-rw-r--r--routers/api/v1/convert/convert.go9
-rw-r--r--routers/api/v1/repo/commits.go5
-rw-r--r--routers/api/v1/repo/file.go3
-rw-r--r--routers/api/v1/repo/git_ref.go3
-rw-r--r--routers/api/v1/repo/hook.go2
-rw-r--r--routers/api/v1/repo/pull.go3
-rw-r--r--routers/api/v1/repo/tree.go2
-rw-r--r--routers/init.go2
-rw-r--r--routers/private/push_update.go2
-rw-r--r--routers/repo/branch.go2
-rw-r--r--routers/repo/commit.go2
-rw-r--r--routers/repo/download.go3
-rw-r--r--routers/repo/editor.go2
-rw-r--r--routers/repo/issue.go8
-rw-r--r--routers/repo/middlewares.go2
-rw-r--r--routers/repo/pull.go2
-rw-r--r--routers/repo/repo.go7
-rw-r--r--routers/repo/setting.go3
-rw-r--r--routers/repo/setting_protected_branch.go2
-rw-r--r--routers/repo/view.go2
-rw-r--r--routers/repo/webhook.go2
-rw-r--r--routers/repo/wiki.go3
-rw-r--r--routers/repo/wiki_test.go2
-rw-r--r--vendor/code.gitea.io/git/LICENSE20
-rw-r--r--vendor/code.gitea.io/git/doc.go5
-rw-r--r--vendor/github.com/stretchr/testify/require/doc.go28
-rw-r--r--vendor/github.com/stretchr/testify/require/forward_requirements.go16
-rw-r--r--vendor/github.com/stretchr/testify/require/require.go867
-rw-r--r--vendor/github.com/stretchr/testify/require/require_forward.go687
-rw-r--r--vendor/github.com/stretchr/testify/require/requirements.go9
174 files changed, 3044 insertions, 145 deletions
diff --git a/Gopkg.lock b/Gopkg.lock
index cf5223dfff..bc29e41c58 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -3,15 +3,7 @@
[[projects]]
branch = "master"
- digest = "1:e1fa64238b0a2dbf1edf98c4af8d1b8cb65179e286d7f28006b50fa9f508ee9d"
- name = "code.gitea.io/git"
- packages = ["."]
- pruneopts = "NUT"
- revision = "74d7c14dd4a3ed9c5def0dc3c1aeede399ddc5c5"
-
-[[projects]]
- branch = "master"
- digest = "1:6fb0a860db126f973204b4b05ed08d338d485a74c19c15f0e5cf0f49352a8ef1"
+ digest = "1:dbf849e6552740945ac1c6c6acba590fbc594e4efa80cf05568dec8579ae0dab"
name = "code.gitea.io/sdk"
packages = ["gitea"]
pruneopts = "NUT"
@@ -887,9 +879,12 @@
revision = "0abe01ef9be25c4aedc174758ec2d917314d6d70"
[[projects]]
- digest = "1:a852b1ad03ca063d2c57866d9f94dcb1cb2e111415c5902ce0586fc2d207221b"
+ digest = "1:0d3d375df794ab11a192668f4eacdb116ccd99aa574fe357185a2d463e07f2fb"
name = "github.com/stretchr/testify"
- packages = ["assert"]
+ packages = [
+ "assert",
+ "require",
+ ]
pruneopts = "NUT"
revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71"
version = "v1.2.1"
@@ -1231,7 +1226,6 @@
analyzer-name = "dep"
analyzer-version = 1
input-imports = [
- "code.gitea.io/git",
"code.gitea.io/sdk/gitea",
"github.com/PuerkitoBio/goquery",
"github.com/Unknwon/cae/zip",
@@ -1313,6 +1307,7 @@
"github.com/satori/go.uuid",
"github.com/sergi/go-diff/diffmatchpatch",
"github.com/stretchr/testify/assert",
+ "github.com/stretchr/testify/require",
"github.com/tstranex/u2f",
"github.com/urfave/cli",
"github.com/yohcop/openid-go",
diff --git a/cmd/admin.go b/cmd/admin.go
index 0934a7364b..5c7d7613a9 100644
--- a/cmd/admin.go
+++ b/cmd/admin.go
@@ -11,10 +11,10 @@ import (
"os"
"text/tabwriter"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth/oauth2"
"code.gitea.io/gitea/modules/generate"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
diff --git a/cmd/hook.go b/cmd/hook.go
index d3a1a56b01..18d26f17ca 100644
--- a/cmd/hook.go
+++ b/cmd/hook.go
@@ -12,8 +12,8 @@ import (
"strconv"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/private"
"code.gitea.io/gitea/modules/setting"
diff --git a/cmd/serv.go b/cmd/serv.go
index ca0354d06c..cab72f911b 100644
--- a/cmd/serv.go
+++ b/cmd/serv.go
@@ -14,8 +14,8 @@ import (
"strings"
"time"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/pprof"
"code.gitea.io/gitea/modules/private"
diff --git a/integrations/api_releases_test.go b/integrations/api_releases_test.go
index 5c1b6c5d49..5cc4522f0c 100644
--- a/integrations/api_releases_test.go
+++ b/integrations/api_releases_test.go
@@ -9,8 +9,8 @@ import (
"net/http"
"testing"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
api "code.gitea.io/sdk/gitea"
"github.com/stretchr/testify/assert"
diff --git a/integrations/git_helper_for_declarative_test.go b/integrations/git_helper_for_declarative_test.go
index 60c7c29f68..010f47a7ac 100644
--- a/integrations/git_helper_for_declarative_test.go
+++ b/integrations/git_helper_for_declarative_test.go
@@ -16,7 +16,7 @@ import (
"testing"
"time"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/ssh"
"github.com/Unknwon/com"
diff --git a/integrations/git_test.go b/integrations/git_test.go
index a3ea615979..28ead9d385 100644
--- a/integrations/git_test.go
+++ b/integrations/git_test.go
@@ -16,8 +16,8 @@ import (
"testing"
"time"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
"github.com/stretchr/testify/assert"
)
diff --git a/integrations/ssh_key_test.go b/integrations/ssh_key_test.go
index 9ad43ae226..f6df5ff8f4 100644
--- a/integrations/ssh_key_test.go
+++ b/integrations/ssh_key_test.go
@@ -14,7 +14,7 @@ import (
"testing"
"time"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
api "code.gitea.io/sdk/gitea"
"github.com/stretchr/testify/assert"
)
diff --git a/models/action.go b/models/action.go
index 2cd3616d63..d4cc4086db 100644
--- a/models/action.go
+++ b/models/action.go
@@ -14,8 +14,8 @@ import (
"time"
"unicode"
- "code.gitea.io/git"
"code.gitea.io/gitea/modules/base"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
diff --git a/models/action_test.go b/models/action_test.go
index 96d6ddb6dd..e30b706809 100644
--- a/models/action_test.go
+++ b/models/action_test.go
@@ -6,7 +6,7 @@ import (
"strings"
"testing"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
"github.com/stretchr/testify/assert"
diff --git a/models/git_diff.go b/models/git_diff.go
index 2e76e56bea..ac2a5f90d7 100644
--- a/models/git_diff.go
+++ b/models/git_diff.go
@@ -19,8 +19,8 @@ import (
"strconv"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/modules/base"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/highlight"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
diff --git a/models/gpg_key.go b/models/gpg_key.go
index c9b57caaa6..03b0fd0f69 100644
--- a/models/gpg_key.go
+++ b/models/gpg_key.go
@@ -15,7 +15,7 @@ import (
"strings"
"time"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/util"
diff --git a/models/graph.go b/models/graph.go
index 90b9ff11f8..5f68abaf74 100644
--- a/models/graph.go
+++ b/models/graph.go
@@ -8,7 +8,7 @@ import (
"fmt"
"strings"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
)
diff --git a/models/graph_test.go b/models/graph_test.go
index 0f6e338792..5c78e3877b 100644
--- a/models/graph_test.go
+++ b/models/graph_test.go
@@ -8,7 +8,7 @@ import (
"fmt"
"testing"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
)
func BenchmarkGetCommitGraph(b *testing.B) {
diff --git a/models/issue_comment.go b/models/issue_comment.go
index c3654460ff..d4a3d26a78 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -11,7 +11,7 @@ import (
"fmt"
"strings"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/setting"
"github.com/Unknwon/com"
diff --git a/models/migrations/v28.go b/models/migrations/v28.go
index e9db42004d..a30cbf2afb 100644
--- a/models/migrations/v28.go
+++ b/models/migrations/v28.go
@@ -10,7 +10,7 @@ import (
"path/filepath"
"strings"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
diff --git a/models/migrations/v39.go b/models/migrations/v39.go
index 9fb7390c7d..1312cb3313 100644
--- a/models/migrations/v39.go
+++ b/models/migrations/v39.go
@@ -7,8 +7,8 @@ package migrations
import (
"fmt"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"github.com/go-xorm/xorm"
diff --git a/models/migrations/v82.go b/models/migrations/v82.go
index be9e71fd83..eb73f18343 100644
--- a/models/migrations/v82.go
+++ b/models/migrations/v82.go
@@ -7,8 +7,8 @@ package migrations
import (
"fmt"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
"github.com/go-xorm/xorm"
)
diff --git a/models/pull.go b/models/pull.go
index 35fbc41788..ef3ec8e145 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -16,9 +16,9 @@ import (
"strings"
"time"
- "code.gitea.io/git"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/cache"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/setting"
diff --git a/models/release.go b/models/release.go
index 0c78707d6b..f147016b13 100644
--- a/models/release.go
+++ b/models/release.go
@@ -9,13 +9,13 @@ import (
"sort"
"strings"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
-
api "code.gitea.io/sdk/gitea"
+
"github.com/go-xorm/builder"
)
diff --git a/models/release_test.go b/models/release_test.go
index de34109e8c..39c6613054 100644
--- a/models/release_test.go
+++ b/models/release_test.go
@@ -7,7 +7,7 @@ package models
import (
"testing"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"github.com/stretchr/testify/assert"
)
diff --git a/models/repo.go b/models/repo.go
index 9a85c77f0c..19526fb17c 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -21,7 +21,7 @@ import (
"strings"
"time"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/options"
diff --git a/models/repo_branch.go b/models/repo_branch.go
index c4013dfb82..9ea4ce45fb 100644
--- a/models/repo_branch.go
+++ b/models/repo_branch.go
@@ -8,7 +8,7 @@ import (
"fmt"
"time"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
"github.com/Unknwon/com"
diff --git a/models/repo_indexer.go b/models/repo_indexer.go
index b4f7bf1bd7..bfeeca26e9 100644
--- a/models/repo_indexer.go
+++ b/models/repo_indexer.go
@@ -9,8 +9,8 @@ import (
"strconv"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/modules/base"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/indexer"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
diff --git a/models/repo_mirror.go b/models/repo_mirror.go
index 9f8c9bee65..c3fc9a43db 100644
--- a/models/repo_mirror.go
+++ b/models/repo_mirror.go
@@ -10,8 +10,8 @@ import (
"strings"
"time"
- "code.gitea.io/git"
"code.gitea.io/gitea/modules/cache"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/setting"
diff --git a/models/repo_tag.go b/models/repo_tag.go
index 752eaf0282..fa3f19bb29 100644
--- a/models/repo_tag.go
+++ b/models/repo_tag.go
@@ -5,7 +5,7 @@
package models
import (
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
)
// GetTagsByPath returns repo tags by it's path
diff --git a/models/status.go b/models/status.go
index 91d011f7c5..93d82b76fc 100644
--- a/models/status.go
+++ b/models/status.go
@@ -9,7 +9,7 @@ import (
"fmt"
"strings"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
diff --git a/models/update.go b/models/update.go
index 9cd4d0d977..cde6b217c1 100644
--- a/models/update.go
+++ b/models/update.go
@@ -11,8 +11,8 @@ import (
"strings"
"time"
- "code.gitea.io/git"
"code.gitea.io/gitea/modules/cache"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/util"
)
diff --git a/models/update_test.go b/models/update_test.go
index 45451ee437..f2219a4e68 100644
--- a/models/update_test.go
+++ b/models/update_test.go
@@ -9,7 +9,7 @@ import (
"testing"
"time"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"github.com/stretchr/testify/assert"
)
diff --git a/models/user.go b/models/user.go
index 8fc15848c8..b831a2ebfe 100644
--- a/models/user.go
+++ b/models/user.go
@@ -25,10 +25,10 @@ import (
"time"
"unicode/utf8"
- "code.gitea.io/git"
"code.gitea.io/gitea/modules/avatar"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/generate"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
diff --git a/models/webhook_dingtalk.go b/models/webhook_dingtalk.go
index 1021ab35f1..7086732707 100644
--- a/models/webhook_dingtalk.go
+++ b/models/webhook_dingtalk.go
@@ -9,8 +9,9 @@ import (
"fmt"
"strings"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
api "code.gitea.io/sdk/gitea"
+
dingtalk "github.com/lunny/dingtalk_webhook"
)
diff --git a/models/webhook_discord.go b/models/webhook_discord.go
index 893e780965..8f1cb16940 100644
--- a/models/webhook_discord.go
+++ b/models/webhook_discord.go
@@ -11,7 +11,7 @@ import (
"strconv"
"strings"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/sdk/gitea"
)
diff --git a/models/webhook_slack.go b/models/webhook_slack.go
index 90d5ccce0b..2bb84c2c4b 100644
--- a/models/webhook_slack.go
+++ b/models/webhook_slack.go
@@ -10,7 +10,7 @@ import (
"fmt"
"strings"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/sdk/gitea"
)
diff --git a/models/wiki.go b/models/wiki.go
index 65cf26a44c..0f5cdc20bd 100644
--- a/models/wiki.go
+++ b/models/wiki.go
@@ -13,12 +13,11 @@ import (
"path/filepath"
"strings"
- "github.com/Unknwon/com"
-
- "code.gitea.io/git"
-
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/sync"
+
+ "github.com/Unknwon/com"
)
var (
diff --git a/modules/base/tool.go b/modules/base/tool.go
index b069e5faee..359cf87d77 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -23,10 +23,11 @@ import (
"unicode"
"unicode/utf8"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
+
"github.com/Unknwon/com"
"github.com/Unknwon/i18n"
"github.com/gogits/chardet"
diff --git a/modules/context/api.go b/modules/context/api.go
index 7ec4d9036c..04a472b382 100644
--- a/modules/context/api.go
+++ b/modules/context/api.go
@@ -13,11 +13,12 @@ import (
"github.com/go-macaron/csrf"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/base"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
+
"github.com/Unknwon/paginater"
macaron "gopkg.in/macaron.v1"
)
diff --git a/modules/context/repo.go b/modules/context/repo.go
index e0ee802f7d..20a3d19428 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -12,9 +12,9 @@ import (
"path"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/cache"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
diff --git a/modules/git/README.md b/modules/git/README.md
new file mode 100644
index 0000000000..4418c1b891
--- /dev/null
+++ b/modules/git/README.md
@@ -0,0 +1,3 @@
+# Git Module
+
+This module is merged from https://github.com/go-gitea/git which is a Go module to access Git through shell commands. Now it's a part of gitea's main repository for easier pull request.
diff --git a/vendor/code.gitea.io/git/blob.go b/modules/git/blob.go
index a6e392eeb5..a6e392eeb5 100644
--- a/vendor/code.gitea.io/git/blob.go
+++ b/modules/git/blob.go
diff --git a/modules/git/blob_test.go b/modules/git/blob_test.go
new file mode 100644
index 0000000000..39516c422c
--- /dev/null
+++ b/modules/git/blob_test.go
@@ -0,0 +1,80 @@
+// Copyright 2015 The Gogs Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "bytes"
+ "io/ioutil"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+)
+
+var repoSelf = &Repository{
+ Path: "./",
+}
+
+var testBlob = &Blob{
+ repo: repoSelf,
+ TreeEntry: &TreeEntry{
+ ID: MustIDFromString("a8d4b49dd073a4a38a7e58385eeff7cc52568697"),
+ ptree: &Tree{
+ repo: repoSelf,
+ },
+ },
+}
+
+func TestBlob_Data(t *testing.T) {
+ output := `Copyright (c) 2016 The Gitea Authors
+Copyright (c) 2015 The Gogs Authors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+`
+
+ r, err := testBlob.Data()
+ assert.NoError(t, err)
+ require.NotNil(t, r)
+
+ data, err := ioutil.ReadAll(r)
+ assert.NoError(t, err)
+ assert.Equal(t, output, string(data))
+}
+
+func Benchmark_Blob_Data(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ r, err := testBlob.Data()
+ if err != nil {
+ b.Fatal(err)
+ }
+ ioutil.ReadAll(r)
+ }
+}
+
+func Benchmark_Blob_DataPipeline(b *testing.B) {
+ stdout := new(bytes.Buffer)
+ for i := 0; i < b.N; i++ {
+ stdout.Reset()
+ if err := testBlob.DataPipeline(stdout, nil); err != nil {
+ b.Fatal(err)
+ }
+ }
+}
diff --git a/vendor/code.gitea.io/git/cache.go b/modules/git/cache.go
index dbbbafae4c..dbbbafae4c 100644
--- a/vendor/code.gitea.io/git/cache.go
+++ b/modules/git/cache.go
diff --git a/vendor/code.gitea.io/git/command.go b/modules/git/command.go
index fc48d2871b..d354635119 100644
--- a/vendor/code.gitea.io/git/command.go
+++ b/modules/git/command.go
@@ -120,7 +120,7 @@ func (c *Command) RunInDir(dir string) (string, error) {
return string(stdout), nil
}
-// RunTimeout executes the command in defualt working directory with given timeout,
+// RunTimeout executes the command in default working directory with given timeout,
// and returns stdout in string and error (combined with stderr).
func (c *Command) RunTimeout(timeout time.Duration) (string, error) {
stdout, err := c.RunInDirTimeout(timeout, "")
@@ -130,7 +130,7 @@ func (c *Command) RunTimeout(timeout time.Duration) (string, error) {
return string(stdout), nil
}
-// Run executes the command in defualt working directory
+// Run executes the command in default working directory
// and returns stdout in string and error (combined with stderr).
func (c *Command) Run() (string, error) {
return c.RunTimeout(-1)
diff --git a/modules/git/command_test.go b/modules/git/command_test.go
new file mode 100644
index 0000000000..2f35b3c329
--- /dev/null
+++ b/modules/git/command_test.go
@@ -0,0 +1,41 @@
+// Copyright 2017 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+// +build race
+
+package git
+
+import (
+ "context"
+ "testing"
+ "time"
+)
+
+func TestRunInDirTimeoutPipelineNoTimeout(t *testing.T) {
+
+ maxLoops := 1000
+
+ // 'git --version' does not block so it must be finished before the timeout triggered.
+ cmd := NewCommand("--version")
+ for i := 0; i < maxLoops; i++ {
+ if err := cmd.RunInDirTimeoutPipeline(-1, "", nil, nil); err != nil {
+ t.Fatal(err)
+ }
+ }
+}
+
+func TestRunInDirTimeoutPipelineAlwaysTimeout(t *testing.T) {
+
+ maxLoops := 1000
+
+ // 'git hash-object --stdin' blocks on stdin so we can have the timeout triggered.
+ cmd := NewCommand("hash-object --stdin")
+ for i := 0; i < maxLoops; i++ {
+ if err := cmd.RunInDirTimeoutPipeline(1*time.Microsecond, "", nil, nil); err != nil {
+ if err != context.DeadlineExceeded {
+ t.Fatalf("Testing %d/%d: %v", i, maxLoops, err)
+ }
+ }
+ }
+}
diff --git a/vendor/code.gitea.io/git/commit.go b/modules/git/commit.go
index 36b8d54565..36b8d54565 100644
--- a/vendor/code.gitea.io/git/commit.go
+++ b/modules/git/commit.go
diff --git a/vendor/code.gitea.io/git/commit_archive.go b/modules/git/commit_archive.go
index e13825a962..e13825a962 100644
--- a/vendor/code.gitea.io/git/commit_archive.go
+++ b/modules/git/commit_archive.go
diff --git a/vendor/code.gitea.io/git/commit_info.go b/modules/git/commit_info.go
index 971082be1f..971082be1f 100644
--- a/vendor/code.gitea.io/git/commit_info.go
+++ b/modules/git/commit_info.go
diff --git a/modules/git/commit_info_test.go b/modules/git/commit_info_test.go
new file mode 100644
index 0000000000..120a9a737c
--- /dev/null
+++ b/modules/git/commit_info_test.go
@@ -0,0 +1,117 @@
+package git
+
+import (
+ "os"
+ "path/filepath"
+ "testing"
+ "time"
+
+ "github.com/stretchr/testify/assert"
+)
+
+const testReposDir = "tests/repos/"
+const benchmarkReposDir = "benchmark/repos/"
+
+func cloneRepo(url, dir, name string) (string, error) {
+ repoDir := filepath.Join(dir, name)
+ if _, err := os.Stat(repoDir); err == nil {
+ return repoDir, nil
+ }
+ return repoDir, Clone(url, repoDir, CloneRepoOptions{
+ Mirror: false,
+ Bare: false,
+ Quiet: true,
+ Timeout: 5 * time.Minute,
+ })
+}
+
+func testGetCommitsInfo(t *testing.T, repo1 *Repository) {
+ // these test case are specific to the repo1 test repo
+ testCases := []struct {
+ CommitID string
+ Path string
+ ExpectedIDs map[string]string
+ }{
+ {"8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2", "", map[string]string{
+ "file1.txt": "95bb4d39648ee7e325106df01a621c530863a653",
+ "file2.txt": "8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2",
+ }},
+ {"2839944139e0de9737a044f78b0e4b40d989a9e3", "", map[string]string{
+ "file1.txt": "2839944139e0de9737a044f78b0e4b40d989a9e3",
+ "branch1.txt": "9c9aef8dd84e02bc7ec12641deb4c930a7c30185",
+ }},
+ {"5c80b0245c1c6f8343fa418ec374b13b5d4ee658", "branch2", map[string]string{
+ "branch2.txt": "5c80b0245c1c6f8343fa418ec374b13b5d4ee658",
+ }},
+ }
+ for _, testCase := range testCases {
+ commit, err := repo1.GetCommit(testCase.CommitID)
+ assert.NoError(t, err)
+ tree, err := commit.Tree.SubTree(testCase.Path)
+ assert.NoError(t, err)
+ entries, err := tree.ListEntries()
+ assert.NoError(t, err)
+ commitsInfo, err := entries.GetCommitsInfo(commit, testCase.Path, nil)
+ assert.NoError(t, err)
+ assert.Len(t, commitsInfo, len(testCase.ExpectedIDs))
+ for _, commitInfo := range commitsInfo {
+ entry := commitInfo[0].(*TreeEntry)
+ commit := commitInfo[1].(*Commit)
+ expectedID, ok := testCase.ExpectedIDs[entry.Name()]
+ if !assert.True(t, ok) {
+ continue
+ }
+ assert.Equal(t, expectedID, commit.ID.String())
+ }
+ }
+}
+
+func TestEntries_GetCommitsInfo(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+ bareRepo1, err := OpenRepository(bareRepo1Path)
+ assert.NoError(t, err)
+ testGetCommitsInfo(t, bareRepo1)
+
+ clonedPath, err := cloneRepo(bareRepo1Path, testReposDir, "repo1_TestEntries_GetCommitsInfo")
+ assert.NoError(t, err)
+ defer os.RemoveAll(clonedPath)
+ clonedRepo1, err := OpenRepository(clonedPath)
+ assert.NoError(t, err)
+ testGetCommitsInfo(t, clonedRepo1)
+}
+
+func BenchmarkEntries_GetCommitsInfo(b *testing.B) {
+ benchmarks := []struct {
+ url string
+ name string
+ }{
+ {url: "https://github.com/go-gitea/gitea.git", name: "gitea"},
+ {url: "https://github.com/ethantkoenig/manyfiles.git", name: "manyfiles"},
+ {url: "https://github.com/moby/moby.git", name: "moby"},
+ {url: "https://github.com/golang/go.git", name: "go"},
+ {url: "https://github.com/torvalds/linux.git", name: "linux"},
+ }
+ for _, benchmark := range benchmarks {
+ var commit *Commit
+ var entries Entries
+ if repoPath, err := cloneRepo(benchmark.url, benchmarkReposDir, benchmark.name); err != nil {
+ b.Fatal(err)
+ } else if repo, err := OpenRepository(repoPath); err != nil {
+ b.Fatal(err)
+ } else if commit, err = repo.GetBranchCommit("master"); err != nil {
+ b.Fatal(err)
+ } else if entries, err = commit.Tree.ListEntries(); err != nil {
+ b.Fatal(err)
+ }
+ entries.Sort()
+ b.ResetTimer()
+ b.Run(benchmark.name, func(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ _, err := entries.GetCommitsInfo(commit, "", nil)
+ if err != nil {
+ b.Fatal(err)
+ }
+ }
+ })
+ }
+}
diff --git a/modules/git/commit_test.go b/modules/git/commit_test.go
new file mode 100644
index 0000000000..bbe12b5aec
--- /dev/null
+++ b/modules/git/commit_test.go
@@ -0,0 +1,38 @@
+// Copyright 2017 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "path/filepath"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestCommitsCount(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+
+ commitsCount, err := CommitsCount(bareRepo1Path, "8006ff9adbf0cb94da7dad9e537e53817f9fa5c0")
+ assert.NoError(t, err)
+ assert.Equal(t, int64(3), commitsCount)
+}
+
+func TestGetFullCommitID(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+
+ id, err := GetFullCommitID(bareRepo1Path, "8006ff9a")
+ assert.NoError(t, err)
+ assert.Equal(t, "8006ff9adbf0cb94da7dad9e537e53817f9fa5c0", id)
+}
+
+func TestGetFullCommitIDError(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+
+ id, err := GetFullCommitID(bareRepo1Path, "unknown")
+ assert.Empty(t, id)
+ if assert.Error(t, err) {
+ assert.EqualError(t, err, "object does not exist [id: unknown, rel_path: ]")
+ }
+}
diff --git a/vendor/code.gitea.io/git/error.go b/modules/git/error.go
index 1aae5a37a2..1aae5a37a2 100644
--- a/vendor/code.gitea.io/git/error.go
+++ b/modules/git/error.go
diff --git a/vendor/code.gitea.io/git/git.go b/modules/git/git.go
index 150b80fb07..150b80fb07 100644
--- a/vendor/code.gitea.io/git/git.go
+++ b/modules/git/git.go
diff --git a/vendor/code.gitea.io/git/hook.go b/modules/git/hook.go
index afed623e6e..18c00b5838 100644
--- a/vendor/code.gitea.io/git/hook.go
+++ b/modules/git/hook.go
@@ -82,11 +82,20 @@ func (h *Hook) Name() string {
func (h *Hook) Update() error {
if len(strings.TrimSpace(h.Content)) == 0 {
if isExist(h.path) {
- return os.Remove(h.path)
+ err := os.Remove(h.path)
+ if err != nil {
+ return err
+ }
}
+ h.IsActive = false
return nil
}
- return ioutil.WriteFile(h.path, []byte(strings.Replace(h.Content, "\r", "", -1)), os.ModePerm)
+ err := ioutil.WriteFile(h.path, []byte(strings.Replace(h.Content, "\r", "", -1)), os.ModePerm)
+ if err != nil {
+ return err
+ }
+ h.IsActive = true
+ return nil
}
// ListHooks returns a list of Git hooks of given repository.
diff --git a/vendor/code.gitea.io/git/parse.go b/modules/git/parse.go
index 5c964f16ee..5c964f16ee 100644
--- a/vendor/code.gitea.io/git/parse.go
+++ b/modules/git/parse.go
diff --git a/modules/git/parse_test.go b/modules/git/parse_test.go
new file mode 100644
index 0000000000..66936cbdf0
--- /dev/null
+++ b/modules/git/parse_test.go
@@ -0,0 +1,58 @@
+// Copyright 2018 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestParseTreeEntries(t *testing.T) {
+ testCases := []struct {
+ Input string
+ Expected []*TreeEntry
+ }{
+ {
+ Input: "",
+ Expected: []*TreeEntry{},
+ },
+ {
+ Input: "100644 blob 61ab7345a1a3bbc590068ccae37b8515cfc5843c\texample/file2.txt\n",
+ Expected: []*TreeEntry{
+ {
+ mode: EntryModeBlob,
+ Type: ObjectBlob,
+ ID: MustIDFromString("61ab7345a1a3bbc590068ccae37b8515cfc5843c"),
+ name: "example/file2.txt",
+ },
+ },
+ },
+ {
+ Input: "120000 blob 61ab7345a1a3bbc590068ccae37b8515cfc5843c\t\"example/\\n.txt\"\n" +
+ "040000 tree 1d01fb729fb0db5881daaa6030f9f2d3cd3d5ae8\texample\n",
+ Expected: []*TreeEntry{
+ {
+ ID: MustIDFromString("61ab7345a1a3bbc590068ccae37b8515cfc5843c"),
+ Type: ObjectBlob,
+ mode: EntryModeSymlink,
+ name: "example/\n.txt",
+ },
+ {
+ ID: MustIDFromString("1d01fb729fb0db5881daaa6030f9f2d3cd3d5ae8"),
+ Type: ObjectTree,
+ mode: EntryModeTree,
+ name: "example",
+ },
+ },
+ },
+ }
+
+ for _, testCase := range testCases {
+ entries, err := ParseTreeEntries([]byte(testCase.Input))
+ assert.NoError(t, err)
+ assert.EqualValues(t, testCase.Expected, entries)
+ }
+}
diff --git a/vendor/code.gitea.io/git/ref.go b/modules/git/ref.go
index 67b56ac999..67b56ac999 100644
--- a/vendor/code.gitea.io/git/ref.go
+++ b/modules/git/ref.go
diff --git a/vendor/code.gitea.io/git/repo.go b/modules/git/repo.go
index 4306730920..4306730920 100644
--- a/vendor/code.gitea.io/git/repo.go
+++ b/modules/git/repo.go
diff --git a/vendor/code.gitea.io/git/repo_blame.go b/modules/git/repo_blame.go
index 80ec50e472..80ec50e472 100644
--- a/vendor/code.gitea.io/git/repo_blame.go
+++ b/modules/git/repo_blame.go
diff --git a/vendor/code.gitea.io/git/repo_blob.go b/modules/git/repo_blob.go
index a9445a1f7a..a9445a1f7a 100644
--- a/vendor/code.gitea.io/git/repo_blob.go
+++ b/modules/git/repo_blob.go
diff --git a/modules/git/repo_blob_test.go b/modules/git/repo_blob_test.go
new file mode 100644
index 0000000000..074365f164
--- /dev/null
+++ b/modules/git/repo_blob_test.go
@@ -0,0 +1,66 @@
+// Copyright 2018 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "fmt"
+ "io/ioutil"
+ "path/filepath"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestRepository_GetBlob_Found(t *testing.T) {
+ repoPath := filepath.Join(testReposDir, "repo1_bare")
+ r, err := OpenRepository(repoPath)
+ assert.NoError(t, err)
+
+ testCases := []struct {
+ OID string
+ Data []byte
+ }{
+ {"e2129701f1a4d54dc44f03c93bca0a2aec7c5449", []byte("file1\n")},
+ {"6c493ff740f9380390d5c9ddef4af18697ac9375", []byte("file2\n")},
+ }
+
+ for _, testCase := range testCases {
+ blob, err := r.GetBlob(testCase.OID)
+ assert.NoError(t, err)
+
+ dataReader, err := blob.Data()
+ assert.NoError(t, err)
+
+ data, err := ioutil.ReadAll(dataReader)
+ assert.NoError(t, err)
+ assert.Equal(t, testCase.Data, data)
+ }
+}
+
+func TestRepository_GetBlob_NotExist(t *testing.T) {
+ repoPath := filepath.Join(testReposDir, "repo1_bare")
+ r, err := OpenRepository(repoPath)
+ assert.NoError(t, err)
+
+ testCase := "0000000000000000000000000000000000000000"
+ testError := ErrNotExist{testCase, ""}
+
+ blob, err := r.GetBlob(testCase)
+ assert.Nil(t, blob)
+ assert.EqualError(t, err, testError.Error())
+}
+
+func TestRepository_GetBlob_NoId(t *testing.T) {
+ repoPath := filepath.Join(testReposDir, "repo1_bare")
+ r, err := OpenRepository(repoPath)
+ assert.NoError(t, err)
+
+ testCase := ""
+ testError := fmt.Errorf("Length must be 40: %s", testCase)
+
+ blob, err := r.GetBlob(testCase)
+ assert.Nil(t, blob)
+ assert.EqualError(t, err, testError.Error())
+}
diff --git a/vendor/code.gitea.io/git/repo_branch.go b/modules/git/repo_branch.go
index 6414abbec5..6414abbec5 100644
--- a/vendor/code.gitea.io/git/repo_branch.go
+++ b/modules/git/repo_branch.go
diff --git a/modules/git/repo_branch_test.go b/modules/git/repo_branch_test.go
new file mode 100644
index 0000000000..08736d702e
--- /dev/null
+++ b/modules/git/repo_branch_test.go
@@ -0,0 +1,39 @@
+// Copyright 2018 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "path/filepath"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestRepository_GetBranches(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+ bareRepo1, err := OpenRepository(bareRepo1Path)
+ assert.NoError(t, err)
+
+ branches, err := bareRepo1.GetBranches()
+
+ assert.NoError(t, err)
+ assert.Len(t, branches, 3)
+ assert.ElementsMatch(t, []string{"branch1", "branch2", "master"}, branches)
+}
+
+func BenchmarkRepository_GetBranches(b *testing.B) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+ bareRepo1, err := OpenRepository(bareRepo1Path)
+ if err != nil {
+ b.Fatal(err)
+ }
+
+ for i := 0; i < b.N; i++ {
+ _, err := bareRepo1.GetBranches()
+ if err != nil {
+ b.Fatal(err)
+ }
+ }
+}
diff --git a/vendor/code.gitea.io/git/repo_commit.go b/modules/git/repo_commit.go
index 2d9f5bdbf8..146619373d 100644
--- a/vendor/code.gitea.io/git/repo_commit.go
+++ b/modules/git/repo_commit.go
@@ -146,7 +146,7 @@ func (repo *Repository) getCommit(id SHA1) (*Commit, error) {
return nil, err
}
- // name-rev commitID ouput will be "COMMIT_ID master" or "COMMIT_ID master~12"
+ // name-rev commitID output will be "COMMIT_ID master" or "COMMIT_ID master~12"
commit.Branch = strings.Split(strings.Split(string(data), " ")[1], "~")[0]
repo.commitCache.Set(id.String(), commit)
@@ -262,7 +262,7 @@ func (repo *Repository) FileCommitsCount(revision, file string) (int64, error) {
return commitsCount(repo.Path, revision, file)
}
-// CommitsByFileAndRange return the commits accroding revison file and the page
+// CommitsByFileAndRange return the commits according revison file and the page
func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (*list.List, error) {
stdout, err := NewCommand("log", revision, "--follow", "--skip="+strconv.Itoa((page-1)*50),
"--max-count="+strconv.Itoa(CommitsRangeSize), prettyLogFormat, "--", file).RunInDirBytes(repo.Path)
diff --git a/modules/git/repo_commit_test.go b/modules/git/repo_commit_test.go
new file mode 100644
index 0000000000..6761a45b7a
--- /dev/null
+++ b/modules/git/repo_commit_test.go
@@ -0,0 +1,59 @@
+// Copyright 2018 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "path/filepath"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestRepository_GetCommitBranches(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+ bareRepo1, err := OpenRepository(bareRepo1Path)
+ assert.NoError(t, err)
+
+ // these test case are specific to the repo1_bare test repo
+ testCases := []struct {
+ CommitID string
+ ExpectedBranches []string
+ }{
+ {"2839944139e0de9737a044f78b0e4b40d989a9e3", []string{"branch1"}},
+ {"5c80b0245c1c6f8343fa418ec374b13b5d4ee658", []string{"branch2"}},
+ {"37991dec2c8e592043f47155ce4808d4580f9123", []string{"master"}},
+ {"95bb4d39648ee7e325106df01a621c530863a653", []string{"branch1", "branch2"}},
+ {"8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2", []string{"branch2", "master"}},
+ {"master", []string{"master"}},
+ }
+ for _, testCase := range testCases {
+ commit, err := bareRepo1.GetCommit(testCase.CommitID)
+ assert.NoError(t, err)
+ branches, err := bareRepo1.getBranches(commit, 2)
+ assert.NoError(t, err)
+ assert.Equal(t, testCase.ExpectedBranches, branches)
+ }
+}
+
+func TestGetTagCommitWithSignature(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+ bareRepo1, err := OpenRepository(bareRepo1Path)
+ commit, err := bareRepo1.GetCommit("3ad28a9149a2864384548f3d17ed7f38014c9e8a")
+
+ assert.NoError(t, err)
+ assert.NotNil(t, commit)
+ assert.NotNil(t, commit.Signature)
+ // test that signature is not in message
+ assert.Equal(t, "tag", commit.CommitMessage)
+}
+
+func TestGetCommitWithBadCommitID(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+ bareRepo1, err := OpenRepository(bareRepo1Path)
+ commit, err := bareRepo1.GetCommit("bad_branch")
+ assert.Nil(t, commit)
+ assert.Error(t, err)
+ assert.EqualError(t, err, "object does not exist [id: bad_branch, rel_path: ]")
+}
diff --git a/vendor/code.gitea.io/git/repo_hook.go b/modules/git/repo_hook.go
index 49f4d09fb6..a652e938fa 100644
--- a/vendor/code.gitea.io/git/repo_hook.go
+++ b/modules/git/repo_hook.go
@@ -4,7 +4,7 @@
package git
-// GetHook get one hook accroding the name on a repository
+// GetHook get one hook according the name on a repository
func (repo *Repository) GetHook(name string) (*Hook, error) {
return GetHook(repo.Path, name)
}
diff --git a/vendor/code.gitea.io/git/repo_object.go b/modules/git/repo_object.go
index 3be8400d22..3be8400d22 100644
--- a/vendor/code.gitea.io/git/repo_object.go
+++ b/modules/git/repo_object.go
diff --git a/vendor/code.gitea.io/git/repo_pull.go b/modules/git/repo_pull.go
index c6d97a6fd1..c6d97a6fd1 100644
--- a/vendor/code.gitea.io/git/repo_pull.go
+++ b/modules/git/repo_pull.go
diff --git a/modules/git/repo_pull_test.go b/modules/git/repo_pull_test.go
new file mode 100644
index 0000000000..e194788773
--- /dev/null
+++ b/modules/git/repo_pull_test.go
@@ -0,0 +1,30 @@
+// Copyright 2018 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestGetFormatPatch(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+ clonedPath, err := cloneRepo(bareRepo1Path, testReposDir, "repo1_TestGetFormatPatch")
+ assert.NoError(t, err)
+ defer os.RemoveAll(clonedPath)
+ repo, err := OpenRepository(clonedPath)
+ assert.NoError(t, err)
+ rd, err := repo.GetFormatPatch("8d92fc95^", "8d92fc95")
+ assert.NoError(t, err)
+ patchb, err := ioutil.ReadAll(rd)
+ assert.NoError(t, err)
+ patch := string(patchb)
+ assert.Regexp(t, "^From 8d92fc95", patch)
+ assert.Contains(t, patch, "Subject: [PATCH] Add file2.txt")
+}
diff --git a/vendor/code.gitea.io/git/repo_ref.go b/modules/git/repo_ref.go
index e1ab46e090..e1ab46e090 100644
--- a/vendor/code.gitea.io/git/repo_ref.go
+++ b/modules/git/repo_ref.go
diff --git a/modules/git/repo_ref_test.go b/modules/git/repo_ref_test.go
new file mode 100644
index 0000000000..2a3ea26a76
--- /dev/null
+++ b/modules/git/repo_ref_test.go
@@ -0,0 +1,49 @@
+// Copyright 2018 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "path/filepath"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestRepository_GetRefs(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+ bareRepo1, err := OpenRepository(bareRepo1Path)
+ assert.NoError(t, err)
+
+ refs, err := bareRepo1.GetRefs()
+
+ assert.NoError(t, err)
+ assert.Len(t, refs, 4)
+
+ expectedRefs := []string{
+ BranchPrefix + "branch1",
+ BranchPrefix + "branch2",
+ BranchPrefix + "master",
+ TagPrefix + "test",
+ }
+
+ for _, ref := range refs {
+ assert.Contains(t, expectedRefs, ref.Name)
+ }
+}
+
+func TestRepository_GetRefsFiltered(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+ bareRepo1, err := OpenRepository(bareRepo1Path)
+ assert.NoError(t, err)
+
+ refs, err := bareRepo1.GetRefsFiltered(TagPrefix)
+
+ assert.NoError(t, err)
+ if assert.Len(t, refs, 1) {
+ assert.Equal(t, TagPrefix+"test", refs[0].Name)
+ assert.Equal(t, "tag", refs[0].Type)
+ assert.Equal(t, "3ad28a9149a2864384548f3d17ed7f38014c9e8a", refs[0].Object.String())
+ }
+}
diff --git a/vendor/code.gitea.io/git/repo_tag.go b/modules/git/repo_tag.go
index 84825d7dc3..84825d7dc3 100644
--- a/vendor/code.gitea.io/git/repo_tag.go
+++ b/modules/git/repo_tag.go
diff --git a/modules/git/repo_tag_test.go b/modules/git/repo_tag_test.go
new file mode 100644
index 0000000000..ccb2d57ac2
--- /dev/null
+++ b/modules/git/repo_tag_test.go
@@ -0,0 +1,44 @@
+// Copyright 2019 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestRepository_GetTags(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+ bareRepo1, err := OpenRepository(bareRepo1Path)
+ assert.NoError(t, err)
+
+ tags, err := bareRepo1.GetTagInfos()
+ assert.NoError(t, err)
+ assert.Len(t, tags, 1)
+ assert.EqualValues(t, "test", tags[0].Name)
+ assert.EqualValues(t, "37991dec2c8e592043f47155ce4808d4580f9123", tags[0].ID.String())
+ assert.EqualValues(t, "commit", tags[0].Type)
+}
+
+func TestRepository_GetTag(t *testing.T) {
+ bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
+
+ clonedPath, err := cloneRepo(bareRepo1Path, testReposDir, "repo1_TestRepository_GetTag")
+ assert.NoError(t, err)
+ defer os.RemoveAll(clonedPath)
+
+ bareRepo1, err := OpenRepository(clonedPath)
+ assert.NoError(t, err)
+
+ tag, err := bareRepo1.GetTag("test")
+ assert.NoError(t, err)
+ assert.NotNil(t, tag)
+ assert.EqualValues(t, "test", tag.Name)
+ assert.EqualValues(t, "37991dec2c8e592043f47155ce4808d4580f9123", tag.ID.String())
+ assert.EqualValues(t, "commit", tag.Type)
+}
diff --git a/modules/git/repo_test.go b/modules/git/repo_test.go
new file mode 100644
index 0000000000..c5ce6f4447
--- /dev/null
+++ b/modules/git/repo_test.go
@@ -0,0 +1,26 @@
+// Copyright 2017 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "testing"
+ "time"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestGetLatestCommitTime(t *testing.T) {
+ lct, err := GetLatestCommitTime(".")
+ assert.NoError(t, err)
+ // Time is in the past
+ now := time.Now()
+ assert.True(t, lct.Unix() < now.Unix(), "%d not smaller than %d", lct, now)
+ // Time is after Mon Oct 23 03:52:09 2017 +0300
+ // which is the time of commit
+ // d47b98c44c9a6472e44ab80efe65235e11c6da2a
+ refTime, err := time.Parse("Mon Jan 02 15:04:05 2006 -0700", "Mon Oct 23 03:52:09 2017 +0300")
+ assert.NoError(t, err)
+ assert.True(t, lct.Unix() > refTime.Unix(), "%d not greater than %d", lct, refTime)
+}
diff --git a/vendor/code.gitea.io/git/repo_tree.go b/modules/git/repo_tree.go
index 146b919d7a..3fa491d529 100644
--- a/vendor/code.gitea.io/git/repo_tree.go
+++ b/modules/git/repo_tree.go
@@ -21,7 +21,7 @@ func (repo *Repository) GetTree(idStr string) (*Tree, error) {
if len(idStr) != 40 {
res, err := NewCommand("rev-parse", idStr).RunInDir(repo.Path)
if err != nil {
- return nil, err;
+ return nil, err
}
if len(res) > 0 {
idStr = res[:len(res)-1]
diff --git a/vendor/code.gitea.io/git/sha1.go b/modules/git/sha1.go
index 6c9d53949d..6c9d53949d 100644
--- a/vendor/code.gitea.io/git/sha1.go
+++ b/modules/git/sha1.go
diff --git a/vendor/code.gitea.io/git/signature.go b/modules/git/signature.go
index e6ab247fd7..e6ab247fd7 100644
--- a/vendor/code.gitea.io/git/signature.go
+++ b/modules/git/signature.go
diff --git a/vendor/code.gitea.io/git/submodule.go b/modules/git/submodule.go
index 294df3986a..294df3986a 100644
--- a/vendor/code.gitea.io/git/submodule.go
+++ b/modules/git/submodule.go
diff --git a/modules/git/submodule_test.go b/modules/git/submodule_test.go
new file mode 100644
index 0000000000..6a3bb7ec7b
--- /dev/null
+++ b/modules/git/submodule_test.go
@@ -0,0 +1,29 @@
+// Copyright 2018 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestGetRefURL(t *testing.T) {
+ var kases = []struct {
+ refURL string
+ prefixURL string
+ parentPath string
+ expect string
+ }{
+ {"git://github.com/user1/repo1", "/", "/", "http://github.com/user1/repo1"},
+ {"https://localhost/user1/repo1.git", "/", "/", "https://localhost/user1/repo1"},
+ {"git@github.com/user1/repo1.git", "/", "/", "git@github.com/user1/repo1"},
+ {"ssh://git@git.zefie.net:2222/zefie/lge_g6_kernel_scripts.git", "/", "/", "http://git.zefie.net/zefie/lge_g6_kernel_scripts"},
+ }
+
+ for _, kase := range kases {
+ assert.EqualValues(t, kase.expect, getRefURL(kase.refURL, kase.prefixURL, kase.parentPath))
+ }
+}
diff --git a/vendor/code.gitea.io/git/tag.go b/modules/git/tag.go
index 500fd27491..500fd27491 100644
--- a/vendor/code.gitea.io/git/tag.go
+++ b/modules/git/tag.go
diff --git a/modules/git/tests/repos/repo1_bare/HEAD b/modules/git/tests/repos/repo1_bare/HEAD
new file mode 100644
index 0000000000..cb089cd89a
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/modules/git/tests/repos/repo1_bare/config b/modules/git/tests/repos/repo1_bare/config
new file mode 100644
index 0000000000..07d359d07c
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/config
@@ -0,0 +1,4 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = true
diff --git a/modules/git/tests/repos/repo1_bare/description b/modules/git/tests/repos/repo1_bare/description
new file mode 100644
index 0000000000..498b267a8c
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/description
@@ -0,0 +1 @@
+Unnamed repository; edit this file 'description' to name the repository.
diff --git a/modules/git/tests/repos/repo1_bare/hooks/applypatch-msg.sample b/modules/git/tests/repos/repo1_bare/hooks/applypatch-msg.sample
new file mode 100755
index 0000000000..a5d7b84a67
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/hooks/applypatch-msg.sample
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message taken by
+# applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit. The hook is
+# allowed to edit the commit message file.
+#
+# To enable this hook, rename this file to "applypatch-msg".
+
+. git-sh-setup
+commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
+test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
+:
diff --git a/modules/git/tests/repos/repo1_bare/hooks/commit-msg.sample b/modules/git/tests/repos/repo1_bare/hooks/commit-msg.sample
new file mode 100755
index 0000000000..b58d1184a9
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/hooks/commit-msg.sample
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message.
+# Called by "git commit" with one argument, the name of the file
+# that has the commit message. The hook should exit with non-zero
+# status after issuing an appropriate message if it wants to stop the
+# commit. The hook is allowed to edit the commit message file.
+#
+# To enable this hook, rename this file to "commit-msg".
+
+# Uncomment the below to add a Signed-off-by line to the message.
+# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
+# hook is more suited to it.
+#
+# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
+
+# This example catches duplicate Signed-off-by lines.
+
+test "" = "$(grep '^Signed-off-by: ' "$1" |
+ sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
+ echo >&2 Duplicate Signed-off-by lines.
+ exit 1
+}
diff --git a/modules/git/tests/repos/repo1_bare/hooks/post-update.sample b/modules/git/tests/repos/repo1_bare/hooks/post-update.sample
new file mode 100755
index 0000000000..ec17ec1939
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/hooks/post-update.sample
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# An example hook script to prepare a packed repository for use over
+# dumb transports.
+#
+# To enable this hook, rename this file to "post-update".
+
+exec git update-server-info
diff --git a/modules/git/tests/repos/repo1_bare/hooks/pre-applypatch.sample b/modules/git/tests/repos/repo1_bare/hooks/pre-applypatch.sample
new file mode 100755
index 0000000000..4142082bcb
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/hooks/pre-applypatch.sample
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed
+# by applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-applypatch".
+
+. git-sh-setup
+precommit="$(git rev-parse --git-path hooks/pre-commit)"
+test -x "$precommit" && exec "$precommit" ${1+"$@"}
+:
diff --git a/modules/git/tests/repos/repo1_bare/hooks/pre-commit.sample b/modules/git/tests/repos/repo1_bare/hooks/pre-commit.sample
new file mode 100755
index 0000000000..68d62d5446
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/hooks/pre-commit.sample
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed.
+# Called by "git commit" with no arguments. The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-commit".
+
+if git rev-parse --verify HEAD >/dev/null 2>&1
+then
+ against=HEAD
+else
+ # Initial commit: diff against an empty tree object
+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+fi
+
+# If you want to allow non-ASCII filenames set this variable to true.
+allownonascii=$(git config --bool hooks.allownonascii)
+
+# Redirect output to stderr.
+exec 1>&2
+
+# Cross platform projects tend to avoid non-ASCII filenames; prevent
+# them from being added to the repository. We exploit the fact that the
+# printable range starts at the space character and ends with tilde.
+if [ "$allownonascii" != "true" ] &&
+ # Note that the use of brackets around a tr range is ok here, (it's
+ # even required, for portability to Solaris 10's /usr/bin/tr), since
+ # the square bracket bytes happen to fall in the designated range.
+ test $(git diff --cached --name-only --diff-filter=A -z $against |
+ LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
+then
+ cat <<\EOF
+Error: Attempt to add a non-ASCII file name.
+
+This can cause problems if you want to work with people on other platforms.
+
+To be portable it is advisable to rename the file.
+
+If you know what you are doing you can disable this check using:
+
+ git config hooks.allownonascii true
+EOF
+ exit 1
+fi
+
+# If there are whitespace errors, print the offending file names and fail.
+exec git diff-index --check --cached $against --
diff --git a/modules/git/tests/repos/repo1_bare/hooks/pre-push.sample b/modules/git/tests/repos/repo1_bare/hooks/pre-push.sample
new file mode 100755
index 0000000000..6187dbf439
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/hooks/pre-push.sample
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# An example hook script to verify what is about to be pushed. Called by "git
+# push" after it has checked the remote status, but before anything has been
+# pushed. If this script exits with a non-zero status nothing will be pushed.
+#
+# This hook is called with the following parameters:
+#
+# $1 -- Name of the remote to which the push is being done
+# $2 -- URL to which the push is being done
+#
+# If pushing without using a named remote those arguments will be equal.
+#
+# Information about the commits which are being pushed is supplied as lines to
+# the standard input in the form:
+#
+# <local ref> <local sha1> <remote ref> <remote sha1>
+#
+# This sample shows how to prevent push of commits where the log message starts
+# with "WIP" (work in progress).
+
+remote="$1"
+url="$2"
+
+z40=0000000000000000000000000000000000000000
+
+while read local_ref local_sha remote_ref remote_sha
+do
+ if [ "$local_sha" = $z40 ]
+ then
+ # Handle delete
+ :
+ else
+ if [ "$remote_sha" = $z40 ]
+ then
+ # New branch, examine all commits
+ range="$local_sha"
+ else
+ # Update to existing branch, examine new commits
+ range="$remote_sha..$local_sha"
+ fi
+
+ # Check for WIP commit
+ commit=`git rev-list -n 1 --grep '^WIP' "$range"`
+ if [ -n "$commit" ]
+ then
+ echo >&2 "Found WIP commit in $local_ref, not pushing"
+ exit 1
+ fi
+ fi
+done
+
+exit 0
diff --git a/modules/git/tests/repos/repo1_bare/hooks/pre-rebase.sample b/modules/git/tests/repos/repo1_bare/hooks/pre-rebase.sample
new file mode 100755
index 0000000000..33730ca647
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/hooks/pre-rebase.sample
@@ -0,0 +1,169 @@
+#!/bin/sh
+#
+# Copyright (c) 2006, 2008 Junio C Hamano
+#
+# The "pre-rebase" hook is run just before "git rebase" starts doing
+# its job, and can prevent the command from running by exiting with
+# non-zero status.
+#
+# The hook is called with the following parameters:
+#
+# $1 -- the upstream the series was forked from.
+# $2 -- the branch being rebased (or empty when rebasing the current branch).
+#
+# This sample shows how to prevent topic branches that are already
+# merged to 'next' branch from getting rebased, because allowing it
+# would result in rebasing already published history.
+
+publish=next
+basebranch="$1"
+if test "$#" = 2
+then
+ topic="refs/heads/$2"
+else
+ topic=`git symbolic-ref HEAD` ||
+ exit 0 ;# we do not interrupt rebasing detached HEAD
+fi
+
+case "$topic" in
+refs/heads/??/*)
+ ;;
+*)
+ exit 0 ;# we do not interrupt others.
+ ;;
+esac
+
+# Now we are dealing with a topic branch being rebased
+# on top of master. Is it OK to rebase it?
+
+# Does the topic really exist?
+git show-ref -q "$topic" || {
+ echo >&2 "No such branch $topic"
+ exit 1
+}
+
+# Is topic fully merged to master?
+not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
+if test -z "$not_in_master"
+then
+ echo >&2 "$topic is fully merged to master; better remove it."
+ exit 1 ;# we could allow it, but there is no point.
+fi
+
+# Is topic ever merged to next? If so you should not be rebasing it.
+only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
+only_next_2=`git rev-list ^master ${publish} | sort`
+if test "$only_next_1" = "$only_next_2"
+then
+ not_in_topic=`git rev-list "^$topic" master`
+ if test -z "$not_in_topic"
+ then
+ echo >&2 "$topic is already up-to-date with master"
+ exit 1 ;# we could allow it, but there is no point.
+ else
+ exit 0
+ fi
+else
+ not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
+ /usr/bin/perl -e '
+ my $topic = $ARGV[0];
+ my $msg = "* $topic has commits already merged to public branch:\n";
+ my (%not_in_next) = map {
+ /^([0-9a-f]+) /;
+ ($1 => 1);
+ } split(/\n/, $ARGV[1]);
+ for my $elem (map {
+ /^([0-9a-f]+) (.*)$/;
+ [$1 => $2];
+ } split(/\n/, $ARGV[2])) {
+ if (!exists $not_in_next{$elem->[0]}) {
+ if ($msg) {
+ print STDERR $msg;
+ undef $msg;
+ }
+ print STDERR " $elem->[1]\n";
+ }
+ }
+ ' "$topic" "$not_in_next" "$not_in_master"
+ exit 1
+fi
+
+<<\DOC_END
+
+This sample hook safeguards topic branches that have been
+published from being rewound.
+
+The workflow assumed here is:
+
+ * Once a topic branch forks from "master", "master" is never
+ merged into it again (either directly or indirectly).
+
+ * Once a topic branch is fully cooked and merged into "master",
+ it is deleted. If you need to build on top of it to correct
+ earlier mistakes, a new topic branch is created by forking at
+ the tip of the "master". This is not strictly necessary, but
+ it makes it easier to keep your history simple.
+
+ * Whenever you need to test or publish your changes to topic
+ branches, merge them into "next" branch.
+
+The script, being an example, hardcodes the publish branch name
+to be "next", but it is trivial to make it configurable via
+$GIT_DIR/config mechanism.
+
+With this workflow, you would want to know:
+
+(1) ... if a topic branch has ever been merged to "next". Young
+ topic branches can have stupid mistakes you would rather
+ clean up before publishing, and things that have not been
+ merged into other branches can be easily rebased without
+ affecting other people. But once it is published, you would
+ not want to rewind it.
+
+(2) ... if a topic branch has been fully merged to "master".
+ Then you can delete it. More importantly, you should not
+ build on top of it -- other people may already want to
+ change things related to the topic as patches against your
+ "master", so if you need further changes, it is better to
+ fork the topic (perhaps with the same name) afresh from the
+ tip of "master".
+
+Let's look at this example:
+
+ o---o---o---o---o---o---o---o---o---o "next"
+ / / / /
+ / a---a---b A / /
+ / / / /
+ / / c---c---c---c B /
+ / / / \ /
+ / / / b---b C \ /
+ / / / / \ /
+ ---o---o---o---o---o---o---o---o---o---o---o "master"
+
+
+A, B and C are topic branches.
+
+ * A has one fix since it was merged up to "next".
+
+ * B has finished. It has been fully merged up to "master" and "next",
+ and is ready to be deleted.
+
+ * C has not merged to "next" at all.
+
+We would want to allow C to be rebased, refuse A, and encourage
+B to be deleted.
+
+To compute (1):
+
+ git rev-list ^master ^topic next
+ git rev-list ^master next
+
+ if these match, topic has not merged in next at all.
+
+To compute (2):
+
+ git rev-list master..topic
+
+ if this is empty, it is fully merged to "master".
+
+DOC_END
diff --git a/modules/git/tests/repos/repo1_bare/hooks/pre-receive.sample b/modules/git/tests/repos/repo1_bare/hooks/pre-receive.sample
new file mode 100755
index 0000000000..a1fd29ec14
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/hooks/pre-receive.sample
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# An example hook script to make use of push options.
+# The example simply echoes all push options that start with 'echoback='
+# and rejects all pushes when the "reject" push option is used.
+#
+# To enable this hook, rename this file to "pre-receive".
+
+if test -n "$GIT_PUSH_OPTION_COUNT"
+then
+ i=0
+ while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
+ do
+ eval "value=\$GIT_PUSH_OPTION_$i"
+ case "$value" in
+ echoback=*)
+ echo "echo from the pre-receive-hook: ${value#*=}" >&2
+ ;;
+ reject)
+ exit 1
+ esac
+ i=$((i + 1))
+ done
+fi
diff --git a/modules/git/tests/repos/repo1_bare/hooks/prepare-commit-msg.sample b/modules/git/tests/repos/repo1_bare/hooks/prepare-commit-msg.sample
new file mode 100755
index 0000000000..f093a02ec4
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/hooks/prepare-commit-msg.sample
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# An example hook script to prepare the commit log message.
+# Called by "git commit" with the name of the file that has the
+# commit message, followed by the description of the commit
+# message's source. The hook's purpose is to edit the commit
+# message file. If the hook fails with a non-zero status,
+# the commit is aborted.
+#
+# To enable this hook, rename this file to "prepare-commit-msg".
+
+# This hook includes three examples. The first comments out the
+# "Conflicts:" part of a merge commit.
+#
+# The second includes the output of "git diff --name-status -r"
+# into the message, just before the "git status" output. It is
+# commented because it doesn't cope with --amend or with squashed
+# commits.
+#
+# The third example adds a Signed-off-by line to the message, that can
+# still be edited. This is rarely a good idea.
+
+case "$2,$3" in
+ merge,)
+ /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
+
+# ,|template,)
+# /usr/bin/perl -i.bak -pe '
+# print "\n" . `git diff --cached --name-status -r`
+# if /^#/ && $first++ == 0' "$1" ;;
+
+ *) ;;
+esac
+
+# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
diff --git a/modules/git/tests/repos/repo1_bare/hooks/update.sample b/modules/git/tests/repos/repo1_bare/hooks/update.sample
new file mode 100755
index 0000000000..80ba94135c
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/hooks/update.sample
@@ -0,0 +1,128 @@
+#!/bin/sh
+#
+# An example hook script to block unannotated tags from entering.
+# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
+#
+# To enable this hook, rename this file to "update".
+#
+# Config
+# ------
+# hooks.allowunannotated
+# This boolean sets whether unannotated tags will be allowed into the
+# repository. By default they won't be.
+# hooks.allowdeletetag
+# This boolean sets whether deleting tags will be allowed in the
+# repository. By default they won't be.
+# hooks.allowmodifytag
+# This boolean sets whether a tag may be modified after creation. By default
+# it won't be.
+# hooks.allowdeletebranch
+# This boolean sets whether deleting branches will be allowed in the
+# repository. By default they won't be.
+# hooks.denycreatebranch
+# This boolean sets whether remotely creating branches will be denied
+# in the repository. By default this is allowed.
+#
+
+# --- Command line
+refname="$1"
+oldrev="$2"
+newrev="$3"
+
+# --- Safety check
+if [ -z "$GIT_DIR" ]; then
+ echo "Don't run this script from the command line." >&2
+ echo " (if you want, you could supply GIT_DIR then run" >&2
+ echo " $0 <ref> <oldrev> <newrev>)" >&2
+ exit 1
+fi
+
+if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
+ echo "usage: $0 <ref> <oldrev> <newrev>" >&2
+ exit 1
+fi
+
+# --- Config
+allowunannotated=$(git config --bool hooks.allowunannotated)
+allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
+denycreatebranch=$(git config --bool hooks.denycreatebranch)
+allowdeletetag=$(git config --bool hooks.allowdeletetag)
+allowmodifytag=$(git config --bool hooks.allowmodifytag)
+
+# check for no description
+projectdesc=$(sed -e '1q' "$GIT_DIR/description")
+case "$projectdesc" in
+"Unnamed repository"* | "")
+ echo "*** Project description file hasn't been set" >&2
+ exit 1
+ ;;
+esac
+
+# --- Check types
+# if $newrev is 0000...0000, it's a commit to delete a ref.
+zero="0000000000000000000000000000000000000000"
+if [ "$newrev" = "$zero" ]; then
+ newrev_type=delete
+else
+ newrev_type=$(git cat-file -t $newrev)
+fi
+
+case "$refname","$newrev_type" in
+ refs/tags/*,commit)
+ # un-annotated tag
+ short_refname=${refname##refs/tags/}
+ if [ "$allowunannotated" != "true" ]; then
+ echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
+ echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
+ exit 1
+ fi
+ ;;
+ refs/tags/*,delete)
+ # delete tag
+ if [ "$allowdeletetag" != "true" ]; then
+ echo "*** Deleting a tag is not allowed in this repository" >&2
+ exit 1
+ fi
+ ;;
+ refs/tags/*,tag)
+ # annotated tag
+ if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
+ then
+ echo "*** Tag '$refname' already exists." >&2
+ echo "*** Modifying a tag is not allowed in this repository." >&2
+ exit 1
+ fi
+ ;;
+ refs/heads/*,commit)
+ # branch
+ if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
+ echo "*** Creating a branch is not allowed in this repository" >&2
+ exit 1
+ fi
+ ;;
+ refs/heads/*,delete)
+ # delete branch
+ if [ "$allowdeletebranch" != "true" ]; then
+ echo "*** Deleting a branch is not allowed in this repository" >&2
+ exit 1
+ fi
+ ;;
+ refs/remotes/*,commit)
+ # tracking branch
+ ;;
+ refs/remotes/*,delete)
+ # delete tracking branch
+ if [ "$allowdeletebranch" != "true" ]; then
+ echo "*** Deleting a tracking branch is not allowed in this repository" >&2
+ exit 1
+ fi
+ ;;
+ *)
+ # Anything else (is there anything else?)
+ echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
+ exit 1
+ ;;
+esac
+
+# --- Finished
+exit 0
diff --git a/modules/git/tests/repos/repo1_bare/info/exclude b/modules/git/tests/repos/repo1_bare/info/exclude
new file mode 100644
index 0000000000..a5196d1be8
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/info/exclude
@@ -0,0 +1,6 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
diff --git a/modules/git/tests/repos/repo1_bare/objects/0b/9f291245f6c596fd30bee925fe94fe0cbadd60 b/modules/git/tests/repos/repo1_bare/objects/0b/9f291245f6c596fd30bee925fe94fe0cbadd60
new file mode 100644
index 0000000000..11de5add68
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/0b/9f291245f6c596fd30bee925fe94fe0cbadd60
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/11/93ff46343f4f6a0522e2b28b871e905178c1f0 b/modules/git/tests/repos/repo1_bare/objects/11/93ff46343f4f6a0522e2b28b871e905178c1f0
new file mode 100644
index 0000000000..3541cd14f0
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/11/93ff46343f4f6a0522e2b28b871e905178c1f0
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/15/3f451b9ee7fa1da317ab17a127e9fd9d384310 b/modules/git/tests/repos/repo1_bare/objects/15/3f451b9ee7fa1da317ab17a127e9fd9d384310
new file mode 100644
index 0000000000..8db3c790b5
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/15/3f451b9ee7fa1da317ab17a127e9fd9d384310
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/18/4d49c75a0b202b1d2ea2fcb5861c329321fcd6 b/modules/git/tests/repos/repo1_bare/objects/18/4d49c75a0b202b1d2ea2fcb5861c329321fcd6
new file mode 100644
index 0000000000..45e014ea85
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/18/4d49c75a0b202b1d2ea2fcb5861c329321fcd6
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/21/6bf54c2f2e2916b830ebe09e8c58a6ed52d86b b/modules/git/tests/repos/repo1_bare/objects/21/6bf54c2f2e2916b830ebe09e8c58a6ed52d86b
new file mode 100644
index 0000000000..8c0b1b3285
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/21/6bf54c2f2e2916b830ebe09e8c58a6ed52d86b
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/28/39944139e0de9737a044f78b0e4b40d989a9e3 b/modules/git/tests/repos/repo1_bare/objects/28/39944139e0de9737a044f78b0e4b40d989a9e3
new file mode 100644
index 0000000000..e22e656fbe
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/28/39944139e0de9737a044f78b0e4b40d989a9e3
@@ -0,0 +1 @@
+x…ÎÁ Â0 @QΙ" €â¸il që 8Ž¨ÔB‚Ôñ©X€óÿ‡'¯u»ÆSoª6*摨"Ž,É“æTsI\I+r,|2[júì–…“V*…u>KT?P4ÂèRt@Á¤O¼šö´n‹Úû[›½Þ,À\`oÏŽœ3òõ£þ]ÍTz…Kß»ùe;ƒ \ No newline at end of file
diff --git a/modules/git/tests/repos/repo1_bare/objects/2e/65efe2a145dda7ee51d1741299f848e5bf752e b/modules/git/tests/repos/repo1_bare/objects/2e/65efe2a145dda7ee51d1741299f848e5bf752e
new file mode 100644
index 0000000000..3e46ba4a32
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/2e/65efe2a145dda7ee51d1741299f848e5bf752e
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/30/4c56b3bef33d0afeb8515ee803c839daf30ab8 b/modules/git/tests/repos/repo1_bare/objects/30/4c56b3bef33d0afeb8515ee803c839daf30ab8
new file mode 100644
index 0000000000..3a5c6c1962
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/30/4c56b3bef33d0afeb8515ee803c839daf30ab8
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/34/d1da713bf7de1c535e1d7d3ca985afd84bc7e5 b/modules/git/tests/repos/repo1_bare/objects/34/d1da713bf7de1c535e1d7d3ca985afd84bc7e5
new file mode 100644
index 0000000000..29f2d4fd00
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/34/d1da713bf7de1c535e1d7d3ca985afd84bc7e5
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/37/991dec2c8e592043f47155ce4808d4580f9123 b/modules/git/tests/repos/repo1_bare/objects/37/991dec2c8e592043f47155ce4808d4580f9123
new file mode 100644
index 0000000000..3658e95141
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/37/991dec2c8e592043f47155ce4808d4580f9123
@@ -0,0 +1 @@
+xŽKN1 YçÞ#ç3 !Øp.ØÎL‹™J›·§á,kñêû}5 PlªB÷5sKÔH|>ŸdíKÌKl kì% û¬S7ƒÜ›ä¢e¡Ó¢™c¥Î‰±çÆH‡§Señ®~ÙuLxŸëocì Óeµ—ý:D¾7µÓ˜—gð‰¢_Bñ=":þËüÝüSà^ETàø™·uûp?ƒ6M^ \ No newline at end of file
diff --git a/modules/git/tests/repos/repo1_bare/objects/38/441bf2c4d4c27efff94728c9eb33266f44a702 b/modules/git/tests/repos/repo1_bare/objects/38/441bf2c4d4c27efff94728c9eb33266f44a702
new file mode 100644
index 0000000000..c3d484aee0
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/38/441bf2c4d4c27efff94728c9eb33266f44a702
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/3a/d28a9149a2864384548f3d17ed7f38014c9e8a b/modules/git/tests/repos/repo1_bare/objects/3a/d28a9149a2864384548f3d17ed7f38014c9e8a
new file mode 100644
index 0000000000..ee2652b1c5
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/3a/d28a9149a2864384548f3d17ed7f38014c9e8a
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/50/13716a9da8e66ea21059a84f1b4311424d2b7f b/modules/git/tests/repos/repo1_bare/objects/50/13716a9da8e66ea21059a84f1b4311424d2b7f
new file mode 100644
index 0000000000..b96905930a
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/50/13716a9da8e66ea21059a84f1b4311424d2b7f
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/59/dfb0bb505a601006e31fed53d2e24e44fca9ca b/modules/git/tests/repos/repo1_bare/objects/59/dfb0bb505a601006e31fed53d2e24e44fca9ca
new file mode 100644
index 0000000000..16292715bd
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/59/dfb0bb505a601006e31fed53d2e24e44fca9ca
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/5c/80b0245c1c6f8343fa418ec374b13b5d4ee658 b/modules/git/tests/repos/repo1_bare/objects/5c/80b0245c1c6f8343fa418ec374b13b5d4ee658
new file mode 100644
index 0000000000..234d41bbc0
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/5c/80b0245c1c6f8343fa418ec374b13b5d4ee658
@@ -0,0 +1,3 @@
+x…Ž;
+1@­sŠ¹€:Éf7ÁÂ#x€ÉL‚‚û!FØ㻈½Õ+Þ+žÌãøhàÐíZÍb—H¼²²ö„‘J<J™…B
+VK6 ×<5ˆJ®õ½)J1Iú‚)¤d#1ê Tœáw»Ï®+Ë3Ãí•+œÎ`{»å;„=FD#ß¡¶Ù¿©¹¨Bª<ÉÝ<´µ™3ã>= \ No newline at end of file
diff --git a/modules/git/tests/repos/repo1_bare/objects/62/d735f9efa9cf5b7df6bac9917b80e4779f4315 b/modules/git/tests/repos/repo1_bare/objects/62/d735f9efa9cf5b7df6bac9917b80e4779f4315
new file mode 100644
index 0000000000..15b958a2a2
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/62/d735f9efa9cf5b7df6bac9917b80e4779f4315
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/64/3a35374408002fcf2f0e8d42d262a1e0e2f80e b/modules/git/tests/repos/repo1_bare/objects/64/3a35374408002fcf2f0e8d42d262a1e0e2f80e
new file mode 100644
index 0000000000..eb0ad47575
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/64/3a35374408002fcf2f0e8d42d262a1e0e2f80e
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/6c/493ff740f9380390d5c9ddef4af18697ac9375 b/modules/git/tests/repos/repo1_bare/objects/6c/493ff740f9380390d5c9ddef4af18697ac9375
new file mode 100644
index 0000000000..7d217a7850
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/6c/493ff740f9380390d5c9ddef4af18697ac9375
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/6f/bd69e9823458e6c4a2fc5c0f6bc022b2f2acd1 b/modules/git/tests/repos/repo1_bare/objects/6f/bd69e9823458e6c4a2fc5c0f6bc022b2f2acd1
new file mode 100644
index 0000000000..5b2cfb21cb
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/6f/bd69e9823458e6c4a2fc5c0f6bc022b2f2acd1
@@ -0,0 +1 @@
+xŽ1nÃ0 E3ëÜ ”-™&ÉÒô’H&F+Õ¡·oÚ#døÃÞÃ/õñX: ÁïzS…i£±Zâb1“Ø”Saö”gÔ@ÄFÝ35];̈“'Ɇ%sD’„5ŽôÚìÉØR,èÒw¿Ö_mÙ೶­kƒCÑþ²ôÓv­"?«ö}m—#ø8"Í#|xDtåÿæŸófÀET ·zÓîËzÛÜ/—þN° \ No newline at end of file
diff --git a/modules/git/tests/repos/repo1_bare/objects/7e/3b688f3369ca28ebafbda9f8ef39713dd12fc8 b/modules/git/tests/repos/repo1_bare/objects/7e/3b688f3369ca28ebafbda9f8ef39713dd12fc8
new file mode 100644
index 0000000000..113089d22b
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/7e/3b688f3369ca28ebafbda9f8ef39713dd12fc8
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/80/06ff9adbf0cb94da7dad9e537e53817f9fa5c0 b/modules/git/tests/repos/repo1_bare/objects/80/06ff9adbf0cb94da7dad9e537e53817f9fa5c0
new file mode 100644
index 0000000000..808fe6efb6
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/80/06ff9adbf0cb94da7dad9e537e53817f9fa5c0
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/82/26f571dcc2d2f33a7179d929b10b9c39faa631 b/modules/git/tests/repos/repo1_bare/objects/82/26f571dcc2d2f33a7179d929b10b9c39faa631
new file mode 100644
index 0000000000..6a194fb3a6
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/82/26f571dcc2d2f33a7179d929b10b9c39faa631
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/83/b9c4da46ed59098a009f8640c77eac97b71dfe b/modules/git/tests/repos/repo1_bare/objects/83/b9c4da46ed59098a009f8640c77eac97b71dfe
new file mode 100644
index 0000000000..8602ab5402
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/83/b9c4da46ed59098a009f8640c77eac97b71dfe
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/8d/92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2 b/modules/git/tests/repos/repo1_bare/objects/8d/92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2
new file mode 100644
index 0000000000..431a481078
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/8d/92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/95/bb4d39648ee7e325106df01a621c530863a653 b/modules/git/tests/repos/repo1_bare/objects/95/bb4d39648ee7e325106df01a621c530863a653
new file mode 100644
index 0000000000..6bb6a25648
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/95/bb4d39648ee7e325106df01a621c530863a653
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/98/1ff127cc331753bba28e1377c35934f1ca9b56 b/modules/git/tests/repos/repo1_bare/objects/98/1ff127cc331753bba28e1377c35934f1ca9b56
new file mode 100644
index 0000000000..ae6c93ac81
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/98/1ff127cc331753bba28e1377c35934f1ca9b56
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/9c/9aef8dd84e02bc7ec12641deb4c930a7c30185 b/modules/git/tests/repos/repo1_bare/objects/9c/9aef8dd84e02bc7ec12641deb4c930a7c30185
new file mode 100644
index 0000000000..8a263d0d6f
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/9c/9aef8dd84e02bc7ec12641deb4c930a7c30185
@@ -0,0 +1,2 @@
+x…ÎM
+1 @a×=E. ¤“¦Ó‚.<‚HÛ”œj…9¾â\¿oñò:Ï6ºCoª@è2ûDI+QA©š[V H9P,R %³IÓ¥Cä”\¡è]P•¶èKE+~°™ ƒ'ñLFÞ}ZÜv™·§Âý¥ ΰliddáˆÑäßPÿÖ¿Ô\KÔdÉ“=õ½›ܲ:c \ No newline at end of file
diff --git a/modules/git/tests/repos/repo1_bare/objects/b1/4df6442ea5a1b382985a6549b85d435376c351 b/modules/git/tests/repos/repo1_bare/objects/b1/4df6442ea5a1b382985a6549b85d435376c351
new file mode 100644
index 0000000000..02fe24f0ae
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/b1/4df6442ea5a1b382985a6549b85d435376c351
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/b1/fc9917b618c924cf4aa421dae74e8bf9b556d3 b/modules/git/tests/repos/repo1_bare/objects/b1/fc9917b618c924cf4aa421dae74e8bf9b556d3
new file mode 100644
index 0000000000..aacc5efc9d
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/b1/fc9917b618c924cf4aa421dae74e8bf9b556d3
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/b7/5f44edbd9252c32bf9faa0c1257ffb3b126c24 b/modules/git/tests/repos/repo1_bare/objects/b7/5f44edbd9252c32bf9faa0c1257ffb3b126c24
new file mode 100644
index 0000000000..6c2e007e9f
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/b7/5f44edbd9252c32bf9faa0c1257ffb3b126c24
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/c8/c90111bdc18b3afd2b2906007059e95ac8fdc3 b/modules/git/tests/repos/repo1_bare/objects/c8/c90111bdc18b3afd2b2906007059e95ac8fdc3
new file mode 100644
index 0000000000..57c5d7ce84
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/c8/c90111bdc18b3afd2b2906007059e95ac8fdc3
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/d0/845fe2f85710b50d673dafe98236bf9f2023da b/modules/git/tests/repos/repo1_bare/objects/d0/845fe2f85710b50d673dafe98236bf9f2023da
new file mode 100644
index 0000000000..d29ca5af88
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/d0/845fe2f85710b50d673dafe98236bf9f2023da
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/e2/129701f1a4d54dc44f03c93bca0a2aec7c5449 b/modules/git/tests/repos/repo1_bare/objects/e2/129701f1a4d54dc44f03c93bca0a2aec7c5449
new file mode 100644
index 0000000000..08245d0012
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/e2/129701f1a4d54dc44f03c93bca0a2aec7c5449
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/objects/f1/a6cb52b2d16773290cefe49ad0684b50a4f930 b/modules/git/tests/repos/repo1_bare/objects/f1/a6cb52b2d16773290cefe49ad0684b50a4f930
new file mode 100644
index 0000000000..6a412c76b1
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/objects/f1/a6cb52b2d16773290cefe49ad0684b50a4f930
Binary files differ
diff --git a/modules/git/tests/repos/repo1_bare/refs/heads/branch1 b/modules/git/tests/repos/repo1_bare/refs/heads/branch1
new file mode 100644
index 0000000000..eb33bd0936
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/refs/heads/branch1
@@ -0,0 +1 @@
+2839944139e0de9737a044f78b0e4b40d989a9e3
diff --git a/modules/git/tests/repos/repo1_bare/refs/heads/branch2 b/modules/git/tests/repos/repo1_bare/refs/heads/branch2
new file mode 100644
index 0000000000..0475e61f8c
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/refs/heads/branch2
@@ -0,0 +1 @@
+5c80b0245c1c6f8343fa418ec374b13b5d4ee658
diff --git a/modules/git/tests/repos/repo1_bare/refs/heads/master b/modules/git/tests/repos/repo1_bare/refs/heads/master
new file mode 100644
index 0000000000..4804d9d8fe
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/refs/heads/master
@@ -0,0 +1 @@
+37991dec2c8e592043f47155ce4808d4580f9123
diff --git a/modules/git/tests/repos/repo1_bare/refs/tags/test b/modules/git/tests/repos/repo1_bare/refs/tags/test
new file mode 100644
index 0000000000..ee311722e5
--- /dev/null
+++ b/modules/git/tests/repos/repo1_bare/refs/tags/test
@@ -0,0 +1 @@
+3ad28a9149a2864384548f3d17ed7f38014c9e8a
diff --git a/vendor/code.gitea.io/git/tree.go b/modules/git/tree.go
index b65fe19409..5ec22a3a6f 100644
--- a/vendor/code.gitea.io/git/tree.go
+++ b/modules/git/tree.go
@@ -19,8 +19,8 @@ type Tree struct {
entries Entries
entriesParsed bool
- entriesRecursive Entries
- entriesRecursiveParsed bool
+ entriesRecursive Entries
+ entriesRecursiveParsed bool
}
// NewTree create a new tree according the repository and commit id
diff --git a/vendor/code.gitea.io/git/tree_blob.go b/modules/git/tree_blob.go
index b3d205d8e1..a37f6b2279 100644
--- a/vendor/code.gitea.io/git/tree_blob.go
+++ b/modules/git/tree_blob.go
@@ -9,7 +9,7 @@ import (
"strings"
)
-// GetTreeEntryByPath get the tree entries accroding the sub dir
+// GetTreeEntryByPath get the tree entries according the sub dir
func (t *Tree) GetTreeEntryByPath(relpath string) (*TreeEntry, error) {
if len(relpath) == 0 {
return &TreeEntry{
@@ -44,7 +44,7 @@ func (t *Tree) GetTreeEntryByPath(relpath string) (*TreeEntry, error) {
return nil, ErrNotExist{"", relpath}
}
-// GetBlobByPath get the blob object accroding the path
+// GetBlobByPath get the blob object according the path
func (t *Tree) GetBlobByPath(relpath string) (*Blob, error) {
entry, err := t.GetTreeEntryByPath(relpath)
if err != nil {
diff --git a/vendor/code.gitea.io/git/tree_entry.go b/modules/git/tree_entry.go
index ead0d4f5df..5b74e9a695 100644
--- a/vendor/code.gitea.io/git/tree_entry.go
+++ b/modules/git/tree_entry.go
@@ -39,7 +39,7 @@ type TreeEntry struct {
ptree *Tree
- commited bool
+ committed bool
size int64
sized bool
diff --git a/modules/git/tree_entry_test.go b/modules/git/tree_entry_test.go
new file mode 100644
index 0000000000..52920bc00e
--- /dev/null
+++ b/modules/git/tree_entry_test.go
@@ -0,0 +1,98 @@
+// Copyright 2017 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package git
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func getTestEntries() Entries {
+ return Entries{
+ &TreeEntry{name: "v1.0", mode: EntryModeTree},
+ &TreeEntry{name: "v2.0", mode: EntryModeTree},
+ &TreeEntry{name: "v2.1", mode: EntryModeTree},
+ &TreeEntry{name: "v2.12", mode: EntryModeTree},
+ &TreeEntry{name: "v2.2", mode: EntryModeTree},
+ &TreeEntry{name: "v12.0", mode: EntryModeTree},
+ &TreeEntry{name: "abc", mode: EntryModeBlob},
+ &TreeEntry{name: "bcd", mode: EntryModeBlob},
+ }
+}
+
+func TestEntriesSort(t *testing.T) {
+ entries := getTestEntries()
+ entries.Sort()
+ assert.Equal(t, "v1.0", entries[0].Name())
+ assert.Equal(t, "v12.0", entries[1].Name())
+ assert.Equal(t, "v2.0", entries[2].Name())
+ assert.Equal(t, "v2.1", entries[3].Name())
+ assert.Equal(t, "v2.12", entries[4].Name())
+ assert.Equal(t, "v2.2", entries[5].Name())
+ assert.Equal(t, "abc", entries[6].Name())
+ assert.Equal(t, "bcd", entries[7].Name())
+}
+
+func TestEntriesCustomSort(t *testing.T) {
+ entries := getTestEntries()
+ entries.CustomSort(func(s1, s2 string) bool {
+ return s1 > s2
+ })
+ assert.Equal(t, "v2.2", entries[0].Name())
+ assert.Equal(t, "v2.12", entries[1].Name())
+ assert.Equal(t, "v2.1", entries[2].Name())
+ assert.Equal(t, "v2.0", entries[3].Name())
+ assert.Equal(t, "v12.0", entries[4].Name())
+ assert.Equal(t, "v1.0", entries[5].Name())
+ assert.Equal(t, "bcd", entries[6].Name())
+ assert.Equal(t, "abc", entries[7].Name())
+}
+
+func TestFollowLink(t *testing.T) {
+ r, err := OpenRepository("tests/repos/repo1_bare")
+ assert.NoError(t, err)
+
+ commit, err := r.GetCommit("37991dec2c8e592043f47155ce4808d4580f9123")
+ assert.NoError(t, err)
+
+ // get the symlink
+ lnk, err := commit.Tree.GetTreeEntryByPath("foo/bar/link_to_hello")
+ assert.NoError(t, err)
+ assert.True(t, lnk.IsLink())
+
+ // should be able to dereference to target
+ target, err := lnk.FollowLink()
+ assert.NoError(t, err)
+ assert.Equal(t, target.Name(), "hello")
+ assert.False(t, target.IsLink())
+ assert.Equal(t, target.ID.String(), "b14df6442ea5a1b382985a6549b85d435376c351")
+
+ // should error when called on normal file
+ target, err = commit.Tree.GetTreeEntryByPath("file1.txt")
+ assert.NoError(t, err)
+ _, err = target.FollowLink()
+ assert.Equal(t, err.Error(), "file1.txt: not a symlink")
+
+ // should error for broken links
+ target, err = commit.Tree.GetTreeEntryByPath("foo/broken_link")
+ assert.NoError(t, err)
+ assert.True(t, target.IsLink())
+ _, err = target.FollowLink()
+ assert.Equal(t, err.Error(), "broken_link: broken link")
+
+ // should error for external links
+ target, err = commit.Tree.GetTreeEntryByPath("foo/outside_repo")
+ assert.NoError(t, err)
+ assert.True(t, target.IsLink())
+ _, err = target.FollowLink()
+ assert.Equal(t, err.Error(), "outside_repo: points outside of repo")
+
+ // testing fix for short link bug
+ target, err = commit.Tree.GetTreeEntryByPath("foo/link_short")
+ assert.NoError(t, err)
+ _, err = target.FollowLink()
+ assert.Equal(t, err.Error(), "link_short: broken link")
+}
diff --git a/vendor/code.gitea.io/git/utils.go b/modules/git/utils.go
index 8f010321cf..8f010321cf 100644
--- a/vendor/code.gitea.io/git/utils.go
+++ b/modules/git/utils.go
diff --git a/modules/notification/base/notifier.go b/modules/notification/base/notifier.go
index bac90f5bb1..e44f3cc632 100644
--- a/modules/notification/base/notifier.go
+++ b/modules/notification/base/notifier.go
@@ -5,8 +5,8 @@
package base
import (
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
)
// Notifier defines an interface to notify receiver
diff --git a/modules/notification/base/null.go b/modules/notification/base/null.go
index 608bd0dcaa..12be1999f9 100644
--- a/modules/notification/base/null.go
+++ b/modules/notification/base/null.go
@@ -5,8 +5,8 @@
package base
import (
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
)
// NullNotifier implements a blank notifier
diff --git a/modules/notification/notification.go b/modules/notification/notification.go
index e38c36f7dd..e0de88346d 100644
--- a/modules/notification/notification.go
+++ b/modules/notification/notification.go
@@ -5,8 +5,8 @@
package notification
import (
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/notification/base"
"code.gitea.io/gitea/modules/notification/indexer"
"code.gitea.io/gitea/modules/notification/mail"
diff --git a/modules/notification/ui/ui.go b/modules/notification/ui/ui.go
index 135e92abfd..9870043580 100644
--- a/modules/notification/ui/ui.go
+++ b/modules/notification/ui/ui.go
@@ -5,8 +5,8 @@
package ui
import (
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification/base"
)
diff --git a/modules/setting/git.go b/modules/setting/git.go
index 59951fcb94..5d9701a435 100644
--- a/modules/setting/git.go
+++ b/modules/setting/git.go
@@ -7,8 +7,9 @@ package setting
import (
"time"
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
+
version "github.com/mcuadros/go-version"
)
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index ac44f54f0a..95fca20b11 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -20,8 +20,8 @@ import (
"strings"
"time"
- "code.gitea.io/git"
"code.gitea.io/gitea/modules/generate"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
_ "code.gitea.io/gitea/modules/minwinsvc" // import minwinsvc for windows services
"code.gitea.io/gitea/modules/user"
diff --git a/modules/test/context_tests.go b/modules/test/context_tests.go
index af986001ae..d5a800d360 100644
--- a/modules/test/context_tests.go
+++ b/modules/test/context_tests.go
@@ -6,14 +6,13 @@ package test
import (
"net/http"
+ "net/http/httptest"
"net/url"
"testing"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
-
- "net/http/httptest"
+ "code.gitea.io/gitea/modules/git"
"github.com/go-macaron/session"
"github.com/stretchr/testify/assert"
diff --git a/modules/uploader/delete.go b/modules/uploader/delete.go
index fbe451c5d0..2353f18c46 100644
--- a/modules/uploader/delete.go
+++ b/modules/uploader/delete.go
@@ -7,8 +7,8 @@ package uploader
import (
"fmt"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
)
// DeleteRepoFileOptions holds the repository delete file options
diff --git a/modules/uploader/update.go b/modules/uploader/update.go
index 08caf11ee1..bc543c7ffa 100644
--- a/modules/uploader/update.go
+++ b/modules/uploader/update.go
@@ -8,8 +8,8 @@ import (
"fmt"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/lfs"
"code.gitea.io/gitea/modules/setting"
)
diff --git a/modules/uploader/upload.go b/modules/uploader/upload.go
index bee3f1b9b1..81d7c3ba20 100644
--- a/modules/uploader/upload.go
+++ b/modules/uploader/upload.go
@@ -10,11 +10,10 @@ import (
"path"
"strings"
+ "code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/lfs"
"code.gitea.io/gitea/modules/setting"
-
- "code.gitea.io/git"
- "code.gitea.io/gitea/models"
)
// UploadRepoFileOptions contains the uploaded repository file options
diff --git a/routers/api/v1/convert/convert.go b/routers/api/v1/convert/convert.go
index 6569d21ab8..7de4d5acc1 100644
--- a/routers/api/v1/convert/convert.go
+++ b/routers/api/v1/convert/convert.go
@@ -7,14 +7,13 @@ package convert
import (
"fmt"
- "github.com/Unknwon/com"
-
- api "code.gitea.io/sdk/gitea"
-
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/util"
+ api "code.gitea.io/sdk/gitea"
+
+ "github.com/Unknwon/com"
)
// ToEmail convert models.EmailAddress to api.Email
diff --git a/routers/api/v1/repo/commits.go b/routers/api/v1/repo/commits.go
index 3596e88015..75eff488db 100644
--- a/routers/api/v1/repo/commits.go
+++ b/routers/api/v1/repo/commits.go
@@ -8,12 +8,11 @@ package repo
import (
"time"
- "code.gitea.io/git"
- api "code.gitea.io/sdk/gitea"
-
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
+ api "code.gitea.io/sdk/gitea"
)
// GetSingleCommit get a commit via
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go
index 929ed00d68..3ce80d24f0 100644
--- a/routers/api/v1/repo/file.go
+++ b/routers/api/v1/repo/file.go
@@ -8,9 +8,8 @@ package repo
import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/routers/repo"
-
- "code.gitea.io/git"
)
// GetRawFile get a file by path on a repository
diff --git a/routers/api/v1/repo/git_ref.go b/routers/api/v1/repo/git_ref.go
index ffdfc57b1d..6a6ed9ff36 100644
--- a/routers/api/v1/repo/git_ref.go
+++ b/routers/api/v1/repo/git_ref.go
@@ -6,8 +6,7 @@ package repo
import (
"code.gitea.io/gitea/modules/context"
-
- "code.gitea.io/git"
+ "code.gitea.io/gitea/modules/git"
api "code.gitea.io/sdk/gitea"
)
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go
index f01049721e..ef9d5ac1d3 100644
--- a/routers/api/v1/repo/hook.go
+++ b/routers/api/v1/repo/hook.go
@@ -5,9 +5,9 @@
package repo
import (
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/routers/api/v1/convert"
"code.gitea.io/gitea/routers/api/v1/utils"
api "code.gitea.io/sdk/gitea"
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 156ca83a19..7abe6241bd 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -9,14 +9,13 @@ import (
"net/http"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/util"
-
api "code.gitea.io/sdk/gitea"
)
diff --git a/routers/api/v1/repo/tree.go b/routers/api/v1/repo/tree.go
index 8a5d0c4b01..012eba673e 100644
--- a/routers/api/v1/repo/tree.go
+++ b/routers/api/v1/repo/tree.go
@@ -8,8 +8,8 @@ import (
"fmt"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/sdk/gitea"
)
diff --git a/routers/init.go b/routers/init.go
index 2fc3bb9668..3b8d8ac908 100644
--- a/routers/init.go
+++ b/routers/init.go
@@ -9,11 +9,11 @@ import (
"strings"
"time"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/migrations"
"code.gitea.io/gitea/modules/cache"
"code.gitea.io/gitea/modules/cron"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/highlight"
issue_indexer "code.gitea.io/gitea/modules/indexer/issues"
"code.gitea.io/gitea/modules/log"
diff --git a/routers/private/push_update.go b/routers/private/push_update.go
index 988d273344..5c42f066ee 100644
--- a/routers/private/push_update.go
+++ b/routers/private/push_update.go
@@ -8,8 +8,8 @@ import (
"encoding/json"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
macaron "gopkg.in/macaron.v1"
diff --git a/routers/repo/branch.go b/routers/repo/branch.go
index 44fd4bcd18..19925c1edc 100644
--- a/routers/repo/branch.go
+++ b/routers/repo/branch.go
@@ -8,11 +8,11 @@ package repo
import (
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/util"
)
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 820a546468..9e40ced7fb 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -8,10 +8,10 @@ import (
"path"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
diff --git a/routers/repo/download.go b/routers/repo/download.go
index 57a1e65ac9..41c4a18102 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -11,10 +11,9 @@ import (
"path"
"strings"
- "code.gitea.io/git"
-
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/lfs"
)
diff --git a/routers/repo/editor.go b/routers/repo/editor.go
index 01963d8dc6..54046258b8 100644
--- a/routers/repo/editor.go
+++ b/routers/repo/editor.go
@@ -11,11 +11,11 @@ import (
"path"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/templates"
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 33d3ec6a74..2db2cfc71b 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -15,20 +15,20 @@ import (
"strconv"
"strings"
- "github.com/Unknwon/com"
- "github.com/Unknwon/paginater"
-
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
issue_indexer "code.gitea.io/gitea/modules/indexer/issues"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
+
+ "github.com/Unknwon/com"
+ "github.com/Unknwon/paginater"
)
const (
diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go
index 4dee272edb..6ff09cb845 100644
--- a/routers/repo/middlewares.go
+++ b/routers/repo/middlewares.go
@@ -3,9 +3,9 @@ package repo
import (
"fmt"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
)
// SetEditorconfigIfExists set editor config as render variable
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index c61ae905f7..08c833c167 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -13,11 +13,11 @@ import (
"path"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 42dfd56268..5add788fc8 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -10,17 +10,16 @@ import (
"path"
"strings"
- "github.com/Unknwon/com"
-
- "code.gitea.io/git"
-
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
+
+ "github.com/Unknwon/com"
)
const (
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index d68edb4e56..2520b57bc7 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -10,12 +10,11 @@ import (
"strings"
"time"
- "code.gitea.io/git"
-
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
diff --git a/routers/repo/setting_protected_branch.go b/routers/repo/setting_protected_branch.go
index def27753dc..05ad0ec0ec 100644
--- a/routers/repo/setting_protected_branch.go
+++ b/routers/repo/setting_protected_branch.go
@@ -8,11 +8,11 @@ import (
"fmt"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
)
diff --git a/routers/repo/view.go b/routers/repo/view.go
index 786cfcbc56..dcd546ff68 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -14,10 +14,10 @@ import (
"path"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/highlight"
"code.gitea.io/gitea/modules/lfs"
"code.gitea.io/gitea/modules/log"
diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go
index cea5145353..8510cb7ba2 100644
--- a/routers/repo/webhook.go
+++ b/routers/repo/webhook.go
@@ -12,11 +12,11 @@ import (
"path"
"strings"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/sdk/gitea"
diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go
index 8426406c31..790214e8e5 100644
--- a/routers/repo/wiki.go
+++ b/routers/repo/wiki.go
@@ -11,12 +11,11 @@ import (
"path/filepath"
"strings"
- "code.gitea.io/git"
-
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/util"
diff --git a/routers/repo/wiki_test.go b/routers/repo/wiki_test.go
index 99812cab47..7302f9e48b 100644
--- a/routers/repo/wiki_test.go
+++ b/routers/repo/wiki_test.go
@@ -9,9 +9,9 @@ import (
"net/http"
"testing"
- "code.gitea.io/git"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
+ "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/test"
"github.com/stretchr/testify/assert"
diff --git a/vendor/code.gitea.io/git/LICENSE b/vendor/code.gitea.io/git/LICENSE
deleted file mode 100644
index 10aeba46bc..0000000000
--- a/vendor/code.gitea.io/git/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2016 The Gitea Authors
-Copyright (c) 2014 The Gogs Authors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/code.gitea.io/git/doc.go b/vendor/code.gitea.io/git/doc.go
deleted file mode 100644
index 1941d28550..0000000000
--- a/vendor/code.gitea.io/git/doc.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2016 The Gitea Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package git // import "code.gitea.io/git"
diff --git a/vendor/github.com/stretchr/testify/require/doc.go b/vendor/github.com/stretchr/testify/require/doc.go
new file mode 100644
index 0000000000..169de39221
--- /dev/null
+++ b/vendor/github.com/stretchr/testify/require/doc.go
@@ -0,0 +1,28 @@
+// Package require implements the same assertions as the `assert` package but
+// stops test execution when a test fails.
+//
+// Example Usage
+//
+// The following is a complete example using require in a standard test function:
+// import (
+// "testing"
+// "github.com/stretchr/testify/require"
+// )
+//
+// func TestSomething(t *testing.T) {
+//
+// var a string = "Hello"
+// var b string = "Hello"
+//
+// require.Equal(t, a, b, "The two words should be the same.")
+//
+// }
+//
+// Assertions
+//
+// The `require` package have same global functions as in the `assert` package,
+// but instead of returning a boolean result they call `t.FailNow()`.
+//
+// Every assertion function also takes an optional string message as the final argument,
+// allowing custom error messages to be appended to the message the assertion method outputs.
+package require
diff --git a/vendor/github.com/stretchr/testify/require/forward_requirements.go b/vendor/github.com/stretchr/testify/require/forward_requirements.go
new file mode 100644
index 0000000000..ac71d40581
--- /dev/null
+++ b/vendor/github.com/stretchr/testify/require/forward_requirements.go
@@ -0,0 +1,16 @@
+package require
+
+// Assertions provides assertion methods around the
+// TestingT interface.
+type Assertions struct {
+ t TestingT
+}
+
+// New makes a new Assertions object for the specified TestingT.
+func New(t TestingT) *Assertions {
+ return &Assertions{
+ t: t,
+ }
+}
+
+//go:generate go run ../_codegen/main.go -output-package=require -template=require_forward.go.tmpl -include-format-funcs
diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go
new file mode 100644
index 0000000000..ac3c308788
--- /dev/null
+++ b/vendor/github.com/stretchr/testify/require/require.go
@@ -0,0 +1,867 @@
+/*
+* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
+* THIS FILE MUST NOT BE EDITED BY HAND
+ */
+
+package require
+
+import (
+ assert "github.com/stretchr/testify/assert"
+ http "net/http"
+ url "net/url"
+ time "time"
+)
+
+// Condition uses a Comparison to assert a complex condition.
+func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) {
+ if !assert.Condition(t, comp, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Conditionf uses a Comparison to assert a complex condition.
+func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) {
+ if !assert.Conditionf(t, comp, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Contains asserts that the specified string, list(array, slice...) or map contains the
+// specified substring or element.
+//
+// assert.Contains(t, "Hello World", "World")
+// assert.Contains(t, ["Hello", "World"], "World")
+// assert.Contains(t, {"Hello": "World"}, "Hello")
+func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
+ if !assert.Contains(t, s, contains, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Containsf asserts that the specified string, list(array, slice...) or map contains the
+// specified substring or element.
+//
+// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
+// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
+// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
+func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
+ if !assert.Containsf(t, s, contains, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func DirExists(t TestingT, path string, msgAndArgs ...interface{}) {
+ if !assert.DirExists(t, path, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func DirExistsf(t TestingT, path string, msg string, args ...interface{}) {
+ if !assert.DirExistsf(t, path, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])
+func ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
+ if !assert.ElementsMatch(t, listA, listB, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
+func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) {
+ if !assert.ElementsMatchf(t, listA, listB, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
+// a slice or a channel with len == 0.
+//
+// assert.Empty(t, obj)
+func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
+ if !assert.Empty(t, object, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
+// a slice or a channel with len == 0.
+//
+// assert.Emptyf(t, obj, "error message %s", "formatted")
+func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
+ if !assert.Emptyf(t, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Equal asserts that two objects are equal.
+//
+// assert.Equal(t, 123, 123)
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
+func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
+ if !assert.Equal(t, expected, actual, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// EqualError asserts that a function returned an error (i.e. not `nil`)
+// and that it is equal to the provided error.
+//
+// actualObj, err := SomeFunction()
+// assert.EqualError(t, err, expectedErrorString)
+func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {
+ if !assert.EqualError(t, theError, errString, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
+// and that it is equal to the provided error.
+//
+// actualObj, err := SomeFunction()
+// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
+func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) {
+ if !assert.EqualErrorf(t, theError, errString, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// EqualValues asserts that two objects are equal or convertable to the same types
+// and equal.
+//
+// assert.EqualValues(t, uint32(123), int32(123))
+func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
+ if !assert.EqualValues(t, expected, actual, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// EqualValuesf asserts that two objects are equal or convertable to the same types
+// and equal.
+//
+// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
+func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ if !assert.EqualValuesf(t, expected, actual, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Equalf asserts that two objects are equal.
+//
+// assert.Equalf(t, 123, 123, "error message %s", "formatted")
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
+func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ if !assert.Equalf(t, expected, actual, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Error asserts that a function returned an error (i.e. not `nil`).
+//
+// actualObj, err := SomeFunction()
+// if assert.Error(t, err) {
+// assert.Equal(t, expectedError, err)
+// }
+func Error(t TestingT, err error, msgAndArgs ...interface{}) {
+ if !assert.Error(t, err, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Errorf asserts that a function returned an error (i.e. not `nil`).
+//
+// actualObj, err := SomeFunction()
+// if assert.Errorf(t, err, "error message %s", "formatted") {
+// assert.Equal(t, expectedErrorf, err)
+// }
+func Errorf(t TestingT, err error, msg string, args ...interface{}) {
+ if !assert.Errorf(t, err, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Exactly asserts that two objects are equal in value and type.
+//
+// assert.Exactly(t, int32(123), int64(123))
+func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
+ if !assert.Exactly(t, expected, actual, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Exactlyf asserts that two objects are equal in value and type.
+//
+// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
+func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ if !assert.Exactlyf(t, expected, actual, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Fail reports a failure through
+func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
+ if !assert.Fail(t, failureMessage, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// FailNow fails test
+func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
+ if !assert.FailNow(t, failureMessage, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// FailNowf fails test
+func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) {
+ if !assert.FailNowf(t, failureMessage, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Failf reports a failure through
+func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) {
+ if !assert.Failf(t, failureMessage, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// False asserts that the specified value is false.
+//
+// assert.False(t, myBool)
+func False(t TestingT, value bool, msgAndArgs ...interface{}) {
+ if !assert.False(t, value, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Falsef asserts that the specified value is false.
+//
+// assert.Falsef(t, myBool, "error message %s", "formatted")
+func Falsef(t TestingT, value bool, msg string, args ...interface{}) {
+ if !assert.Falsef(t, value, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func FileExists(t TestingT, path string, msgAndArgs ...interface{}) {
+ if !assert.FileExists(t, path, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func FileExistsf(t TestingT, path string, msg string, args ...interface{}) {
+ if !assert.FileExistsf(t, path, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// HTTPBodyContains asserts that a specified handler returns a
+// body that contains a string.
+//
+// assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
+ if !assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// HTTPBodyContainsf asserts that a specified handler returns a
+// body that contains a string.
+//
+// assert.HTTPBodyContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
+ if !assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// HTTPBodyNotContains asserts that a specified handler returns a
+// body that does not contain a string.
+//
+// assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
+ if !assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// HTTPBodyNotContainsf asserts that a specified handler returns a
+// body that does not contain a string.
+//
+// assert.HTTPBodyNotContainsf(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
+ if !assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// HTTPError asserts that a specified handler returns an error status code.
+//
+// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ if !assert.HTTPError(t, handler, method, url, values, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// HTTPErrorf asserts that a specified handler returns an error status code.
+//
+// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ if !assert.HTTPErrorf(t, handler, method, url, values, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// HTTPRedirect asserts that a specified handler returns a redirect status code.
+//
+// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ if !assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// HTTPRedirectf asserts that a specified handler returns a redirect status code.
+//
+// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ if !assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// HTTPSuccess asserts that a specified handler returns a success status code.
+//
+// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ if !assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// HTTPSuccessf asserts that a specified handler returns a success status code.
+//
+// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ if !assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Implements asserts that an object is implemented by the specified interface.
+//
+// assert.Implements(t, (*MyInterface)(nil), new(MyObject))
+func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
+ if !assert.Implements(t, interfaceObject, object, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Implementsf asserts that an object is implemented by the specified interface.
+//
+// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
+func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
+ if !assert.Implementsf(t, interfaceObject, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// InDelta asserts that the two numerals are within delta of each other.
+//
+// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)
+func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
+ if !assert.InDelta(t, expected, actual, delta, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
+ if !assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ if !assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// InDeltaSlice is the same as InDelta, except it compares two slices.
+func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
+ if !assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// InDeltaSlicef is the same as InDelta, except it compares two slices.
+func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ if !assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// InDeltaf asserts that the two numerals are within delta of each other.
+//
+// assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
+func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ if !assert.InDeltaf(t, expected, actual, delta, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// InEpsilon asserts that expected and actual have a relative error less than epsilon
+func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
+ if !assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
+func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
+ if !assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
+func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
+ if !assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// InEpsilonf asserts that expected and actual have a relative error less than epsilon
+func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
+ if !assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// IsType asserts that the specified objects are of the same type.
+func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
+ if !assert.IsType(t, expectedType, object, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// IsTypef asserts that the specified objects are of the same type.
+func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) {
+ if !assert.IsTypef(t, expectedType, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// JSONEq asserts that two JSON strings are equivalent.
+//
+// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
+func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {
+ if !assert.JSONEq(t, expected, actual, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// JSONEqf asserts that two JSON strings are equivalent.
+//
+// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
+func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {
+ if !assert.JSONEqf(t, expected, actual, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Len asserts that the specified object has specific length.
+// Len also fails if the object has a type that len() not accept.
+//
+// assert.Len(t, mySlice, 3)
+func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) {
+ if !assert.Len(t, object, length, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Lenf asserts that the specified object has specific length.
+// Lenf also fails if the object has a type that len() not accept.
+//
+// assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
+func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) {
+ if !assert.Lenf(t, object, length, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Nil asserts that the specified object is nil.
+//
+// assert.Nil(t, err)
+func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
+ if !assert.Nil(t, object, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Nilf asserts that the specified object is nil.
+//
+// assert.Nilf(t, err, "error message %s", "formatted")
+func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) {
+ if !assert.Nilf(t, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NoError asserts that a function returned no error (i.e. `nil`).
+//
+// actualObj, err := SomeFunction()
+// if assert.NoError(t, err) {
+// assert.Equal(t, expectedObj, actualObj)
+// }
+func NoError(t TestingT, err error, msgAndArgs ...interface{}) {
+ if !assert.NoError(t, err, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// NoErrorf asserts that a function returned no error (i.e. `nil`).
+//
+// actualObj, err := SomeFunction()
+// if assert.NoErrorf(t, err, "error message %s", "formatted") {
+// assert.Equal(t, expectedObj, actualObj)
+// }
+func NoErrorf(t TestingT, err error, msg string, args ...interface{}) {
+ if !assert.NoErrorf(t, err, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
+// specified substring or element.
+//
+// assert.NotContains(t, "Hello World", "Earth")
+// assert.NotContains(t, ["Hello", "World"], "Earth")
+// assert.NotContains(t, {"Hello": "World"}, "Earth")
+func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
+ if !assert.NotContains(t, s, contains, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
+// specified substring or element.
+//
+// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
+// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
+// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
+func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
+ if !assert.NotContainsf(t, s, contains, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
+// a slice or a channel with len == 0.
+//
+// if assert.NotEmpty(t, obj) {
+// assert.Equal(t, "two", obj[1])
+// }
+func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
+ if !assert.NotEmpty(t, object, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
+// a slice or a channel with len == 0.
+//
+// if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
+// assert.Equal(t, "two", obj[1])
+// }
+func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
+ if !assert.NotEmptyf(t, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotEqual asserts that the specified values are NOT equal.
+//
+// assert.NotEqual(t, obj1, obj2)
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses).
+func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
+ if !assert.NotEqual(t, expected, actual, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// NotEqualf asserts that the specified values are NOT equal.
+//
+// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses).
+func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ if !assert.NotEqualf(t, expected, actual, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotNil asserts that the specified object is not nil.
+//
+// assert.NotNil(t, err)
+func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
+ if !assert.NotNil(t, object, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// NotNilf asserts that the specified object is not nil.
+//
+// assert.NotNilf(t, err, "error message %s", "formatted")
+func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) {
+ if !assert.NotNilf(t, object, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
+//
+// assert.NotPanics(t, func(){ RemainCalm() })
+func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
+ if !assert.NotPanics(t, f, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
+//
+// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
+func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
+ if !assert.NotPanicsf(t, f, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotRegexp asserts that a specified regexp does not match a string.
+//
+// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
+// assert.NotRegexp(t, "^start", "it's not starting")
+func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
+ if !assert.NotRegexp(t, rx, str, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// NotRegexpf asserts that a specified regexp does not match a string.
+//
+// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
+// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
+func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
+ if !assert.NotRegexpf(t, rx, str, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotSubset asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
+func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
+ if !assert.NotSubset(t, list, subset, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// NotSubsetf asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
+func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
+ if !assert.NotSubsetf(t, list, subset, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// NotZero asserts that i is not the zero value for its type.
+func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
+ if !assert.NotZero(t, i, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// NotZerof asserts that i is not the zero value for its type.
+func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) {
+ if !assert.NotZerof(t, i, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Panics asserts that the code inside the specified PanicTestFunc panics.
+//
+// assert.Panics(t, func(){ GoCrazy() })
+func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
+ if !assert.Panics(t, f, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
+//
+// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
+func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
+ if !assert.PanicsWithValue(t, expected, f, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
+//
+// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
+func PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {
+ if !assert.PanicsWithValuef(t, expected, f, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Panicsf asserts that the code inside the specified PanicTestFunc panics.
+//
+// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
+func Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
+ if !assert.Panicsf(t, f, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Regexp asserts that a specified regexp matches a string.
+//
+// assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
+// assert.Regexp(t, "start...$", "it's not starting")
+func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
+ if !assert.Regexp(t, rx, str, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Regexpf asserts that a specified regexp matches a string.
+//
+// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
+// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
+func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
+ if !assert.Regexpf(t, rx, str, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Subset asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
+//
+// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
+func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
+ if !assert.Subset(t, list, subset, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Subsetf asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
+//
+// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
+func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
+ if !assert.Subsetf(t, list, subset, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// True asserts that the specified value is true.
+//
+// assert.True(t, myBool)
+func True(t TestingT, value bool, msgAndArgs ...interface{}) {
+ if !assert.True(t, value, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Truef asserts that the specified value is true.
+//
+// assert.Truef(t, myBool, "error message %s", "formatted")
+func Truef(t TestingT, value bool, msg string, args ...interface{}) {
+ if !assert.Truef(t, value, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// WithinDuration asserts that the two times are within duration delta of each other.
+//
+// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
+func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
+ if !assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// WithinDurationf asserts that the two times are within duration delta of each other.
+//
+// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
+func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {
+ if !assert.WithinDurationf(t, expected, actual, delta, msg, args...) {
+ t.FailNow()
+ }
+}
+
+// Zero asserts that i is the zero value for its type.
+func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
+ if !assert.Zero(t, i, msgAndArgs...) {
+ t.FailNow()
+ }
+}
+
+// Zerof asserts that i is the zero value for its type.
+func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) {
+ if !assert.Zerof(t, i, msg, args...) {
+ t.FailNow()
+ }
+}
diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go
new file mode 100644
index 0000000000..299ceb95ad
--- /dev/null
+++ b/vendor/github.com/stretchr/testify/require/require_forward.go
@@ -0,0 +1,687 @@
+/*
+* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
+* THIS FILE MUST NOT BE EDITED BY HAND
+ */
+
+package require
+
+import (
+ assert "github.com/stretchr/testify/assert"
+ http "net/http"
+ url "net/url"
+ time "time"
+)
+
+// Condition uses a Comparison to assert a complex condition.
+func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) {
+ Condition(a.t, comp, msgAndArgs...)
+}
+
+// Conditionf uses a Comparison to assert a complex condition.
+func (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) {
+ Conditionf(a.t, comp, msg, args...)
+}
+
+// Contains asserts that the specified string, list(array, slice...) or map contains the
+// specified substring or element.
+//
+// a.Contains("Hello World", "World")
+// a.Contains(["Hello", "World"], "World")
+// a.Contains({"Hello": "World"}, "Hello")
+func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
+ Contains(a.t, s, contains, msgAndArgs...)
+}
+
+// Containsf asserts that the specified string, list(array, slice...) or map contains the
+// specified substring or element.
+//
+// a.Containsf("Hello World", "World", "error message %s", "formatted")
+// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
+// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
+func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) {
+ Containsf(a.t, s, contains, msg, args...)
+}
+
+// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) {
+ DirExists(a.t, path, msgAndArgs...)
+}
+
+// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
+func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) {
+ DirExistsf(a.t, path, msg, args...)
+}
+
+// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])
+func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
+ ElementsMatch(a.t, listA, listB, msgAndArgs...)
+}
+
+// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
+// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
+// the number of appearances of each of them in both lists should match.
+//
+// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
+func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) {
+ ElementsMatchf(a.t, listA, listB, msg, args...)
+}
+
+// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
+// a slice or a channel with len == 0.
+//
+// a.Empty(obj)
+func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) {
+ Empty(a.t, object, msgAndArgs...)
+}
+
+// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
+// a slice or a channel with len == 0.
+//
+// a.Emptyf(obj, "error message %s", "formatted")
+func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) {
+ Emptyf(a.t, object, msg, args...)
+}
+
+// Equal asserts that two objects are equal.
+//
+// a.Equal(123, 123)
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
+func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
+ Equal(a.t, expected, actual, msgAndArgs...)
+}
+
+// EqualError asserts that a function returned an error (i.e. not `nil`)
+// and that it is equal to the provided error.
+//
+// actualObj, err := SomeFunction()
+// a.EqualError(err, expectedErrorString)
+func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) {
+ EqualError(a.t, theError, errString, msgAndArgs...)
+}
+
+// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
+// and that it is equal to the provided error.
+//
+// actualObj, err := SomeFunction()
+// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
+func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) {
+ EqualErrorf(a.t, theError, errString, msg, args...)
+}
+
+// EqualValues asserts that two objects are equal or convertable to the same types
+// and equal.
+//
+// a.EqualValues(uint32(123), int32(123))
+func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
+ EqualValues(a.t, expected, actual, msgAndArgs...)
+}
+
+// EqualValuesf asserts that two objects are equal or convertable to the same types
+// and equal.
+//
+// a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123))
+func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ EqualValuesf(a.t, expected, actual, msg, args...)
+}
+
+// Equalf asserts that two objects are equal.
+//
+// a.Equalf(123, 123, "error message %s", "formatted")
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses). Function equality
+// cannot be determined and will always fail.
+func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ Equalf(a.t, expected, actual, msg, args...)
+}
+
+// Error asserts that a function returned an error (i.e. not `nil`).
+//
+// actualObj, err := SomeFunction()
+// if a.Error(err) {
+// assert.Equal(t, expectedError, err)
+// }
+func (a *Assertions) Error(err error, msgAndArgs ...interface{}) {
+ Error(a.t, err, msgAndArgs...)
+}
+
+// Errorf asserts that a function returned an error (i.e. not `nil`).
+//
+// actualObj, err := SomeFunction()
+// if a.Errorf(err, "error message %s", "formatted") {
+// assert.Equal(t, expectedErrorf, err)
+// }
+func (a *Assertions) Errorf(err error, msg string, args ...interface{}) {
+ Errorf(a.t, err, msg, args...)
+}
+
+// Exactly asserts that two objects are equal in value and type.
+//
+// a.Exactly(int32(123), int64(123))
+func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
+ Exactly(a.t, expected, actual, msgAndArgs...)
+}
+
+// Exactlyf asserts that two objects are equal in value and type.
+//
+// a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123))
+func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ Exactlyf(a.t, expected, actual, msg, args...)
+}
+
+// Fail reports a failure through
+func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) {
+ Fail(a.t, failureMessage, msgAndArgs...)
+}
+
+// FailNow fails test
+func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) {
+ FailNow(a.t, failureMessage, msgAndArgs...)
+}
+
+// FailNowf fails test
+func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) {
+ FailNowf(a.t, failureMessage, msg, args...)
+}
+
+// Failf reports a failure through
+func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) {
+ Failf(a.t, failureMessage, msg, args...)
+}
+
+// False asserts that the specified value is false.
+//
+// a.False(myBool)
+func (a *Assertions) False(value bool, msgAndArgs ...interface{}) {
+ False(a.t, value, msgAndArgs...)
+}
+
+// Falsef asserts that the specified value is false.
+//
+// a.Falsef(myBool, "error message %s", "formatted")
+func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) {
+ Falsef(a.t, value, msg, args...)
+}
+
+// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) {
+ FileExists(a.t, path, msgAndArgs...)
+}
+
+// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
+func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) {
+ FileExistsf(a.t, path, msg, args...)
+}
+
+// HTTPBodyContains asserts that a specified handler returns a
+// body that contains a string.
+//
+// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
+ HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)
+}
+
+// HTTPBodyContainsf asserts that a specified handler returns a
+// body that contains a string.
+//
+// a.HTTPBodyContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
+ HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)
+}
+
+// HTTPBodyNotContains asserts that a specified handler returns a
+// body that does not contain a string.
+//
+// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
+ HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)
+}
+
+// HTTPBodyNotContainsf asserts that a specified handler returns a
+// body that does not contain a string.
+//
+// a.HTTPBodyNotContainsf(myHandler, "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
+ HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)
+}
+
+// HTTPError asserts that a specified handler returns an error status code.
+//
+// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ HTTPError(a.t, handler, method, url, values, msgAndArgs...)
+}
+
+// HTTPErrorf asserts that a specified handler returns an error status code.
+//
+// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ HTTPErrorf(a.t, handler, method, url, values, msg, args...)
+}
+
+// HTTPRedirect asserts that a specified handler returns a redirect status code.
+//
+// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)
+}
+
+// HTTPRedirectf asserts that a specified handler returns a redirect status code.
+//
+// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
+//
+// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
+func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ HTTPRedirectf(a.t, handler, method, url, values, msg, args...)
+}
+
+// HTTPSuccess asserts that a specified handler returns a success status code.
+//
+// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
+ HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)
+}
+
+// HTTPSuccessf asserts that a specified handler returns a success status code.
+//
+// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
+//
+// Returns whether the assertion was successful (true) or not (false).
+func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
+ HTTPSuccessf(a.t, handler, method, url, values, msg, args...)
+}
+
+// Implements asserts that an object is implemented by the specified interface.
+//
+// a.Implements((*MyInterface)(nil), new(MyObject))
+func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
+ Implements(a.t, interfaceObject, object, msgAndArgs...)
+}
+
+// Implementsf asserts that an object is implemented by the specified interface.
+//
+// a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
+func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
+ Implementsf(a.t, interfaceObject, object, msg, args...)
+}
+
+// InDelta asserts that the two numerals are within delta of each other.
+//
+// a.InDelta(math.Pi, (22 / 7.0), 0.01)
+func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
+ InDelta(a.t, expected, actual, delta, msgAndArgs...)
+}
+
+// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
+ InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)
+}
+
+// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
+func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)
+}
+
+// InDeltaSlice is the same as InDelta, except it compares two slices.
+func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
+ InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)
+}
+
+// InDeltaSlicef is the same as InDelta, except it compares two slices.
+func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ InDeltaSlicef(a.t, expected, actual, delta, msg, args...)
+}
+
+// InDeltaf asserts that the two numerals are within delta of each other.
+//
+// a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
+func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
+ InDeltaf(a.t, expected, actual, delta, msg, args...)
+}
+
+// InEpsilon asserts that expected and actual have a relative error less than epsilon
+func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
+ InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
+}
+
+// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
+func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
+ InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)
+}
+
+// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
+func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
+ InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)
+}
+
+// InEpsilonf asserts that expected and actual have a relative error less than epsilon
+func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
+ InEpsilonf(a.t, expected, actual, epsilon, msg, args...)
+}
+
+// IsType asserts that the specified objects are of the same type.
+func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
+ IsType(a.t, expectedType, object, msgAndArgs...)
+}
+
+// IsTypef asserts that the specified objects are of the same type.
+func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) {
+ IsTypef(a.t, expectedType, object, msg, args...)
+}
+
+// JSONEq asserts that two JSON strings are equivalent.
+//
+// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
+func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) {
+ JSONEq(a.t, expected, actual, msgAndArgs...)
+}
+
+// JSONEqf asserts that two JSON strings are equivalent.
+//
+// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
+func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) {
+ JSONEqf(a.t, expected, actual, msg, args...)
+}
+
+// Len asserts that the specified object has specific length.
+// Len also fails if the object has a type that len() not accept.
+//
+// a.Len(mySlice, 3)
+func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) {
+ Len(a.t, object, length, msgAndArgs...)
+}
+
+// Lenf asserts that the specified object has specific length.
+// Lenf also fails if the object has a type that len() not accept.
+//
+// a.Lenf(mySlice, 3, "error message %s", "formatted")
+func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) {
+ Lenf(a.t, object, length, msg, args...)
+}
+
+// Nil asserts that the specified object is nil.
+//
+// a.Nil(err)
+func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) {
+ Nil(a.t, object, msgAndArgs...)
+}
+
+// Nilf asserts that the specified object is nil.
+//
+// a.Nilf(err, "error message %s", "formatted")
+func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) {
+ Nilf(a.t, object, msg, args...)
+}
+
+// NoError asserts that a function returned no error (i.e. `nil`).
+//
+// actualObj, err := SomeFunction()
+// if a.NoError(err) {
+// assert.Equal(t, expectedObj, actualObj)
+// }
+func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) {
+ NoError(a.t, err, msgAndArgs...)
+}
+
+// NoErrorf asserts that a function returned no error (i.e. `nil`).
+//
+// actualObj, err := SomeFunction()
+// if a.NoErrorf(err, "error message %s", "formatted") {
+// assert.Equal(t, expectedObj, actualObj)
+// }
+func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) {
+ NoErrorf(a.t, err, msg, args...)
+}
+
+// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
+// specified substring or element.
+//
+// a.NotContains("Hello World", "Earth")
+// a.NotContains(["Hello", "World"], "Earth")
+// a.NotContains({"Hello": "World"}, "Earth")
+func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
+ NotContains(a.t, s, contains, msgAndArgs...)
+}
+
+// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
+// specified substring or element.
+//
+// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
+// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
+// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
+func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) {
+ NotContainsf(a.t, s, contains, msg, args...)
+}
+
+// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
+// a slice or a channel with len == 0.
+//
+// if a.NotEmpty(obj) {
+// assert.Equal(t, "two", obj[1])
+// }
+func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) {
+ NotEmpty(a.t, object, msgAndArgs...)
+}
+
+// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
+// a slice or a channel with len == 0.
+//
+// if a.NotEmptyf(obj, "error message %s", "formatted") {
+// assert.Equal(t, "two", obj[1])
+// }
+func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) {
+ NotEmptyf(a.t, object, msg, args...)
+}
+
+// NotEqual asserts that the specified values are NOT equal.
+//
+// a.NotEqual(obj1, obj2)
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses).
+func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
+ NotEqual(a.t, expected, actual, msgAndArgs...)
+}
+
+// NotEqualf asserts that the specified values are NOT equal.
+//
+// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
+//
+// Pointer variable equality is determined based on the equality of the
+// referenced values (as opposed to the memory addresses).
+func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
+ NotEqualf(a.t, expected, actual, msg, args...)
+}
+
+// NotNil asserts that the specified object is not nil.
+//
+// a.NotNil(err)
+func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) {
+ NotNil(a.t, object, msgAndArgs...)
+}
+
+// NotNilf asserts that the specified object is not nil.
+//
+// a.NotNilf(err, "error message %s", "formatted")
+func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) {
+ NotNilf(a.t, object, msg, args...)
+}
+
+// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
+//
+// a.NotPanics(func(){ RemainCalm() })
+func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
+ NotPanics(a.t, f, msgAndArgs...)
+}
+
+// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
+//
+// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
+func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {
+ NotPanicsf(a.t, f, msg, args...)
+}
+
+// NotRegexp asserts that a specified regexp does not match a string.
+//
+// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
+// a.NotRegexp("^start", "it's not starting")
+func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
+ NotRegexp(a.t, rx, str, msgAndArgs...)
+}
+
+// NotRegexpf asserts that a specified regexp does not match a string.
+//
+// a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
+// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
+func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
+ NotRegexpf(a.t, rx, str, msg, args...)
+}
+
+// NotSubset asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
+func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {
+ NotSubset(a.t, list, subset, msgAndArgs...)
+}
+
+// NotSubsetf asserts that the specified list(array, slice...) contains not all
+// elements given in the specified subset(array, slice...).
+//
+// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
+func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {
+ NotSubsetf(a.t, list, subset, msg, args...)
+}
+
+// NotZero asserts that i is not the zero value for its type.
+func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) {
+ NotZero(a.t, i, msgAndArgs...)
+}
+
+// NotZerof asserts that i is not the zero value for its type.
+func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) {
+ NotZerof(a.t, i, msg, args...)
+}
+
+// Panics asserts that the code inside the specified PanicTestFunc panics.
+//
+// a.Panics(func(){ GoCrazy() })
+func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
+ Panics(a.t, f, msgAndArgs...)
+}
+
+// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
+//
+// a.PanicsWithValue("crazy error", func(){ GoCrazy() })
+func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
+ PanicsWithValue(a.t, expected, f, msgAndArgs...)
+}
+
+// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
+// the recovered panic value equals the expected panic value.
+//
+// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
+func (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {
+ PanicsWithValuef(a.t, expected, f, msg, args...)
+}
+
+// Panicsf asserts that the code inside the specified PanicTestFunc panics.
+//
+// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
+func (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {
+ Panicsf(a.t, f, msg, args...)
+}
+
+// Regexp asserts that a specified regexp matches a string.
+//
+// a.Regexp(regexp.MustCompile("start"), "it's starting")
+// a.Regexp("start...$", "it's not starting")
+func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
+ Regexp(a.t, rx, str, msgAndArgs...)
+}
+
+// Regexpf asserts that a specified regexp matches a string.
+//
+// a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
+// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
+func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
+ Regexpf(a.t, rx, str, msg, args...)
+}
+
+// Subset asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
+//
+// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
+func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {
+ Subset(a.t, list, subset, msgAndArgs...)
+}
+
+// Subsetf asserts that the specified list(array, slice...) contains all
+// elements given in the specified subset(array, slice...).
+//
+// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
+func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {
+ Subsetf(a.t, list, subset, msg, args...)
+}
+
+// True asserts that the specified value is true.
+//
+// a.True(myBool)
+func (a *Assertions) True(value bool, msgAndArgs ...interface{}) {
+ True(a.t, value, msgAndArgs...)
+}
+
+// Truef asserts that the specified value is true.
+//
+// a.Truef(myBool, "error message %s", "formatted")
+func (a *Assertions) Truef(value bool, msg string, args ...interface{}) {
+ Truef(a.t, value, msg, args...)
+}
+
+// WithinDuration asserts that the two times are within duration delta of each other.
+//
+// a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
+func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
+ WithinDuration(a.t, expected, actual, delta, msgAndArgs...)
+}
+
+// WithinDurationf asserts that the two times are within duration delta of each other.
+//
+// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
+func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {
+ WithinDurationf(a.t, expected, actual, delta, msg, args...)
+}
+
+// Zero asserts that i is the zero value for its type.
+func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) {
+ Zero(a.t, i, msgAndArgs...)
+}
+
+// Zerof asserts that i is the zero value for its type.
+func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) {
+ Zerof(a.t, i, msg, args...)
+}
diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go
new file mode 100644
index 0000000000..e404f016d1
--- /dev/null
+++ b/vendor/github.com/stretchr/testify/require/requirements.go
@@ -0,0 +1,9 @@
+package require
+
+// TestingT is an interface wrapper around *testing.T
+type TestingT interface {
+ Errorf(format string, args ...interface{})
+ FailNow()
+}
+
+//go:generate go run ../_codegen/main.go -output-package=require -template=require.go.tmpl -include-format-funcs