Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7611da7

Browse files
committed
git: worktree, Fix tests affected by changed Commit method.
1 parent10a110e commit7611da7

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

‎repository_test.go‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ func createCommit(c *C, r *Repository) plumbing.Hash {
103103
}
104104

105105
h,err:=wt.Commit("test commit message",&CommitOptions{
106-
All:true,
107-
Author:&author,
108-
Committer:&author,
106+
All:true,
107+
Author:&author,
108+
Committer:&author,
109+
AllowEmptyCommits:true,
109110
})
110111
c.Assert(err,IsNil)
111112
returnh

‎worktree_commit_test.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ func (s *WorktreeSuite) TestAddAndCommitWithSkipStatusPathNotModified(c *C) {
365365
c.Assert(foo.Worktree,Equals,Untracked)
366366

367367
hash,err=w.Commit("commit with no changes\n",&CommitOptions{
368-
Author:defaultSignature(),
368+
Author:defaultSignature(),
369+
AllowEmptyCommits:true,
369370
})
370371
c.Assert(hash,Equals,expected2)
371372
c.Assert(err,IsNil)

‎worktree_test.go‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ func (s *WorktreeSuite) TestPullFastForward(c *C) {
8888

8989
w,err:=server.Worktree()
9090
c.Assert(err,IsNil)
91-
err=os.WriteFile(filepath.Join(path,"foo"), []byte("foo"),0755)
91+
err=os.WriteFile(filepath.Join(url,"foo"), []byte("foo"),0755)
9292
c.Assert(err,IsNil)
93+
w.Add("foo")
9394
hash,err:=w.Commit("foo",&CommitOptions{Author:defaultSignature()})
9495
c.Assert(err,IsNil)
9596

@@ -125,15 +126,17 @@ func (s *WorktreeSuite) TestPullNonFastForward(c *C) {
125126

126127
w,err:=server.Worktree()
127128
c.Assert(err,IsNil)
128-
err=os.WriteFile(filepath.Join(path,"foo"), []byte("foo"),0755)
129+
err=os.WriteFile(filepath.Join(url,"foo"), []byte("foo"),0755)
129130
c.Assert(err,IsNil)
131+
w.Add("foo")
130132
_,err=w.Commit("foo",&CommitOptions{Author:defaultSignature()})
131133
c.Assert(err,IsNil)
132134

133135
w,err=r.Worktree()
134136
c.Assert(err,IsNil)
135-
err=os.WriteFile(filepath.Join(path,"bar"), []byte("bar"),0755)
137+
err=os.WriteFile(filepath.Join(dir,"bar"), []byte("bar"),0755)
136138
c.Assert(err,IsNil)
139+
w.Add("bar")
137140
_,err=w.Commit("bar",&CommitOptions{Author:defaultSignature()})
138141
c.Assert(err,IsNil)
139142

@@ -286,16 +289,18 @@ func (s *RepositorySuite) TestPullAdd(c *C) {
286289
func (s*WorktreeSuite)TestPullAlreadyUptodate(c*C) {
287290
path:=fixtures.Basic().ByTag("worktree").One().Worktree().Root()
288291

289-
r,err:=Clone(memory.NewStorage(),memfs.New(),&CloneOptions{
292+
fs:=memfs.New()
293+
r,err:=Clone(memory.NewStorage(),fs,&CloneOptions{
290294
URL:filepath.Join(path,".git"),
291295
})
292296

293297
c.Assert(err,IsNil)
294298

295299
w,err:=r.Worktree()
296300
c.Assert(err,IsNil)
297-
err=os.WriteFile(filepath.Join(path,"bar"), []byte("bar"),0755)
301+
util.WriteFile(fs,"bar", []byte("bar"),0755)
298302
c.Assert(err,IsNil)
303+
w.Add("bar")
299304
_,err=w.Commit("bar",&CommitOptions{Author:defaultSignature()})
300305
c.Assert(err,IsNil)
301306

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp