repo_name
stringclasses 2
values | pr_number
int64 2.62k
123k
| pr_title
stringlengths 8
193
| pr_description
stringlengths 0
27.9k
| author
stringlengths 3
23
| date_created
unknown | date_merged
unknown | previous_commit
stringlengths 40
40
| pr_commit
stringlengths 40
40
| query
stringlengths 21
28k
| filepath
stringlengths 7
174
| before_content
stringlengths 0
554M
| after_content
stringlengths 0
554M
| label
int64 -1
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gohugoio/hugo | 8,150 | build(deps): bump github.com/spf13/afero from 1.4.1 to 1.5.1 | Signed-off-by: Robert-André Mauchin <[email protected]> | eclipseo | "2021-01-18T01:52:30Z" | "2021-01-19T16:25:21Z" | 2c8b5d9165011c4b24b494e661ae60dfc7bb7d1b | 07ad283f686904e5835f621d73ed342ba2a48eb3 | build(deps): bump github.com/spf13/afero from 1.4.1 to 1.5.1. Signed-off-by: Robert-André Mauchin <[email protected]> | ./common/para/para_test.go | // Copyright 2019 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package para
import (
"context"
"runtime"
"sort"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/gohugoio/hugo/htesting"
qt "github.com/frankban/quicktest"
)
func TestPara(t *testing.T) {
if runtime.NumCPU() < 4 {
t.Skipf("skip para test, CPU count is %d", runtime.NumCPU())
}
if !htesting.IsCI() {
t.Skip("skip para test when not running on CI")
}
c := qt.New(t)
c.Run("Order", func(c *qt.C) {
n := 500
ints := make([]int, n)
for i := 0; i < n; i++ {
ints[i] = i
}
p := New(4)
r, _ := p.Start(context.Background())
var result []int
var mu sync.Mutex
for i := 0; i < n; i++ {
i := i
r.Run(func() error {
mu.Lock()
defer mu.Unlock()
result = append(result, i)
return nil
})
}
c.Assert(r.Wait(), qt.IsNil)
c.Assert(result, qt.HasLen, len(ints))
c.Assert(sort.IntsAreSorted(result), qt.Equals, false, qt.Commentf("Para does not seem to be parallel"))
sort.Ints(result)
c.Assert(result, qt.DeepEquals, ints)
})
c.Run("Time", func(c *qt.C) {
const n = 100
p := New(5)
r, _ := p.Start(context.Background())
start := time.Now()
var counter int64
for i := 0; i < n; i++ {
r.Run(func() error {
atomic.AddInt64(&counter, 1)
time.Sleep(1 * time.Millisecond)
return nil
})
}
c.Assert(r.Wait(), qt.IsNil)
c.Assert(counter, qt.Equals, int64(n))
since := time.Since(start)
limit := n / 2 * time.Millisecond
c.Assert(since < limit, qt.Equals, true, qt.Commentf("%s >= %s", since, limit))
})
}
| // Copyright 2019 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package para
import (
"context"
"runtime"
"sort"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/gohugoio/hugo/htesting"
qt "github.com/frankban/quicktest"
)
func TestPara(t *testing.T) {
if runtime.NumCPU() < 4 {
t.Skipf("skip para test, CPU count is %d", runtime.NumCPU())
}
if !htesting.IsCI() {
t.Skip("skip para test when not running on CI")
}
c := qt.New(t)
c.Run("Order", func(c *qt.C) {
n := 500
ints := make([]int, n)
for i := 0; i < n; i++ {
ints[i] = i
}
p := New(4)
r, _ := p.Start(context.Background())
var result []int
var mu sync.Mutex
for i := 0; i < n; i++ {
i := i
r.Run(func() error {
mu.Lock()
defer mu.Unlock()
result = append(result, i)
return nil
})
}
c.Assert(r.Wait(), qt.IsNil)
c.Assert(result, qt.HasLen, len(ints))
c.Assert(sort.IntsAreSorted(result), qt.Equals, false, qt.Commentf("Para does not seem to be parallel"))
sort.Ints(result)
c.Assert(result, qt.DeepEquals, ints)
})
c.Run("Time", func(c *qt.C) {
const n = 100
p := New(5)
r, _ := p.Start(context.Background())
start := time.Now()
var counter int64
for i := 0; i < n; i++ {
r.Run(func() error {
atomic.AddInt64(&counter, 1)
time.Sleep(1 * time.Millisecond)
return nil
})
}
c.Assert(r.Wait(), qt.IsNil)
c.Assert(counter, qt.Equals, int64(n))
since := time.Since(start)
limit := n / 2 * time.Millisecond
c.Assert(since < limit, qt.Equals, true, qt.Commentf("%s >= %s", since, limit))
})
}
| -1 |
gohugoio/hugo | 8,150 | build(deps): bump github.com/spf13/afero from 1.4.1 to 1.5.1 | Signed-off-by: Robert-André Mauchin <[email protected]> | eclipseo | "2021-01-18T01:52:30Z" | "2021-01-19T16:25:21Z" | 2c8b5d9165011c4b24b494e661ae60dfc7bb7d1b | 07ad283f686904e5835f621d73ed342ba2a48eb3 | build(deps): bump github.com/spf13/afero from 1.4.1 to 1.5.1. Signed-off-by: Robert-André Mauchin <[email protected]> | ./docs/content/en/hugo-modules/configuration.md | ---
title: Configure Modules
linktitle: Configure Modules
description: This page describes the configuration options for a module.
date: 2019-07-24
categories: [hugo modules]
keywords: [themes, source, organization, directories]
menu:
docs:
parent: "modules"
weight: 10
weight: 10
sections_weight: 10
toc: true
---
## Module Config: Top level
{{< code-toggle file="config">}}
[module]
noVendor = ""
proxy = "direct"
noProxy = "none"
private = "*.*"
replacements = ""
{{< /code-toggle >}}
noVendor {{< new-in "0.75.0" >}}
: A optional Glob pattern matching module paths to skip when vendoring, e.g. "github.com/**"
proxy
: Defines the proxy server to use to download remote modules. Default is `direct`, which means "git clone" and similar.
noProxy
: Comma separated glob list matching paths that should not use the proxy configured above.
private
: Comma separated glob list matching paths that should be treated as private.
replacements {{< new-in "0.77.0" >}}
: A comma separated (or a slice) list of module path to directory replacement mapping, e.g. `"github.com/bep/myprettytheme -> ../..,github.com/bep/shortcodes -> /some/path`. This is mostly useful for temporary locally development of a module, and then it makes sense to set it as an OS environment variable, e.g: `env HUGO_MODULE_REPLACEMENTS="github.com/bep/myprettytheme -> ../.."`. Any relative path is relate to [themesDir](https://gohugo.io/getting-started/configuration/#all-configuration-settings), and absolute paths are allowed.
Note that the above terms maps directly to their counterparts in Go Modules. Some of these setting may be natural to set as OS environment variables. To set the proxy server to use, as an example:
```
env HUGO_MODULE_PROXY=https://proxy.example.org hugo
```
{{< gomodules-info >}}
## Module Config: hugoVersion
If your module requires a particular version of Hugo to work, you can indicate that in the `module` section and the user will be warned if using a too old/new version.
{{< code-toggle file="config">}}
[module]
[module.hugoVersion]
min = ""
max = ""
extended = false
{{< /code-toggle >}}
Any of the above can be omitted.
min
: The minimum Hugo version supported, e.g. `0.55.0`
max
: The maximum Hugo version supported, e.g. `0.55.0`
extended
: Whether the extended version of Hugo is required.
## Module Config: imports
{{< code-toggle file="config">}}
[module]
[[module.imports]]
path = "github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v"
ignoreConfig = false
disable = false
[[module.imports]]
path = "my-shortcodes"
{{< /code-toggle >}}
path
: Can be either a valid Go Module module path, e.g. `github.com/gohugoio/myShortcodes`, or the directory name for the module as stored in your themes folder.
ignoreConfig
: If enabled, any module configuration file, e.g. `config.toml`, will not be loaded. Note that this will also stop the loading of any transitive module dependencies.
disable
: Set to `true` to disable the module while keeping any version info in the `go.*` files.
{{< gomodules-info >}}
## Module Config: mounts
{{% note %}}
When the `mounts` config was introduced in Hugo 0.56.0, we were careful to preserve the existing `staticDir` and similar configuration to make sure all existing sites just continued to work. But you should not have both: if you add a `mounts` section you should remove the old `staticDir` etc. settings.
{{% /note %}}
{{% warning %}}
When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it.
{{% /warning %}}
**Default mounts**
{{< code-toggle file="config">}}
[module]
[[module.mounts]]
source="content"
target="content"
[[module.mounts]]
source="static"
target="static"
[[module.mounts]]
source="layouts"
target="layouts"
[[module.mounts]]
source="data"
target="data"
[[module.mounts]]
source="assets"
target="assets"
[[module.mounts]]
source="i18n"
target="i18n"
[[module.mounts]]
source="archetypes"
target="archetypes"
{{< /code-toggle >}}
source
: The source directory of the mount. For the main project, this can be either project-relative or absolute and even a symbolic link. For other modules it must be project-relative.
target
: Where it should be mounted into Hugo's virtual filesystem. It must start with one of Hugo's component folders: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, or `archetypes`. E.g. `content/blog`.
lang
: The language code, e.g. "en". Only relevant for `content` mounts, and `static` mounts when in multihost mode.
| ---
title: Configure Modules
linktitle: Configure Modules
description: This page describes the configuration options for a module.
date: 2019-07-24
categories: [hugo modules]
keywords: [themes, source, organization, directories]
menu:
docs:
parent: "modules"
weight: 10
weight: 10
sections_weight: 10
toc: true
---
## Module Config: Top level
{{< code-toggle file="config">}}
[module]
noVendor = ""
proxy = "direct"
noProxy = "none"
private = "*.*"
replacements = ""
{{< /code-toggle >}}
noVendor {{< new-in "0.75.0" >}}
: A optional Glob pattern matching module paths to skip when vendoring, e.g. "github.com/**"
proxy
: Defines the proxy server to use to download remote modules. Default is `direct`, which means "git clone" and similar.
noProxy
: Comma separated glob list matching paths that should not use the proxy configured above.
private
: Comma separated glob list matching paths that should be treated as private.
replacements {{< new-in "0.77.0" >}}
: A comma separated (or a slice) list of module path to directory replacement mapping, e.g. `"github.com/bep/myprettytheme -> ../..,github.com/bep/shortcodes -> /some/path`. This is mostly useful for temporary locally development of a module, and then it makes sense to set it as an OS environment variable, e.g: `env HUGO_MODULE_REPLACEMENTS="github.com/bep/myprettytheme -> ../.."`. Any relative path is relate to [themesDir](https://gohugo.io/getting-started/configuration/#all-configuration-settings), and absolute paths are allowed.
Note that the above terms maps directly to their counterparts in Go Modules. Some of these setting may be natural to set as OS environment variables. To set the proxy server to use, as an example:
```
env HUGO_MODULE_PROXY=https://proxy.example.org hugo
```
{{< gomodules-info >}}
## Module Config: hugoVersion
If your module requires a particular version of Hugo to work, you can indicate that in the `module` section and the user will be warned if using a too old/new version.
{{< code-toggle file="config">}}
[module]
[module.hugoVersion]
min = ""
max = ""
extended = false
{{< /code-toggle >}}
Any of the above can be omitted.
min
: The minimum Hugo version supported, e.g. `0.55.0`
max
: The maximum Hugo version supported, e.g. `0.55.0`
extended
: Whether the extended version of Hugo is required.
## Module Config: imports
{{< code-toggle file="config">}}
[module]
[[module.imports]]
path = "github.com/gohugoio/hugoTestModules1_linux/modh1_2_1v"
ignoreConfig = false
disable = false
[[module.imports]]
path = "my-shortcodes"
{{< /code-toggle >}}
path
: Can be either a valid Go Module module path, e.g. `github.com/gohugoio/myShortcodes`, or the directory name for the module as stored in your themes folder.
ignoreConfig
: If enabled, any module configuration file, e.g. `config.toml`, will not be loaded. Note that this will also stop the loading of any transitive module dependencies.
disable
: Set to `true` to disable the module while keeping any version info in the `go.*` files.
{{< gomodules-info >}}
## Module Config: mounts
{{% note %}}
When the `mounts` config was introduced in Hugo 0.56.0, we were careful to preserve the existing `staticDir` and similar configuration to make sure all existing sites just continued to work. But you should not have both: if you add a `mounts` section you should remove the old `staticDir` etc. settings.
{{% /note %}}
{{% warning %}}
When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it.
{{% /warning %}}
**Default mounts**
{{< code-toggle file="config">}}
[module]
[[module.mounts]]
source="content"
target="content"
[[module.mounts]]
source="static"
target="static"
[[module.mounts]]
source="layouts"
target="layouts"
[[module.mounts]]
source="data"
target="data"
[[module.mounts]]
source="assets"
target="assets"
[[module.mounts]]
source="i18n"
target="i18n"
[[module.mounts]]
source="archetypes"
target="archetypes"
{{< /code-toggle >}}
source
: The source directory of the mount. For the main project, this can be either project-relative or absolute and even a symbolic link. For other modules it must be project-relative.
target
: Where it should be mounted into Hugo's virtual filesystem. It must start with one of Hugo's component folders: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, or `archetypes`. E.g. `content/blog`.
lang
: The language code, e.g. "en". Only relevant for `content` mounts, and `static` mounts when in multihost mode.
| -1 |
gohugoio/hugo | 8,150 | build(deps): bump github.com/spf13/afero from 1.4.1 to 1.5.1 | Signed-off-by: Robert-André Mauchin <[email protected]> | eclipseo | "2021-01-18T01:52:30Z" | "2021-01-19T16:25:21Z" | 2c8b5d9165011c4b24b494e661ae60dfc7bb7d1b | 07ad283f686904e5835f621d73ed342ba2a48eb3 | build(deps): bump github.com/spf13/afero from 1.4.1 to 1.5.1. Signed-off-by: Robert-André Mauchin <[email protected]> | ./docs/content/en/getting-started/external-learning-resources/hia.jpg |