Skip to content

Commit 2a1036d

Browse files
authored
Merge pull request #184 from yitsushi/fix-stash-commit
fix: stash empty commit
2 parents 007d4f5 + ca7a16b commit 2a1036d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

stash/git.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ func (s *GitService) CreateCommit(rPath string, r *git.Repository, branchName st
256256
return nil, err
257257
}
258258

259+
if branchName != "" {
260+
err := s.CreateBranch(branchName, r, "")
261+
if err != nil {
262+
return nil, err
263+
}
264+
}
265+
259266
err = s.addCommitFiles(w, rPath, c.Files)
260267
if err != nil {
261268
return nil, err
@@ -268,13 +275,6 @@ func (s *GitService) CreateCommit(rPath string, r *git.Repository, branchName st
268275
c.Committer.Date = now
269276
}
270277

271-
if branchName != "" {
272-
err := s.CreateBranch(branchName, r, "")
273-
if err != nil {
274-
return nil, err
275-
}
276-
}
277-
278278
obj, err := s.commit(w, r, c)
279279
if err != nil {
280280
return nil, err

0 commit comments

Comments
 (0)