diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-04-14 07:17:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-13 19:17:27 -0400 |
commit | 334c899f7b79d639d618c0b2bd4417243d09347f (patch) | |
tree | dbb6a1e6b76e142b1f790190a1a031464af1b575 /modules/git/command_test.go | |
parent | 985f76dc4b0692c4d6c6f37e82500ef859557c16 (diff) | |
download | gitea-334c899f7b79d639d618c0b2bd4417243d09347f.tar.gz gitea-334c899f7b79d639d618c0b2bd4417243d09347f.zip |
Improve git log for debugging (#24095)
Diffstat (limited to 'modules/git/command_test.go')
-rw-r--r-- | modules/git/command_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/git/command_test.go b/modules/git/command_test.go index 4e5f991d31..9a6228c9ad 100644 --- a/modules/git/command_test.go +++ b/modules/git/command_test.go @@ -52,3 +52,11 @@ func TestGitArgument(t *testing.T) { assert.True(t, isSafeArgumentValue("x")) assert.False(t, isSafeArgumentValue("-x")) } + +func TestCommandString(t *testing.T) { + cmd := NewCommandContextNoGlobals(context.Background(), "a", "-m msg", "it's a test", `say "hello"`) + assert.EqualValues(t, cmd.prog+` a "-m msg" "it's a test" "say \"hello\""`, cmd.String()) + + cmd = NewCommandContextNoGlobals(context.Background(), "url: https://a:b@c/") + assert.EqualValues(t, cmd.prog+` "url: https://sanitized-credential@c/"`, cmd.toString(true)) +} |