Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: github/spokes-receive-pack
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 461b291aa42dcb76c6b5c86a4243ed4cda110400
Choose a base ref
..
head repository: github/spokes-receive-pack
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c39ce1428860f58854119dcf3ad201b6d88a1b79
Choose a head ref
Showing with 20 additions and 1 deletion.
  1. +18 −0 internal/integration/integration_test.go
  2. +2 −1 internal/spokes/spokes.go
18 changes: 18 additions & 0 deletions internal/integration/integration_test.go
Original file line number Diff line number Diff line change
@@ -236,6 +236,7 @@ func (suite *SpokesReceivePackTestSuite) TestSpokesReceivePackAllowedWhenWithImp
assert.NoError(suite.T(), chdir(suite.T(), suite.localRepo), "unable to chdir into our local Git repo")
cmd := exec.Command("git", "push", "--all", "--receive-pack=spokes-receive-pack-wrapper", "r")
cmd.Env = append(os.Environ(),
"GIT_SOCKSTAT_VAR_is_importing=bool:true",
"GIT_SOCKSTAT_VAR_import_skip_push_limit=bool:true",
)
err := cmd.Run()
@@ -245,6 +246,23 @@ func (suite *SpokesReceivePackTestSuite) TestSpokesReceivePackAllowedWhenWithImp
"unexpected failure with the custom spokes-receive-pack program; it should have succeeded")
}

func (suite *SpokesReceivePackTestSuite) TestSpokesReceivePackAllowedWhenImporting() {
assert.NoError(suite.T(), chdir(suite.T(), suite.remoteRepo), "unable to chdir into our remote Git repo")
// Set a really low value to receive.maxsize in order to make it fail
require.NoError(suite.T(), exec.Command("git", "config", "receive.maxsize", "1").Run())

assert.NoError(suite.T(), chdir(suite.T(), suite.localRepo), "unable to chdir into our local Git repo")
cmd := exec.Command("git", "push", "--all", "--receive-pack=spokes-receive-pack-wrapper", "r")
cmd.Env = append(os.Environ(),
"GIT_SOCKSTAT_VAR_is_importing=bool:true",
)
err := cmd.Run()
assert.NoError(
suite.T(),
err,
"unexpected failure with the custom spokes-receive-pack program; it should have succeeded")
}

func (suite *SpokesReceivePackTestSuite) TestWithGovernor() {
started := make(chan any)
govSock, msgs, cleanup := startFakeGovernor(suite.T(), started, nil)
3 changes: 2 additions & 1 deletion internal/spokes/spokes.go
Original file line number Diff line number Diff line change
@@ -960,7 +960,8 @@ func (r *spokesReceivePack) getMaxInputSize() (int, error) {
// If the import has been allow-listed, use a higher limit.
return 80 * 1024 * 1024 * 1024, nil
case isImporting():
// Imports are allowed to push in 40 GiB by default. This setting makes it so that GEI has parity with ECI.
// Imports are allowed to push in 40 GiB by default. This
// setting makes it so that GEI has parity with ECI.
return 40 * 1024 * 1024 * 1024, nil
}