Skip to content
Open

Psuh #2080

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
/git-prune-packed
/git-pull
/git-push
/git-psuh
/git-quiltimport
/git-range-diff
/git-read-tree
Expand Down
27 changes: 27 additions & 0 deletions Documentation/git-psuh.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
git-psuh(1)
===========

NAME
----
git-psuh - Delight users' typo with a shy horse


SYNOPSIS
--------
[verse]
'git psuh [<arg>...]'

DESCRIPTION
-----------
this program is cool

OPTIONS[[OPTIONS]]
------------------
-n::
--dry-run::
Don't actually remove any objects, only show those that would have been
removed.

GIT
---
Part of the linkgit:git[1] suite
1 change: 1 addition & 0 deletions Documentation/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
62 changes: 62 additions & 0 deletions builtin/psuh.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#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 [<arg>...]"),
NULL,
};

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;
struct option options[] = {
OPT_END()
};
argc = parse_options(argc, argv, prefix, options, psuh_usage, 0);
printf(_("Pony saying hello goes here.\n"));


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),
argc);
for (i = 0; i < argc; i++)
printf("%d: %s\n", i, argv[i]);

printf(_("Your current working directory:\n<top-level>%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);

printf(_("Your current branch: %s\n"), status.branch);

c = lookup_commit_reference_by_name("refs/heads/psuh");

if (c) {
pp_commit_easy(CMIT_FMT_ONELINE, c, &commitline);
printf(_("Current commit: %s\n"), commitline.buf);
}


return 0;
}
1 change: 1 addition & 0 deletions command-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions git.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
1 change: 1 addition & 0 deletions t/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@ integration_tests = [
't9901-git-web--browse.sh',
't9902-completion.sh',
't9903-bash-prompt.sh',
't9999-psuh-tutorial.sh',
]

benchmarks = [
Expand Down
14 changes: 14 additions & 0 deletions t/t9999-psuh-tutorial.sh
Original file line number Diff line number Diff line change
@@ -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
Loading