teach the user to be nice to git and let him say please sometimes
PATCH 1/1 teach the user to be nice to git and let him say please sometimes
Since ages we do not care about our program enough. Lets not treat them as slaves anymore and say please.
Signed-off-by Heiko Voigt <[email protected]>
Signed-off-by Jonathan Nieder <[email protected]>
Signed-off-by Jens Lehmann <[email protected]>
Signed-off-by Thomas Rast <[email protected]>
Signed-off-by Johan Herland <[email protected]>
---
I do not know why this very urgent patch did not make it to the mailinglist yesterday evening. Well here is a resend.
.gitignore | 1 + Makefile | 1 + builtin.h | 1 + builtin/config.c | 23 ++----------------- builtin/please.c | 9 ++++++++ cache.h | 1 + config.c | 23 +++++++++++++++++++ contrib/completion/git-prompt.sh | 5 +++- git.c | 49 +++++++++++++++++++++++++++++++++++++++- 9 files changed, 90 insertions(+), 23 deletions(-) create mode 100644 builtin/please.c
.gitignore +1 -0
@@ -105,6 +105,7 @@ /git-parse-remote /git-patch-id /git-peek-remote +/git-please /git-prune /git-prune-packed /git-pull
Makefile +1 -0
@@ -943,6 +943,7 @@ BUILTIN_OBJS += builtin/pack-objects.o BUILTIN_OBJS += builtin/pack-redundant.o BUILTIN_OBJS += builtin/pack-refs.o BUILTIN_OBJS += builtin/patch-id.o +BUILTIN_OBJS += builtin/please.o BUILTIN_OBJS += builtin/prune-packed.o BUILTIN_OBJS += builtin/prune.o BUILTIN_OBJS += builtin/push.o
builtin.h +1 -0
@@ -105,6 +105,7 @@ extern int cmd_notes(int argc, const char **argv, const char *prefix);extern int cmd_pack_objects (int argc,const char **argv,const char *prefix);extern int cmd_pack_redundant (int argc,const char **argv,const char *prefix);extern int cmd_patch_id (int argc,const char **argv,const char *prefix); +extern int cmd_please (int argc,const char **argv,const char *prefix);extern int cmd_prune (int argc,const char **argv,const char *prefix);extern int cmd_prune_packed (int argc,const char **argv,const char *prefix);extern int cmd_push (int argc,const char **argv,const char *prefix);
builtin/config.c +2 -21
@@ -364,27 +364,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)usage_with_options (builtin_config_usage, builtin_config_options); } -if (use_global_config) { -char *user_config =NULL ; -char *xdg_config =NULL ; - -home_config_paths (&user_config, &xdg_config,"config" ); - -if (!user_config) -/* -* It is unknown if HOME/.gitconfig exists, so -* we do not know if we should write to XDG -* location; error out even if XDG_CONFIG_HOME -* is set and points at a sane location. -*/ -die ("$HOME not set" ); - -if (access_or_warn (user_config,R_OK ) && - xdg_config && !access_or_warn (xdg_config,R_OK )) - given_config_file = xdg_config; -else - given_config_file = user_config; - } +if (use_global_config) + given_config_file =git_user_config ();else if (use_system_config) given_config_file =git_etc_gitconfig ();else if (use_local_config)
builtin/please.c new file +9 -0
@@ -0,0 +1,9 @@ +#include "builtin.h" +#include "run-command.h" + +int cmd_please (int argc,const char **argv,const char *prefix) +{ +if (!strcmp (argv[1 ],"-h" )) +usage ("Sometimes" ); +return run_command_v_opt (argv+1 ,RUN_GIT_CMD ); +}
cache.h +1 -0
@@ -1164,6 +1164,7 @@ extern int git_config_set_multivar_in_file(const char *, const char *, const chaextern int git_config_rename_section (const char *,const char *);extern int git_config_rename_section_in_file (const char *,const char *,const char *);extern const char *git_etc_gitconfig (void ); +extern const char *git_user_config (void );extern int check_repository_format_version (const char *var,const char *value,void *cb);extern int git_env_bool (const char *,int );extern int git_config_system (void );
config.c +23 -0
@@ -935,6 +935,29 @@ const char *git_etc_gitconfig(void)return system_wide; } +const char *git_user_config (void ) +{ +char *user_config =NULL ; +char *xdg_config =NULL ; + +home_config_paths (&user_config, &xdg_config,"config" ); + +if (!user_config) +/* +* It is unknown if HOME/.gitconfig exists, so +* we do not know if we should write to XDG +* location; error out even if XDG_CONFIG_HOME +* is set and points at a sane location. +*/ +die ("$HOME not set" ); + +if (access_or_warn (user_config,R_OK ) && + xdg_config && !access_or_warn (xdg_config,R_OK )) +return xdg_config; +else +return user_config; +} +int git_env_bool (const char *k,int def) {const char *v =getenv (k);
contrib/completion/git-prompt.sh +4 -1
@@ -241,6 +241,7 @@ __git_ps1 () local ps1pc_start='\u@\h:\w ' local ps1pc_end='\$ ' local printf_format=' (%s)' + export GIT_POLITENESS_CHECK_PASSED="Yes" case "$#" in 2|3) pcmode=yes
@@ -250,7 +251,8 @@ __git_ps1 () ;; 0|1) printf_format="${1:-$printf_format}" ;; - *) return + *) unset GIT_POLITENESS_CHECK_PASSED + return ;; esac
@@ -409,4 +411,5 @@ __git_ps1 () printf -- "$printf_format" "$c${b##refs/heads/}${f:+ $f}$r$p" fi fi + unset GIT_POLITENESS_CHECK_PASSED }
git.c +48 -1
81 lines not on this page · raw message
Signature · 1 line
1.8.3.rc1.44.gb387c77