* Possible BUG in 'git config'
@ 2007-02-11 14:13 Marco Costalba
2007-02-11 16:24 ` Johannes Schindelin
0 siblings, 1 reply; 5+ messages in thread
From: Marco Costalba @ 2007-02-11 14:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: GIT list
bash-3.1$ cat ./.git/config
[i18n]
commitencoding = UTF-8
bash-3.1$ git repo-config --global user.name
marco
bash-3.1$ git repo-config user.name
marco
I would expect git repo-config user.name returns an empty string,
because user.name is defined _only_ in global config file ~/.gitconfig
>From git-config documentation:
--global::
Use global ~/.gitconfig file rather than the repository .git/config.
How it is possible to know if a variable is stored in local config file?
Thanks
Marco
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Possible BUG in 'git config'
2007-02-11 14:13 Possible BUG in 'git config' Marco Costalba
@ 2007-02-11 16:24 ` Johannes Schindelin
2007-02-11 17:21 ` Marco Costalba
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2007-02-11 16:24 UTC (permalink / raw)
To: Marco Costalba; +Cc: Junio C Hamano, GIT list
Hi,
On Sun, 11 Feb 2007, Marco Costalba wrote:
> I would expect git repo-config user.name returns an empty string,
> because user.name is defined _only_ in global config file ~/.gitconfig
The whole point of ~/.gitconfig is to store variables to be seen in _all_
repositories.
> How it is possible to know if a variable is stored in local config file?
If you _have_ to, you can use
$ GIT_CONFIG=.git/config git config -l
but I _strongly_ suggest you rethink your workflow if you need that.
$HOME/.gitconfig _really_ is only meant to make it unnecessary to set a
variable in _all_ your repositories, and you can even override (although
not unset) the variables locally.
So I am certain that you made a mistake when you need to ignore the
settings in $HOME/.gitconfig.
Hth,
Dscho
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Possible BUG in 'git config'
2007-02-11 16:24 ` Johannes Schindelin
@ 2007-02-11 17:21 ` Marco Costalba
2007-02-11 17:37 ` Johannes Schindelin
0 siblings, 1 reply; 5+ messages in thread
From: Marco Costalba @ 2007-02-11 17:21 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, GIT list
On 2/11/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> So I am certain that you made a mistake when you need to ignore the
> settings in $HOME/.gitconfig.
>
Please do the following:
$ cd <git tree repo>
$ git repo-config --global --unset user.name
$ git repo-config --unset user.name
$ git gui
Then go to Edit->options, you will see empty both 'git repository' and
'Global (All repositories)'
Then exit 'git gui' and type:
$ git repo-config --global user.name dummy
$ git gui
Then go to Edit->options and.... surprise! dummy has been added to
both panes instead of only in 'Global' one.
The bug is not in 'git gui' but in 'git repo-config' that when queried
for user.name if doesn't find it in local config, silently falls back
in global config. This is not documented and probably a bug because
documentation of --global option says:
--global::
Use global ~/.gitconfig file *rather than* the repository .git/config.
Thanks
Marco
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Possible BUG in 'git config'
2007-02-11 17:21 ` Marco Costalba
@ 2007-02-11 17:37 ` Johannes Schindelin
2007-02-11 17:47 ` Marco Costalba
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2007-02-11 17:37 UTC (permalink / raw)
To: Marco Costalba; +Cc: Junio C Hamano, GIT list
Hi,
On Sun, 11 Feb 2007, Marco Costalba wrote:
> On 2/11/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> >
> > So I am certain that you made a mistake when you need to ignore the
> > settings in $HOME/.gitconfig.
> >
>
> Please do the following:
>
> $ cd <git tree repo>
> $ git repo-config --global --unset user.name
> $ git repo-config --unset user.name
> $ git gui
>
> Then go to Edit->options, you will see empty both 'git repository' and
> 'Global (All repositories)'
>
> Then exit 'git gui' and type:
>
> $ git repo-config --global user.name dummy
> $ git gui
>
> Then go to Edit->options and.... surprise! dummy has been added to
> both panes instead of only in 'Global' one.
I don't know. If you want that level of control, yes. But as has been
suggested before: .git/config as well as ~/.gitconfig have been meant to
be edited manually, but some people really need a special purpose UI for
everything, don't they?
As I said, for this you should use "GIT_CONFIG=$GIT_DIR/config git
config".
> The bug is not in 'git gui' but in 'git repo-config' that when queried
> for user.name if doesn't find it in local config, silently falls back
> in global config. This is not documented and probably a bug because
> documentation of --global option says:
>
> --global::
> Use global ~/.gitconfig file *rather than* the repository .git/config.
Yes, this is probably a bug. But it's obvious that if git-config _without_
--global would _not_ use ~/.gitconfig, that would rather make ~/.gitconfig
pointless, wouldn't it?
So yes, the description should mention that this is meant for the case of
_setting_ variables, not _querying_ variables. The original poster (Sean)
probaly though -- IMHO correctly -- that querying with --global makes no
sense.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Possible BUG in 'git config'
2007-02-11 17:37 ` Johannes Schindelin
@ 2007-02-11 17:47 ` Marco Costalba
0 siblings, 0 replies; 5+ messages in thread
From: Marco Costalba @ 2007-02-11 17:47 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, GIT list
On 2/11/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> Yes, this is probably a bug. But it's obvious that if git-config _without_
> --global would _not_ use ~/.gitconfig, that would rather make ~/.gitconfig
> pointless, wouldn't it?
>
Yes.
> So yes, the description should mention that this is meant for the case of
> _setting_ variables, not _querying_ variables. The original poster (Sean)
> probaly though -- IMHO correctly -- that querying with --global makes no
> sense.
>
Yes. It makes non sense but it' allowed. So probably, at least for
consistency, could exists a query without silent fallback. Something
like
git repo-config --local user.name
Marco
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-02-11 17:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-11 14:13 Possible BUG in 'git config' Marco Costalba
2007-02-11 16:24 ` Johannes Schindelin
2007-02-11 17:21 ` Marco Costalba
2007-02-11 17:37 ` Johannes Schindelin
2007-02-11 17:47 ` Marco Costalba
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).