public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Matthieu Moy <Matthieu.Moy@imag•fr>
Cc: git@vger•kernel.org
Subject: Re: [RFC PATCH 1/3] config --global --edit: create a template file if needed
Date: Fri, 25 Jul 2014 10:36:57 -0700	[thread overview]
Message-ID: <xmqqioml732e.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1406295891-7316-1-git-send-email-Matthieu.Moy@imag.fr> (Matthieu Moy's message of "Fri, 25 Jul 2014 15:44:49 +0200")

Matthieu Moy <Matthieu.Moy@imag•fr> writes:

> When the user has no ~/.gitconfig file, git config --global --edit used
> to launch an editor on an nonexistant file name.
>
> Instead, create a file with a default content before launching the
> editor. The template contains only commented-out entries, to save a few
> keystrokes for the user. If the values are guessed properly, the user
> will only have to uncomment the entries.
>
> Advanced users teaching newbies can create a minimalistic configuration
> faster for newbies. Beginners reading a tutorial advising to run "git
> config --global --edit" as a first step will be slightly more guided for
> their first contact with Git.
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag•fr>
> ---

Probably a good idea; I do not think of any possible interactions we
have to worry about with the configuration file init-db creates with
possible templating.

Do we use "user-wide" as a phrase to refer to these?  It sounds
somewhat funny to call anything specific to $frotz "$frotz-wide", at
least to me.

Surely, /etc/gitconfig is called "site-wide".  But .git/config is
per-project (or project-specific), and I would always have thought
that ~/.gitconfig was "per-user".

>  builtin/config.c | 30 +++++++++++++++++++++++++++---
>  cache.h          |  1 +
>  ident.c          |  2 +-
>  3 files changed, 29 insertions(+), 4 deletions(-)
>
> diff --git a/builtin/config.c b/builtin/config.c
> index fcd8474..3821697 100644
> --- a/builtin/config.c
> +++ b/builtin/config.c
> @@ -445,6 +445,20 @@ static int get_urlmatch(const char *var, const char *url)
>  	return 0;
>  }
>  
> +static char *default_user_config()

static char *default_user_config(void)

> +{
> +	struct strbuf buf = STRBUF_INIT;
> +	strbuf_addf(&buf,
> +		    _("# This is Git's user-wide configuration file.\n"
> +		      "[core]\n"
> +		      "# Please, adapt and uncomment the following lines:\n"

tangent: is it a French tradition to always have comma after please?

  parent reply	other threads:[~2014-07-25 17:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 13:44 [RFC PATCH 1/3] config --global --edit: create a template file if needed Matthieu Moy
2014-07-25 13:44 ` [RFC PATCH 2/3] home_config_path: allow NULL xdg parameter Matthieu Moy
2014-07-25 13:57   ` Tanay Abhra
2014-07-25 18:06   ` Junio C Hamano
2014-07-25 18:16     ` Matthieu Moy
2014-07-25 13:44 ` [RFC PATCH 3/3] commit: advertize config --global --edit on guessed identity Matthieu Moy
2014-07-25 15:40   ` Eric Sunshine
2014-07-25 15:37 ` [RFC PATCH 1/3] config --global --edit: create a template file if needed Eric Sunshine
2014-07-25 16:01   ` Matthieu Moy
2014-07-25 17:51     ` Eric Sunshine
2014-07-25 17:59     ` Junio C Hamano
2014-07-25 17:36 ` Junio C Hamano [this message]
2014-07-25 17:52   ` Matthieu Moy

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=xmqqioml732e.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Matthieu.Moy@imag$(echo .)fr \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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