gitforge/modules
forgejo-backport-action 232cd04285 [v16.0/forgejo] fix: don't terminate subprocesses when SSH connection is closed (internal SSH) (#13451)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/13443

Fixes #13440.

## Testing

Manual testing was performed with an automated reproduction.  Attached `main.go` program was used to test go-git interaction with a server using `START_SSH_SERVER = true`.  This test app uses go-git to perform an ssh-based push, which replicates the behaviour described in #13440.  After dropping main.go into an empty directory, the test app can be run with:

```
go mod init repro
go mod tidy
REPRO_REPO_URL=ssh://mfenniak@localhost:2222/mfenniak/test.git go run main.go
```

When the fix is **not** present, the database/repository desync warning is shown after running the test command, which indicates that the hooks were interrupted and did not update the database state of the `main` branch:

![image](/attachments/9efce00c-45fa-408e-ab43-aa308c10b50e)

When this fix **is** present, the database/repository desync warning does not appear, which indicates that the hooks were not interrupted.  Repeated test in both modes 3x times to ensure there were no race conditions involved.

While it would be possible to incorporate this test into Forgejo's integration testing suite, it would require adding a dependency to `go-git`.  As Go doesn't have a concept of test-only dependencies, that would make `go-git` a dependency... which we just recently removed by removing it from Forgejo Runner's jobparser library.  It would make `go-git` available for accidental incorporation into Forgejo's code, where it does not behave the same as Forgejo's internal git CLI libraries.

Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13451
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-07-15 03:46:48 +02:00
..
actions fix: do not try to remove task logs that don't exist (#13040) 2026-06-11 02:03:05 +02:00
activitypub [v16.0/forgejo] federation: protect against SSRF attacks (#13351) 2026-07-08 20:33:12 +02:00
analyze
assetfs
auth feat: add dynamic group mappings for OIDC (#11656) 2026-05-22 12:38:20 +02:00
avatar chore: remove EXIF stripping capability due to usage of AGPL licensed exif-terminator library (#13105) 2026-06-17 16:16:35 +02:00
avatarstore feat: serve downsized versions of avatars (#11242) 2026-05-16 12:04:05 +02:00
base refactor(tests): drop the need to compile gitea binary manually (#12855) 2026-06-02 00:04:50 +02:00
cache feat: cache OIDC metadata & JWKS when read by authorized integration (#12275) 2026-04-28 02:13:06 +02:00
card
charset
container
csv
emoji
eventsource
forgefed chore(federation): re-enable nilnil lint (#11253) 2026-04-13 22:05:29 +02:00
generate chore: unify signing key configuration across modules (#11194) 2026-04-21 19:39:33 +02:00
git [v16.0/forgejo] fix: terminate git (& other) subcommands gracefully on context timeout/cancellation (#13274) 2026-07-01 23:02:08 +02:00
gitrepo
graceful
hcaptcha
highlight fix(ui): show "Shell" instead of "Bash" in headers of shell script files (#12562) 2026-05-14 22:33:51 +02:00
hostmatcher
html
httpcache feat: remove no-transform in Cache-Control header. (#12905) 2026-06-03 05:38:47 +02:00
httplib
indexer Add code search with zoekt support (#8827) 2026-05-28 20:52:34 +02:00
issue/template
json feat: ability to edit authorized integration in web UI (#12601) 2026-05-17 18:33:39 +02:00
jwtx chore: make use of go1.26 features (#12369) 2026-05-01 22:51:48 +02:00
keying
label
lfs feat: enable auth to git LFS via authorized integrations (#12725) 2026-05-28 23:20:58 +02:00
log [v16.0/forgejo] fix: terminate git (& other) subcommands gracefully on context timeout/cancellation (#13274) 2026-07-01 23:02:08 +02:00
markup [v16.0/forgejo] fix: terminate git (& other) subcommands gracefully on context timeout/cancellation (#13274) 2026-07-01 23:02:08 +02:00
mcaptcha
metrics
migration feat: show progress of issues and PRs migrations (#12738) 2026-05-28 00:49:07 +02:00
nosql feat: cache OIDC metadata & JWKS when read by authorized integration (#12275) 2026-04-28 02:13:06 +02:00
optional chore: upgrade to https://code.forgejo.org/xorm/xorm v1.4.0 (#12639) 2026-05-20 20:20:08 +02:00
options
packages [v16.0/forgejo] fix: Update swift package registry to use the metadata schema from the official Swift docs (#13208) 2026-06-27 23:53:43 +02:00
paginator
pprof
private
process [v16.0/forgejo] fix: intermittent test failure in process cancellation (#13302) 2026-07-04 06:06:40 +02:00
proxy
proxyprotocol
public
queue feat: cache OIDC metadata & JWKS when read by authorized integration (#12275) 2026-04-28 02:13:06 +02:00
recaptcha
references
regexplru
repository [v16.0/forgejo] feat: granular settings for watched repo units (#13385) 2026-07-09 20:56:52 +02:00
secret
session
setting [v16.0/forgejo] federation: protect against SSRF attacks (#13351) 2026-07-08 20:33:12 +02:00
sitemap
ssh [v16.0/forgejo] fix: don't terminate subprocesses when SSH connection is closed (internal SSH) (#13451) 2026-07-15 03:46:48 +02:00
storage chore: unify signing key configuration across modules (#11194) 2026-04-21 19:39:33 +02:00
structs fix(api): swagger docs improvement (#13082) 2026-06-13 21:20:26 +02:00
svg
sync
system
templates fix(ui): bring back non-empty check to ThemeName (#13175) 2026-06-23 11:53:17 +02:00
test [v16.0/forgejo] fix: ensure migrations allow/deny host lists are applied to onedev, pagure, and codebase migrators (#13196) 2026-06-25 17:06:17 +02:00
testimport
testlogger
timeutil
translation chore(i18n): May 2026 maintenence (#12718) 2026-05-25 10:59:49 +02:00
turnstile
typesniffer
updatechecker
uri
user
util chore: make use of go1.26 features (#12369) 2026-05-01 22:51:48 +02:00
validation feat: add dynamic group mappings for OIDC (#11656) 2026-05-22 12:38:20 +02:00
web chore(refactor): run routers/api/v1/permissions/tests from tests/integration (#13157) 2026-06-21 21:43:57 +02:00
webhook
zstd