From dc49bd8d87975ceb13f7172bf5daa623b92f7cbb Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Sat, 17 Jan 2026 15:55:00 +0700 Subject: [PATCH 01/10] psuh: add a built-in by popular demand Internal metrics indicate this is a command many users expect to be present. So here's an implementation to help drive customer satisfaction and engagement: a pony which doubtfully greets the user, or, a Pony Saying "Um, Hello" (PSUH). This commit message is intentionally formatted to 72 columns per line, starts with a single line as "commit message subject" that is written as if to command the codebase to do something (add this, teach a command that). The body of the message is designed to add information about the commit that is not readily deduced from reading the associated diff, such as answering the question "why?". Signed-off-by: Long Nguyen --- .gitignore | 1 + Makefile | 1 + builtin.h | 1 + builtin/psuh.c | 8 ++++++++ git.c | 1 + 5 files changed, 12 insertions(+) create mode 100644 builtin/psuh.c diff --git a/.gitignore b/.gitignore index 24635cf2d6f4a3..8afefb6e6ac5db 100644 --- a/.gitignore +++ b/.gitignore @@ -126,6 +126,7 @@ /git-prune-packed /git-pull /git-push +/git-psuh /git-quiltimport /git-range-diff /git-read-tree diff --git a/Makefile b/Makefile index dbf00220541ce1..3c5f39984e1142 100644 --- a/Makefile +++ b/Makefile @@ -1459,6 +1459,7 @@ BUILTIN_OBJS += builtin/patch-id.o BUILTIN_OBJS += builtin/prune-packed.o BUILTIN_OBJS += builtin/prune.o BUILTIN_OBJS += builtin/pull.o +BUILTIN_OBJS += builtin/psuh.o BUILTIN_OBJS += builtin/push.o BUILTIN_OBJS += builtin/range-diff.o BUILTIN_OBJS += builtin/read-tree.o diff --git a/builtin.h b/builtin.h index 235c51f30e5380..eb658ea8d75618 100644 --- a/builtin.h +++ b/builtin.h @@ -282,5 +282,6 @@ int cmd_verify_pack(int argc, const char **argv, const char *prefix, struct repo int cmd_show_ref(int argc, const char **argv, const char *prefix, struct repository *repo); int cmd_pack_refs(int argc, const char **argv, const char *prefix, struct repository *repo); int cmd_replace(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo); #endif diff --git a/builtin/psuh.c b/builtin/psuh.c new file mode 100644 index 00000000000000..89d9350bab6e35 --- /dev/null +++ b/builtin/psuh.c @@ -0,0 +1,8 @@ +#include "builtin.h" +#include "gettext.h" + +int cmd_psuh(int argc UNUSED, const char **argv UNUSED, + const char *prefix UNUSED, struct repository *repo UNUSED) { + printf(_("Pony saying hello goes here.\n")); + return 0; +} diff --git a/git.c b/git.c index 5a40eab8a26a66..ad88c5930b1a2b 100644 --- a/git.c +++ b/git.c @@ -627,6 +627,7 @@ static struct cmd_struct commands[] = { { "prune-packed", cmd_prune_packed, RUN_SETUP }, { "pull", cmd_pull, RUN_SETUP | NEED_WORK_TREE }, { "push", cmd_push, RUN_SETUP }, + { "psuh", cmd_psuh, RUN_SETUP }, { "range-diff", cmd_range_diff, RUN_SETUP | USE_PAGER }, { "read-tree", cmd_read_tree, RUN_SETUP }, { "rebase", cmd_rebase, RUN_SETUP | NEED_WORK_TREE }, From bc231272c3b41bbc1c8d22f5cd036a9c527bb04b Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Sat, 17 Jan 2026 16:09:27 +0700 Subject: [PATCH 02/10] psuh: show parameters & config opts Signed-off-by: Long Nguyen --- builtin/psuh.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/builtin/psuh.c b/builtin/psuh.c index 89d9350bab6e35..1db8a211b6abc7 100644 --- a/builtin/psuh.c +++ b/builtin/psuh.c @@ -1,8 +1,28 @@ #include "builtin.h" #include "gettext.h" -int cmd_psuh(int argc UNUSED, const char **argv UNUSED, - const char *prefix UNUSED, struct repository *repo UNUSED) { - printf(_("Pony saying hello goes here.\n")); - return 0; +int cmd_psuh(int argc, const char **argv, + const char *prefix, struct repository *repo) { + int i; + const char *config_name; + printf(_("Pushing to %s\n"), repo->name); + printf(_("Pushing to %s\n"), repo->url); + printf(Q_("Your args (there is %d):\n", + "Your args (there are %d):\n", + argc), + argc); + for (i = 0; i < argc; i++) + printf("%d: %s\n", i, argv[i]); + + printf(_("Your current working directory:\n%s%s\n"), + prefix ? "/" : "", prefix ? prefix : ""); + + repo_config(repo, git_default_config, NULL); + + if (repo_config_get_string_tmp(repo, "user.name", &config_name)) + printf(_("No name is found in config\n")); + else + printf(_("Your name: %s\n"), config_name); + + return 0; } From 864d29c0c199c25b38560a961fab400d0952ae05 Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Sat, 17 Jan 2026 16:40:00 +0700 Subject: [PATCH 03/10] psuh: show parameters & config opts Signed-off-by: Long Nguyen --- builtin/psuh.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builtin/psuh.c b/builtin/psuh.c index 1db8a211b6abc7..f9008f8865db55 100644 --- a/builtin/psuh.c +++ b/builtin/psuh.c @@ -1,5 +1,7 @@ #include "builtin.h" #include "gettext.h" +#include "config.h" +#include "repository.h" int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo) { From 4e183e2ea91108c50c1909a942438e30e2a0ce1d Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Sat, 17 Jan 2026 16:42:03 +0700 Subject: [PATCH 04/10] psuh: show parameters & config opts Signed-off-by: Long Nguyen --- builtin/psuh.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/builtin/psuh.c b/builtin/psuh.c index f9008f8865db55..6d84701105e3c8 100644 --- a/builtin/psuh.c +++ b/builtin/psuh.c @@ -7,8 +7,6 @@ int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo) { int i; const char *config_name; - printf(_("Pushing to %s\n"), repo->name); - printf(_("Pushing to %s\n"), repo->url); printf(Q_("Your args (there is %d):\n", "Your args (there are %d):\n", argc), From 4478a47c0591e76ee5b2ff1ba180c65f4f36a2d9 Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Sat, 17 Jan 2026 17:02:26 +0700 Subject: [PATCH 05/10] psuh: display the top of origin/master Signed-off-by: Long Nguyen --- builtin/psuh.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/builtin/psuh.c b/builtin/psuh.c index 6d84701105e3c8..856a02b3db494a 100644 --- a/builtin/psuh.c +++ b/builtin/psuh.c @@ -2,11 +2,23 @@ #include "gettext.h" #include "config.h" #include "repository.h" +#include "environment.h" +#include "wt-status.h" +#include "commit.h" +#include "pretty.h" +#include "strbuf.h" int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo) { int i; const char *config_name; + struct wt_status status; + struct commit *c = NULL; + struct strbuf commitline = STRBUF_INIT; + + wt_status_prepare(repo, &status); + repo_config(repo, git_default_config, &status); + printf(Q_("Your args (there is %d):\n", "Your args (there are %d):\n", argc), @@ -24,5 +36,15 @@ int cmd_psuh(int argc, const char **argv, else printf(_("Your name: %s\n"), config_name); + printf(_("Your current branch: %s\n"), status.branch); + + c = lookup_commit_reference_by_name("origin/master"); + + if (c != NULL) { + pp_commit_easy(CMIT_FMT_ONELINE, c, &commitline); + printf(_("Current commit: %s\n"), commitline.buf); + } + + return 0; } From 22ab15f637a95fb81f53414f526ac3e0a991f1c8 Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Sat, 17 Jan 2026 17:27:38 +0700 Subject: [PATCH 06/10] add doc Signed-off-by: Long Nguyen --- Documentation/git-psuh.adoc | 31 +++++++++++++++++++++++++++++++ builtin/psuh.c | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Documentation/git-psuh.adoc diff --git a/Documentation/git-psuh.adoc b/Documentation/git-psuh.adoc new file mode 100644 index 00000000000000..10baaab0b825ca --- /dev/null +++ b/Documentation/git-psuh.adoc @@ -0,0 +1,31 @@ +git-psuh(1) +=========== + +NAME +---- +git-psuh - Delight users' typo with a shy horse + + +SYNOPSIS +-------- +[verse] +'git-psuh [...]' + +DESCRIPTION +----------- +this program is cool + +OPTIONS[[OPTIONS]] +------------------ +-n:: +--dry-run:: + Don't actually remove any objects, only show those that would have been + removed. + +OUTPUT +------ +... + +GIT +--- +Part of the git[1] suite diff --git a/builtin/psuh.c b/builtin/psuh.c index 856a02b3db494a..4d9a05830d9f75 100644 --- a/builtin/psuh.c +++ b/builtin/psuh.c @@ -38,7 +38,7 @@ int cmd_psuh(int argc, const char **argv, printf(_("Your current branch: %s\n"), status.branch); - c = lookup_commit_reference_by_name("origin/master"); + c = lookup_commit_reference_by_name("refs/heads/psuh"); if (c != NULL) { pp_commit_easy(CMIT_FMT_ONELINE, c, &commitline); From 82f10aa181fdf20a1d9f77ccf3d0572defe92ee3 Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Sat, 17 Jan 2026 17:59:56 +0700 Subject: [PATCH 07/10] psuh: show parameters & config opts Signed-off-by: Long Nguyen --- Documentation/git-psuh.adoc | 6 +----- Documentation/meson.build | 1 + builtin/psuh.c | 11 +++++++++++ command-list.txt | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Documentation/git-psuh.adoc b/Documentation/git-psuh.adoc index 10baaab0b825ca..2a00575edd008f 100644 --- a/Documentation/git-psuh.adoc +++ b/Documentation/git-psuh.adoc @@ -22,10 +22,6 @@ OPTIONS[[OPTIONS]] Don't actually remove any objects, only show those that would have been removed. -OUTPUT ------- -... - GIT --- -Part of the git[1] suite +Part of the linkgit:git[1] suite diff --git a/Documentation/meson.build b/Documentation/meson.build index d6365b888bbed3..2b8e567c739005 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -103,6 +103,7 @@ manpages = { 'git-patch-id.adoc' : 1, 'git-prune-packed.adoc' : 1, 'git-prune.adoc' : 1, + 'git-psuh.adoc' : 1, 'git-pull.adoc' : 1, 'git-push.adoc' : 1, 'git-quiltimport.adoc' : 1, diff --git a/builtin/psuh.c b/builtin/psuh.c index 4d9a05830d9f75..2ca6aa52d415e2 100644 --- a/builtin/psuh.c +++ b/builtin/psuh.c @@ -7,6 +7,12 @@ #include "commit.h" #include "pretty.h" #include "strbuf.h" +#include "parse-options.h" + +static const char * const psuh_usage[] = { + N_("git psuh [...]"), + NULL, +}; int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo) { @@ -15,6 +21,11 @@ int cmd_psuh(int argc, const char **argv, struct wt_status status; struct commit *c = NULL; struct strbuf commitline = STRBUF_INIT; + struct option options[] = { + OPT_END() + }; + argc = parse_options(argc, argv, prefix, options, psuh_usage, 0); + wt_status_prepare(repo, &status); repo_config(repo, git_default_config, &status); diff --git a/command-list.txt b/command-list.txt index f9005cf45979f1..e7a94eca8041d3 100644 --- a/command-list.txt +++ b/command-list.txt @@ -153,6 +153,7 @@ git-pack-refs ancillarymanipulators git-patch-id purehelpers git-prune ancillarymanipulators complete git-prune-packed plumbingmanipulators +git-psuh mainporcelain info git-pull mainporcelain remote git-push mainporcelain remote git-quiltimport foreignscminterface From e2b401cb88271ec6acba1f1f0f148b2d1b83f220 Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Sat, 17 Jan 2026 18:44:31 +0700 Subject: [PATCH 08/10] psuh: add test Signed-off-by: Long Nguyen --- builtin/psuh.c | 1 + t/t9999-psuh-tutorial.sh | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100755 t/t9999-psuh-tutorial.sh diff --git a/builtin/psuh.c b/builtin/psuh.c index 2ca6aa52d415e2..44209358fbc850 100644 --- a/builtin/psuh.c +++ b/builtin/psuh.c @@ -25,6 +25,7 @@ int cmd_psuh(int argc, const char **argv, OPT_END() }; argc = parse_options(argc, argv, prefix, options, psuh_usage, 0); + printf(_("Pony saying hello goes here.\n")); wt_status_prepare(repo, &status); diff --git a/t/t9999-psuh-tutorial.sh b/t/t9999-psuh-tutorial.sh new file mode 100755 index 00000000000000..a3602b769d88e4 --- /dev/null +++ b/t/t9999-psuh-tutorial.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +test_description='git-psuh test + +This test runs git-psuh and makes sure it does not crash.' + +. ./test-lib.sh + +test_expect_success 'runs correctly with no args and good output' ' + git psuh >actual && + grep Pony actual +' + +test_done From 12b5585d5fc69e11cec0a308fb691afa5ad3d782 Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Sat, 4 Apr 2026 02:04:04 +0700 Subject: [PATCH 09/10] psuh: fix SYNOPSIS to use space instead of hyphen The adoc SYNOPSIS had 'git-psuh' (hyphen) but the -h output from psuh_usage[] produces 'git psuh' (space), causing t0450 to fail. Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Long Nguyen --- Documentation/git-psuh.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-psuh.adoc b/Documentation/git-psuh.adoc index 2a00575edd008f..0df2e5bbd619e2 100644 --- a/Documentation/git-psuh.adoc +++ b/Documentation/git-psuh.adoc @@ -9,7 +9,7 @@ git-psuh - Delight users' typo with a shy horse SYNOPSIS -------- [verse] -'git-psuh [...]' +'git psuh [...]' DESCRIPTION ----------- From e45df6faf11a17bb37a92185731db0a884ef0936 Mon Sep 17 00:00:00 2001 From: Long Nguyen Date: Sat, 4 Apr 2026 05:37:34 +0700 Subject: [PATCH 10/10] psuh: fix whitespace, NULL style, and meson test registration - Remove trailing whitespace after printf in builtin/psuh.c - Use `if (c)` instead of `if (c != NULL)` per Git coding style - Register t9999-psuh-tutorial.sh in t/meson.build Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Long Nguyen --- builtin/psuh.c | 4 ++-- t/meson.build | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/builtin/psuh.c b/builtin/psuh.c index 44209358fbc850..df5d073e8cd9ec 100644 --- a/builtin/psuh.c +++ b/builtin/psuh.c @@ -46,13 +46,13 @@ int cmd_psuh(int argc, const char **argv, if (repo_config_get_string_tmp(repo, "user.name", &config_name)) printf(_("No name is found in config\n")); else - printf(_("Your name: %s\n"), config_name); + printf(_("Your name: %s\n"), config_name); printf(_("Your current branch: %s\n"), status.branch); c = lookup_commit_reference_by_name("refs/heads/psuh"); - if (c != NULL) { + if (c) { pp_commit_easy(CMIT_FMT_ONELINE, c, &commitline); printf(_("Current commit: %s\n"), commitline.buf); } diff --git a/t/meson.build b/t/meson.build index 7528e5cda5fef0..992dc5285f2838 100644 --- a/t/meson.build +++ b/t/meson.build @@ -1114,6 +1114,7 @@ integration_tests = [ 't9901-git-web--browse.sh', 't9902-completion.sh', 't9903-bash-prompt.sh', + 't9999-psuh-tutorial.sh', ] benchmarks = [