From: Duy Nguyen <pclouds@gmail.com>
To: Heiko Voigt <hvoigt@hvoigt.net>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] teach the user to be nice to git and let him say please sometimes
Date: Sun, 12 May 2013 17:23:15 +0700 [thread overview]
Message-ID: <CACsJy8A+vjtwnB0LStVS3Q9v2JaKcMDa0sATr9H==X3EhQt6Jg@mail.gmail.com> (raw)
In-Reply-To: <20130511201928.GA22938@book.hvoigt.net>
On Sun, May 12, 2013 at 3:20 AM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
> 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 <hvoigt@hvoigt.net>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
> Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
> Signed-off-by: Johan Herland <johan@herland.net>
A product of Git Berlin Meetup?
> +static void check_politeness(const char *cmd)
> +{
> + const char *user_config;
> + struct strbuf buf = STRBUF_INIT;
> +
> + if (getenv("GIT_POLITENESS_CHECK_PASSED"))
> + return;
> +
> + setenv("GIT_POLITENESS_CHECK_PASSED", "Yes", 1);
> +
> + git_config_early(read_polite_counter, NULL, NULL);
> + if (!strcmp(cmd, "please")) {
> + impolite_counter = 0;
> + polite_counter++;
> + } else {
> + impolite_counter++;
> + polite_counter = 0;
> + }
> +
> + if (impolite_counter > 10)
> + die("Error: Learn some manners, say please some time!");
> + if (polite_counter > 10)
> + die("Error: Too many please! I don't believe you.");
NAK. If we truly care, we need better AI here!
> +
> + user_config = git_user_config();
> + strbuf_addf(&buf, "%d", polite_counter);
> + git_config_set_in_file(user_config, "user.polite", buf.buf);
> + strbuf_reset(&buf);
> + strbuf_addf(&buf, "%d", impolite_counter);
> + git_config_set_in_file(user_config, "user.impolite", buf.buf);
> + strbuf_release(&buf);
> +}
--
Duy
next prev parent reply other threads:[~2013-05-12 10:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-11 20:20 [PATCH] teach the user to be nice to git and let him say please sometimes Heiko Voigt
2013-05-12 10:07 ` Ramkumar Ramachandra
2013-05-12 10:23 ` Duy Nguyen [this message]
2013-05-13 13:30 ` Heiko Voigt
2013-05-13 13:58 ` Duy Nguyen
2013-05-12 21:19 ` Junio C Hamano
2013-05-13 13:44 ` Heiko Voigt
2013-05-13 20:40 ` Thomas Rast
2013-05-13 20:47 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2013-05-12 7:26 Heiko Voigt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACsJy8A+vjtwnB0LStVS3Q9v2JaKcMDa0sATr9H==X3EhQt6Jg@mail.gmail.com' \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).