-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demonstrate the error that occurs when pushing a commit with a bad date
- Loading branch information
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,14 @@ committer Spokes Receive Pack <[email protected]> 1234567890 +0000 | |
This commit object intentionally broken | ||
` | ||
|
||
var suiteDir string = func() string { | ||
pwd, err := os.Getwd() | ||
if err != nil { | ||
panic(err) | ||
} | ||
return pwd | ||
}() | ||
|
||
type SpokesReceivePackTestSuite struct { | ||
suite.Suite | ||
localRepo, remoteRepo string | ||
|
@@ -181,6 +189,15 @@ func (suite *SpokesReceivePackTestSuite) TestSpokesReceivePackHiddenRefs() { | |
"should partially fail") | ||
} | ||
|
||
func (suite *SpokesReceivePackTestSuite) TestBadDate() { | ||
cmd := exec.Command("git", "-C", filepath.Join(suiteDir, "testdata/bad-date/sha1.git"), | ||
"push", "--receive-pack=spokes-receive-pack-wrapper", suite.remoteRepo, "main") | ||
out, err := cmd.CombinedOutput() | ||
suite.T().Logf("$ git %s\n%s", strings.Join(cmd.Args, " "), out) | ||
assert.Error(suite.T(), err, "expect an error a repo with a malformed committer line in a commit") | ||
assert.Contains(suite.T(), string(out), " badDate:", "should complain about a bad date") | ||
} | ||
|
||
func (suite *SpokesReceivePackTestSuite) TestWithGovernor() { | ||
started := make(chan any) | ||
govSock, msgs, cleanup := startFakeGovernor(suite.T(), started, nil) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This file has a subset of options from our prod /etc/gitconfig. | ||
|
||
[receive] | ||
fsckObjects = true |