forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 187
Expand file tree
/
Copy pathpsuh.c
More file actions
62 lines (49 loc) · 1.46 KB
/
psuh.c
File metadata and controls
62 lines (49 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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;
}