Skip to content

Commit 3c5b69c

Browse files
Merge branch 'feat/allow-empty-commits' of https://github.com/prefapp/gh-commit into feat/allow-empty-commits
2 parents f9079ed + 513dcba commit 3c5b69c

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

git/git.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,20 @@ func UploadToRepo(
203203
if (len(addedAndUpdatedFiles) == 0 && len(deletedFiles) == 0 && *allowEmpty) || *createEmpty {
204204
// In order to push an empty commit, we first need to create a
205205
// dummy file and commit it to the branch
206-
fileName := fmt.Sprintf("%x", sha256.Sum256(
207-
[]byte("firestartr-empty-commit-dummy.txt"),
208-
))
209-
dummy, err := os.Create(fileName)
206+
dummy, err := os.CreateTemp("", "firestartr-empty-commit-dummy-*.txt")
210207
if err != nil {
211208
return nil, nil, err
212209
}
213-
defer dummy.Close()
210+
defer func() {
211+
dummy.Close()
212+
os.Remove(dummy.Name())
213+
}()
214+
fileName := dummy.Name()
214215

215216
blob, _, err := createBlobForFile(ctx, client, repo, fileName)
217+
if err != nil {
218+
return nil, nil, err
219+
}
216220
tree, _, err := createNewTree(
217221
ctx,
218222
client,

0 commit comments

Comments
 (0)