From f3f4ba7d6744d1a63b5c03463d9b08d18ef117cb Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 20 Mar 2025 18:00:24 +0300 Subject: [PATCH 1/7] chore: revert "feat: add CORS headers (#516)" This reverts commit f99cf71fc96dd34791b99b24ae6ba523c8394074. --- README.md | 26 ------------ pkg/config/config.go | 15 ------- pkg/config/config_test.go | 44 -------------------- pkg/web/server.go | 8 ---- testscript/testdata/http-cors.txtar | 64 ----------------------------- 5 files changed, 157 deletions(-) delete mode 100644 testscript/testdata/http-cors.txtar diff --git a/README.md b/README.md index d5bd030a0f82435bd4a8529bacf57ddce76afeb2..cbefcd78454a8727921dd3365f298e54026f3724 100644 --- a/README.md +++ b/README.md @@ -158,32 +158,6 @@ ssh: # This is the address that will be used to clone repositories. public_url: "ssh://localhost:23231" - # The cross-origin request security options - cors: - # The allowed cross-origin headers - allowed_headers: - - Accept - - Accept-Language - - Content-Language - - Origin - # - Content-Type - # - X-Requested-With - # - User-Agent - # - Authorization - # - Access-Control-Request-Method - - # The allowed cross-origin URLs - # allowed_origins: - # - * - - # The allowed cross-origin methods - allowed_methods: - - GET - - HEAD - - POST - # - PUT - # - OPTIONS - # The path to the SSH server's private key. key_path: "ssh/soft_serve_host" diff --git a/pkg/config/config.go b/pkg/config/config.go index 8db84ebf2763ad9fe15f24948c3268de39738d73..05dd2c38e3e3f70d6e7facfe526afd8fe0fc4215 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -61,15 +61,6 @@ type GitConfig struct { MaxConnections int `env:"MAX_CONNECTIONS" yaml:"max_connections"` } -// CORSConfig is the CORS configuration for the server. -type CORSConfig struct { - AllowedHeaders []string `env:"ALLOWED_HEADERS" yaml:"allowed_headers"` - - AllowedOrigins []string `env:"ALLOWED_ORIGINS" yaml:"allowed_origins"` - - AllowedMethods []string `env:"ALLOWED_METHODS" yaml:"allowed_methods"` -} - // HTTPConfig is the HTTP configuration for the server. type HTTPConfig struct { // Enabled toggles the HTTP server on/off @@ -86,9 +77,6 @@ type HTTPConfig struct { // PublicURL is the public URL of the HTTP server. PublicURL string `env:"PUBLIC_URL" yaml:"public_url"` - - // HTTP is the configuration for the HTTP server. - CORS CORSConfig `envPrefix:"CORS_" yaml:"cors"` } // StatsConfig is the configuration for the stats server. @@ -208,9 +196,6 @@ func (c *Config) Environ() []string { fmt.Sprintf("SOFT_SERVE_HTTP_TLS_KEY_PATH=%s", c.HTTP.TLSKeyPath), fmt.Sprintf("SOFT_SERVE_HTTP_TLS_CERT_PATH=%s", c.HTTP.TLSCertPath), fmt.Sprintf("SOFT_SERVE_HTTP_PUBLIC_URL=%s", c.HTTP.PublicURL), - fmt.Sprintf("SOFT_SERVE_HTTP_CORS_ALLOWED_HEADERS=%s", strings.Join(c.HTTP.CORS.AllowedHeaders, ",")), - fmt.Sprintf("SOFT_SERVE_HTTP_CORS_ALLOWED_ORIGINS=%s", strings.Join(c.HTTP.CORS.AllowedOrigins, ",")), - fmt.Sprintf("SOFT_SERVE_HTTP_CORS_ALLOWED_METHODS=%s", strings.Join(c.HTTP.CORS.AllowedMethods, ",")), fmt.Sprintf("SOFT_SERVE_STATS_ENABLED=%t", c.Stats.Enabled), fmt.Sprintf("SOFT_SERVE_STATS_LISTEN_ADDR=%s", c.Stats.ListenAddr), fmt.Sprintf("SOFT_SERVE_LOG_FORMAT=%s", c.Log.Format), diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index b0653f28241239b14c225f76f247c154d67c82aa..8b84ed8222ba39ca5ad4d1236f5c787b19b0ab00 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -79,47 +79,3 @@ func TestCustomConfigLocation(t *testing.T) { cfg = DefaultConfig() is.Equal(cfg.Name, "Soft Serve") } - -func TestParseMultipleHeaders(t *testing.T) { - is := is.New(t) - is.NoErr(os.Setenv("SOFT_SERVE_HTTP_CORS_ALLOWED_HEADERS", "Accept,Accept-Language,User-Agent")) - t.Cleanup(func() { - is.NoErr(os.Unsetenv("SOFT_SERVE_HTTP_CORS_ALLOWED_HEADERS")) - }) - cfg := DefaultConfig() - is.NoErr(cfg.ParseEnv()) - is.Equal(cfg.HTTP.CORS.AllowedHeaders, []string{ - "Accept", - "Accept-Language", - "User-Agent", - }) -} - -func TestParseMultipleOrigins(t *testing.T) { - is := is.New(t) - is.NoErr(os.Setenv("SOFT_SERVE_HTTP_CORS_ALLOWED_ORIGINS", "https://foo.example,https://foo.example2")) - t.Cleanup(func() { - is.NoErr(os.Unsetenv("SOFT_SERVE_HTTP_CORS_ALLOWED_ORIGINS")) - }) - cfg := DefaultConfig() - is.NoErr(cfg.ParseEnv()) - is.Equal(cfg.HTTP.CORS.AllowedOrigins, []string{ - "https://foo.example", - "https://foo.example2", - }) -} - -func TestParseMultipleMethods(t *testing.T) { - is := is.New(t) - is.NoErr(os.Setenv("SOFT_SERVE_HTTP_CORS_ALLOWED_METHODS", "GET,POST,PUT")) - t.Cleanup(func() { - is.NoErr(os.Unsetenv("SOFT_SERVE_HTTP_CORS_ALLOWED_METHODS")) - }) - cfg := DefaultConfig() - is.NoErr(cfg.ParseEnv()) - is.Equal(cfg.HTTP.CORS.AllowedMethods, []string{ - "GET", - "POST", - "PUT", - }) -} diff --git a/pkg/web/server.go b/pkg/web/server.go index ab336e89a5f358be803812b93144a10722af4010..74a04f5b176bee7d1710f023643436119b181c97 100644 --- a/pkg/web/server.go +++ b/pkg/web/server.go @@ -5,7 +5,6 @@ import ( "net/http" "github.com/charmbracelet/log" - "github.com/charmbracelet/soft-serve/pkg/config" "github.com/gorilla/handlers" "github.com/gorilla/mux" ) @@ -27,12 +26,5 @@ func NewRouter(ctx context.Context) http.Handler { h = handlers.CompressHandler(h) h = handlers.RecoveryHandler()(h) - cfg := config.FromContext(ctx) - - h = handlers.CORS(handlers.AllowedHeaders(cfg.HTTP.CORS.AllowedHeaders), - handlers.AllowedOrigins(cfg.HTTP.CORS.AllowedOrigins), - handlers.AllowedMethods(cfg.HTTP.CORS.AllowedMethods), - )(h) - return h } diff --git a/testscript/testdata/http-cors.txtar b/testscript/testdata/http-cors.txtar deleted file mode 100644 index c545ab7a1d908fde301410b90a651d8992aeb9e0..0000000000000000000000000000000000000000 --- a/testscript/testdata/http-cors.txtar +++ /dev/null @@ -1,64 +0,0 @@ -# vi: set ft=conf - -# FIXME: don't skip windows -[windows] skip 'curl makes github actions hang' - -# convert crlf to lf on windows -[windows] dos2unix http1.txt http2.txt http3.txt goget.txt gitclone.txt - -# start soft serve -exec soft serve & -# wait for SSH server to start -ensureserverrunning SSH_PORT - -# create user -soft user create user1 --key "$USER1_AUTHORIZED_KEY" - -# create access token -soft token create --expires-in '1h' 'repo2' -cp stdout tokenfile -envfile TOKEN=tokenfile -soft token create --expires-in '1ns' 'repo2' -cp stdout etokenfile -envfile ETOKEN=etokenfile -usoft token create 'repo2' -cp stdout utokenfile -envfile UTOKEN=utokenfile - -# push & create repo with some files, commits, tags... -mkdir ./repo2 -git -c init.defaultBranch=master -C repo2 init -mkfile ./repo2/README.md '# Project\nfoo' -mkfile ./repo2/foo.png 'foo' -mkfile ./repo2/bar.png 'bar' -git -C repo2 remote add origin http://$TOKEN@localhost:$HTTP_PORT/repo2 -git -C repo2 lfs install --local -git -C repo2 lfs track '*.png' -git -C repo2 add -A -git -C repo2 commit -m 'first' -git -C repo2 tag v0.1.0 -git -C repo2 push origin HEAD -git -C repo2 push origin HEAD --tags - -curl -v --request OPTIONS http://localhost:$HTTP_PORT/repo2.git/info/refs -H 'Origin: https://foo.example' -H 'Access-Control-Request-Method: GET' -stderr '.*Method Not Allowed.*' - -# stop the server -stopserver - -# allow cross-origin OPTIONS requests -env SOFT_SERVE_HTTP_CORS_ALLOWED_ORIGINS="https://foo.example" -env SOFT_SERVE_HTTP_CORS_ALLOWED_METHODS="GET,OPTIONS" -env SOFT_SERVE_HTTP_CORS_ALLOWED_HEADERS="Origin,Access-Control-Request-Method" - -# restart soft serve -exec soft serve & -# wait for SSH server to start -ensureserverrunning SSH_PORT - -curl -v --request OPTIONS http://localhost:$HTTP_PORT/repo2.git/info/refs -H 'Origin: https://foo.example' -H 'Access-Control-Request-Method: GET' -stderr '.*200 OK.*' - -# stop the server -[windows] stopserver -[windows] ! stderr . From 923844b981ffa744033bd20dcb2124a8b7fcf057 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 20 Mar 2025 18:00:48 +0300 Subject: [PATCH 2/7] fix(hooks): pre and post hooks now receive the full input line This fixes an issue where the pre and post hooks won't receive the full input lines when they're split. This is because the scanner is used to read the input line by line, and the scanner strips the newline character from the input. This change adds the newline character back to the input line before passing it to the pre and post hooks. Fixes: https://github.com/charmbracelet/soft-serve/issues/680 --- cmd/soft/hook/hook.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/soft/hook/hook.go b/cmd/soft/hook/hook.go index 43718ed22042e0c9d5c6b84cb9ac1488b3c724eb..b12938af10e66b8741347d3f9e69a3908e7e3daa 100644 --- a/cmd/soft/hook/hook.go +++ b/cmd/soft/hook/hook.go @@ -80,6 +80,7 @@ var ( scanner := bufio.NewScanner(stdin) for scanner.Scan() { buf.Write(scanner.Bytes()) + buf.WriteByte('\n') fields := strings.Fields(scanner.Text()) if len(fields) != 3 { return fmt.Errorf("invalid hook input: %s", scanner.Text()) From 09567524700e631b1a9b371ebbc577c3b2108091 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 20 Mar 2025 18:04:36 +0300 Subject: [PATCH 3/7] fix(hooks): log invalid hook input instead of returning error to the client This change logs invalid hook input instead of returning an error to the client in git hooks. This is done to prevent the client from receiving an error message when the hook input is invalid. --- cmd/soft/hook/hook.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/soft/hook/hook.go b/cmd/soft/hook/hook.go index b12938af10e66b8741347d3f9e69a3908e7e3daa..e9b3f1f5c1ff6c3ebf40cbf3f5d5160c53ed8953 100644 --- a/cmd/soft/hook/hook.go +++ b/cmd/soft/hook/hook.go @@ -65,6 +65,8 @@ var ( // This is set in the server before invoking git-receive-pack/git-upload-pack repoName := os.Getenv("SOFT_SERVE_REPO_NAME") + logger := log.FromContext(ctx).With("repo", repoName) + stdin := cmd.InOrStdin() stdout := cmd.OutOrStdout() stderr := cmd.ErrOrStderr() @@ -83,7 +85,8 @@ var ( buf.WriteByte('\n') fields := strings.Fields(scanner.Text()) if len(fields) != 3 { - return fmt.Errorf("invalid hook input: %s", scanner.Text()) + logger.Error(fmt.Sprintf("invalid %s hook input", cmdName), "input", scanner.Text()) + continue } opts = append(opts, hooks.HookArg{ OldSha: fields[0], @@ -100,7 +103,8 @@ var ( } case hooks.UpdateHook: if len(args) != 3 { - return fmt.Errorf("invalid update hook input: %s", args) + logger.Error("invalid update hook input", "input", args) + break } hks.Update(ctx, stdout, stderr, repoName, hooks.HookArg{ @@ -116,7 +120,7 @@ var ( if stat, err := os.Stat(customHookPath); err == nil && !stat.IsDir() && stat.Mode()&0o111 != 0 { // If the custom hook is executable, run it if err := runCommand(ctx, &buf, stdout, stderr, customHookPath, args...); err != nil { - return fmt.Errorf("failed to run custom hook: %w", err) + logger.Error("failed to run custom hook", "err", err) } } From f23cdc41db922a8d236e812fb2ffd422f484d858 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 20 Mar 2025 19:42:58 +0300 Subject: [PATCH 4/7] fix: update go.sum --- go.sum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.sum b/go.sum index 0dd0ca32a23b86e764e8fe5a9fc89367e92e5e44..b5cbb19955cf4b0472f6c8be47674124cb0943c2 100644 --- a/go.sum +++ b/go.sum @@ -34,7 +34,7 @@ github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4p github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk= github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20240708204110-bacbfdb68d92 h1:KtQlsiHfY3K4AoIEh0yUE/wCLHteZ9EzV1hKmx+p7U8= github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20240708204110-bacbfdb68d92/go.mod h1:UrXUCm3xLQkq15fu7qlXHUMlrhdlXHoi13KH2Dfiits= -github.com/charmbracelet/glamour v0.9.1 h1:Q7PdJLOx8EoepsXUvW6Puz5WQ3YUElIGQdYKrIpiGLA= +github.com/charmbracelet/glamour v0.9.1 h1:11dEfiGP8q1BEqvGoIjivuc2rBk+5qEXdPtaQ2WoiCM= github.com/charmbracelet/glamour v0.9.1/go.mod h1:+SHvIS8qnwhgTpVMiXwn7OfGomSqff1cHBCI8jLOetk= github.com/charmbracelet/keygen v0.5.3 h1:2MSDC62OUbDy6VmjIE2jM24LuXUvKywLCmaJDmr/Z/4= github.com/charmbracelet/keygen v0.5.3/go.mod h1:TcpNoMAO5GSmhx3SgcEMqCrtn8BahKhB8AlwnLjRUpk= From 821a823fae06ac62c6a5de9cb1f1ecf3750cc324 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 22:17:30 +0000 Subject: [PATCH 5/7] chore(deps): bump github.com/golang-jwt/jwt/v5 from 5.2.1 to 5.2.2 (#682) Bumps [github.com/golang-jwt/jwt/v5](https://github.com/golang-jwt/jwt) from 5.2.1 to 5.2.2. - [Release notes](https://github.com/golang-jwt/jwt/releases) - [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md) - [Commits](https://github.com/golang-jwt/jwt/compare/v5.2.1...v5.2.2) --- updated-dependencies: - dependency-name: github.com/golang-jwt/jwt/v5 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7390c6b3a6879c4cf46901d2c7cd42939ae57039..c6ea6a10d61cefe97abca65e426e110d501d1f16 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/charmbracelet/ssh v0.0.0-20250213143314-8712ec3ff3ef github.com/go-jose/go-jose/v3 v3.0.4 github.com/gobwas/glob v0.2.3 - github.com/golang-jwt/jwt/v5 v5.2.1 + github.com/golang-jwt/jwt/v5 v5.2.2 github.com/google/go-querystring v1.1.0 github.com/google/uuid v1.6.0 github.com/gorilla/handlers v1.5.2 diff --git a/go.sum b/go.sum index b5cbb19955cf4b0472f6c8be47674124cb0943c2..35771f1a4c2fbba9e48b96bbfb1081a2023e188e 100644 --- a/go.sum +++ b/go.sum @@ -92,8 +92,8 @@ github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpv github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= +github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= From 862b1b13a65dce3ca3a6cc53f07b15cd0e6d8da6 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 25 Mar 2025 22:57:22 +0300 Subject: [PATCH 6/7] chore: bump wish to v1.4.7 --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index c6ea6a10d61cefe97abca65e426e110d501d1f16..92c8bb3f9c27727afefd5487e4160b1601861d33 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/charmbracelet/bubbletea v1.3.4 github.com/charmbracelet/glamour v0.9.1 github.com/charmbracelet/lipgloss v1.1.0 - github.com/charmbracelet/wish v1.4.6 + github.com/charmbracelet/wish v1.4.7 github.com/dustin/go-humanize v1.0.1 github.com/go-git/go-git/v5 v5.14.0 github.com/matryer/is v1.4.1 @@ -63,7 +63,7 @@ require ( github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect github.com/charmbracelet/x/conpty v0.1.0 // indirect github.com/charmbracelet/x/errors v0.0.0-20240725160154-f9f6568126ec // indirect - github.com/charmbracelet/x/input v0.3.1 // indirect + github.com/charmbracelet/x/input v0.3.4 // indirect github.com/charmbracelet/x/term v0.2.1 // indirect github.com/charmbracelet/x/termios v0.1.0 // indirect github.com/charmbracelet/x/windows v0.2.0 // indirect diff --git a/go.sum b/go.sum index 35771f1a4c2fbba9e48b96bbfb1081a2023e188e..f2dacb8189b5d7e2b4ae09b53633f75107aa4bb0 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ github.com/charmbracelet/log v0.4.1 h1:6AYnoHKADkghm/vt4neaNEXkxcXLSV2g1rdyFDOpT github.com/charmbracelet/log v0.4.1/go.mod h1:pXgyTsqsVu4N9hGdHmQ0xEA4RsXof402LX9ZgiITn2I= github.com/charmbracelet/ssh v0.0.0-20250213143314-8712ec3ff3ef h1:dNZwn4is5svUd+sQEGsrXtp7VwD2ipYaCkKMzcpAEIE= github.com/charmbracelet/ssh v0.0.0-20250213143314-8712ec3ff3ef/go.mod h1:hg+I6gvlMl16nS9ZzQNgBIrrCasGwEw0QiLsDcP01Ko= -github.com/charmbracelet/wish v1.4.6 h1:27WRqMTUmyFoZASoaAaEe78Je7LTU4VqyoBxnl4d9XA= -github.com/charmbracelet/wish v1.4.6/go.mod h1:RRy2LFW3WQ3tlPmMMGgEeSMDVlFd5yqklGBVZWQSHmk= +github.com/charmbracelet/wish v1.4.7 h1:O+jdLac3s6GaqkOHHSwezejNK04vl6VjO1A+hl8J8Yc= +github.com/charmbracelet/wish v1.4.7/go.mod h1:OBZ8vC62JC5cvbxJLh+bIWtG7Ctmct+ewziuUWK+G14= github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE= github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q= github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8= @@ -56,8 +56,8 @@ github.com/charmbracelet/x/errors v0.0.0-20240725160154-f9f6568126ec h1:O8c7pFFK github.com/charmbracelet/x/errors v0.0.0-20240725160154-f9f6568126ec/go.mod h1:2P0UgXMEa6TsToMSuFqKFQR+fZTO9CNGUNokkPatT/0= github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b h1:MnAMdlwSltxJyULnrYbkZpp4k58Co7Tah3ciKhSNo0Q= github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= -github.com/charmbracelet/x/input v0.3.1 h1:TE4s3fTRj+OUpJ86dKphrN99+NgBnto//EkWncMJQIg= -github.com/charmbracelet/x/input v0.3.1/go.mod h1:4w9jS/NW62WrHSdmjbpzydvnbqkd+mtyK8WOWbHCdvs= +github.com/charmbracelet/x/input v0.3.4 h1:Mujmnv/4DaitU0p+kIsrlfZl/UlmeLKw1wAP3e1fMN0= +github.com/charmbracelet/x/input v0.3.4/go.mod h1:JI8RcvdZWQIhn09VzeK3hdp4lTz7+yhiEdpEQtZN+2c= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= github.com/charmbracelet/x/termios v0.1.0 h1:y4rjAHeFksBAfGbkRDmVinMg7x7DELIGAFbdNvxg97k= From d299f527a73cac710f47192be5a21a1c4b72bdc3 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Tue, 25 Mar 2025 23:42:03 +0300 Subject: [PATCH 7/7] chore(tests): add repo-push test --- testscript/testdata/repo-push.txtar | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/testscript/testdata/repo-push.txtar b/testscript/testdata/repo-push.txtar index d9f947537f105e879ab54275777c62250ffaa673..c4a5e243e1a9b021d207dddb6279588beeab37fe 100644 --- a/testscript/testdata/repo-push.txtar +++ b/testscript/testdata/repo-push.txtar @@ -11,8 +11,14 @@ soft repo create repo-empty -d 'description' -H -p -n 'repo-empty' # clone repo git clone ssh://localhost:$SSH_PORT/repo-empty repo-empty -# push repo +# push repo without any commits ! git -C repo-empty push origin HEAD +# push repo with a commit +mkfile ./repo-empty/README.md '# Hello\n\nwelcome' +git -C repo-empty add README.md +git -C repo-empty commit -m 'first' +git -C repo-empty push origin HEAD + # stop the server [windows] stopserver