0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-12 04:51:38 +01:00
gitea/models/db
Jason Song a35714372d
Fix halfCommitter and WithTx (#22366)
Related to #22362.

I overlooked that there's always `committer.Close()`, like:

```go
		ctx, committer, err := db.TxContext(db.DefaultContext)
		if err != nil {
			return nil
		}
		defer committer.Close()

		// ...

		if err != nil {
			return nil
		}

		// ...

		return committer.Commit()
```

So the `Close` of `halfCommitter` should ignore `commit and close`, it's
not a rollback.

See: [Why `halfCommitter` and `WithTx` should rollback IMMEDIATELY or
commit
LATER](https://github.com/go-gitea/gitea/pull/22366#issuecomment-1374778612).

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-01-09 12:19:19 -05:00
..
install Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
paginator Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
common.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
consistency.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
context.go Fix halfCommitter and WithTx (#22366) 2023-01-09 12:19:19 -05:00
context_committer_test.go Fix halfCommitter and WithTx (#22366) 2023-01-09 12:19:19 -05:00
context_test.go Always reuse transaction (#22362) 2023-01-08 09:34:58 +08:00
convert.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
engine.go Update xorm (#22094) 2022-12-10 18:53:32 -05:00
engine_test.go Check primary keys for all tables and drop ForeignReference (#21721) 2022-12-23 19:35:43 +08:00
error.go Always reuse transaction (#22362) 2023-01-08 09:34:58 +08:00
index.go Fix generate index failure possibility on postgres (#21998) 2022-12-02 11:15:36 +08:00
index_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
iterate.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
iterate_test.go Test views of LFS files (#22196) 2022-12-23 07:41:56 +08:00
list_options.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
log.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
main_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
name.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
search.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
sequence.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
sql_postgres_with_schema.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00