diff --git a/.gitignore b/.gitignore index 0209bd16f209c2..8b6e5b5e2a5da4 100644 --- a/.gitignore +++ b/.gitignore @@ -125,6 +125,7 @@ /git-patch-id /git-prune /git-prune-packed +/git-psuh /git-pull /git-push /git-quiltimport diff --git a/Documentation/git-psuh.adoc b/Documentation/git-psuh.adoc new file mode 100644 index 00000000000000..b1abbef5a5e6b5 --- /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 +-------- +[synopsis] +git psuh [...] + +DESCRIPTION +----------- +Internal metrics indicate this is a command many users expect to be +present. So, here's an imlpementation to help drive customer +satisfaction and engagement: a pony which doubtfully greets the user, +or, a Pony Saying "Um, Hello" (PSUH). + +OPTIONS[[OPTIONS]] +------------------ +... + +OUTPUT +------ +... + +GIT +--- +Part of the git[1] suite diff --git a/Makefile b/Makefile index a96be506b59f2d..1413200afc1e8b 100644 --- a/Makefile +++ b/Makefile @@ -1473,6 +1473,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 4e47a4ebd30ba3..b2275ccbc2f9e6 100644 --- a/builtin.h +++ b/builtin.h @@ -229,6 +229,7 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix, struct r int cmd_patch_id(int argc, const char **argv, const char *prefix, struct repository *repo); int cmd_prune(int argc, const char **argv, const char *prefix, struct repository *repo); int cmd_prune_packed(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); int cmd_pull(int argc, const char **argv, const char *prefix, struct repository *repo); int cmd_push(int argc, const char **argv, const char *prefix, struct repository *repo); int cmd_range_diff(int argc, const char **argv, const char *prefix, struct repository *repo); diff --git a/builtin/psuh.c b/builtin/psuh.c new file mode 100644 index 00000000000000..748d9f3e023329 --- /dev/null +++ b/builtin/psuh.c @@ -0,0 +1,63 @@ +#include "builtin.h" +#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" +#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) + +{ + struct option options[] = { + OPT_END() + }; + struct commit *c = NULL; + struct strbuf commitline = STRBUF_INIT; + struct wt_status status; + const char *cfg_name; + int i; + + wt_status_prepare(repo, &status); + repo_config(repo, git_default_config, &status); + + + printf(_("Pony saying hello goes here.\n")); + + printf(Q_("Your args (there is %d):\n", "Your args (there are %d):\n", argc), argc); + + argc = parse_options(argc, argv, prefix, options, psuh_usage, 0); + + 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", &cfg_name)) + printf(_("No name is found in config\n")); + else + printf(_("Your name: %s\n"), cfg_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; + +} diff --git a/command-list.txt b/command-list.txt index 63ae2a67c94055..3eae0b5b803aaa 100644 --- a/command-list.txt +++ b/command-list.txt @@ -154,6 +154,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 diff --git a/git.c b/git.c index d7b5f88e52ae87..a24b0aae029ffb 100644 --- a/git.c +++ b/git.c @@ -630,6 +630,7 @@ static struct cmd_struct commands[] = { { "pickaxe", cmd_blame, RUN_SETUP }, { "prune", cmd_prune, RUN_SETUP }, { "prune-packed", cmd_prune_packed, RUN_SETUP }, + { "psuh", cmd_psuh, RUN_SETUP }, { "pull", cmd_pull, RUN_SETUP | NEED_WORK_TREE }, { "push", cmd_push, RUN_SETUP }, { "range-diff", cmd_range_diff, RUN_SETUP | USE_PAGER },