# [PATCH 1/2] show-ref.c: Add missing call to git_config()

5 messages from 2013-06-15 to 2013-07-04. Participants: Ramsay Jones, Junio C Hamano.
Thread: https://gitlist.dev/t/34154

## Ramsay Jones, 2013-06-15 20:29

Subject: [PATCH 1/2] show-ref.c: Add missing call to git_config()
Message-ID: <51BCCE98.3070201@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/51BCCE98.3070201%40ramsay1.demon.co.uk

```

At present, 'git show-ref' ignores any attempt to set config
variables (e.g. core.checkstat) from the command line using
the -c option to git. In order to enable such usage, add the
missing call to git_config() from cmd_show_ref().

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 builtin/show-ref.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 8d9b76a..95f5ca9 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -191,6 +191,8 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix)
 	if (argc == 2 && !strcmp(argv[1], "-h"))
 		usage_with_options(show_ref_usage, show_ref_options);
 
+	git_config(git_default_config, NULL);
+
 	argc = parse_options(argc, argv, prefix, show_ref_options,
 			     show_ref_usage, PARSE_OPT_NO_INTERNAL_HELP);
 
-- 
1.8.3

```

## Junio C Hamano, 2013-06-17 03:05

Subject: Re: [PATCH 1/2] show-ref.c: Add missing call to git_config()
Message-ID: <7vppvlighf.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vppvlighf.fsf%40alter.siamese.dyndns.org
In-Reply-To: <51BCCE98.3070201@ramsay1.demon.co.uk>

```
Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> At present, 'git show-ref' ignores any attempt to set config
> variables (e.g. core.checkstat) from the command line using
> the -c option to git.

I think what you really want to see is not giving "-c" and have it
honored.

	"git show-ref" does not honor configuration variables at
	all, but at least core configuration variables read by
	git_default_config (most importantly core.checkstat) should
	be read and honored, because ...

would be more appropriate.  What are the variables that matter to
show-ref, and what are the reasons why they should be honored?  I
thought show-ref was just a way to enumerate refs, and does not read
the index nor checks if there are modifications in the working tree,
so I do not see any reason offhand for it to honor core.checkstat
(and I think that is the reason why we don't have the call there in
the current code).

Exactly the same comment applies to 2/2.

Note that I am _not_ opposing these changes.  You brought them up
because you saw some reason why these should honor some core
variables.  I just want that reason to be explained in the log for
the future developers.

```

## Ramsay Jones, 2013-06-18 18:38

Subject: Re: [PATCH 1/2] show-ref.c: Add missing call to git_config()
Message-ID: <51C0A939.8030200@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/51C0A939.8030200%40ramsay1.demon.co.uk
In-Reply-To: <7vppvlighf.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano wrote:
> Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
> 
>> At present, 'git show-ref' ignores any attempt to set config
>> variables (e.g. core.checkstat) from the command line using
>> the -c option to git.
> 
> I think what you really want to see is not giving "-c" and have it
> honored.
> 
> 	"git show-ref" does not honor configuration variables at
> 	all, but at least core configuration variables read by
> 	git_default_config (most importantly core.checkstat) should
> 	be read and honored, because ...
> 
> would be more appropriate.  What are the variables that matter to
> show-ref, and what are the reasons why they should be honored?  I
> thought show-ref was just a way to enumerate refs, and does not read
> the index nor checks if there are modifications in the working tree,
> so I do not see any reason offhand for it to honor core.checkstat
> (and I think that is the reason why we don't have the call there in
> the current code).

:-D Yes, you caught me!

These patches *may* not be necessary, prior to Michael's
"reference related races" series. Specifically, the introduction
of the stat_validity_check() function to the reference handling API.

This means that the behaviour 'git show-ref' is now affected by
several config variables, including core.checkstat. I haven't
spent any time auditing the code, but the list would include
(at least) core.trustctime, core.filemode, core.checkstat,
core.ignorecygwinfstricks, ...

> 
> Exactly the same comment applies to 2/2.

ditto

> Note that I am _not_ opposing these changes.  You brought them up
> because you saw some reason why these should honor some core
> variables.  I just want that reason to be explained in the log for
> the future developers.

Yes, I will send a v2 (soon-ish, I hope).

ATB,
Ramsay Jones

```

## Junio C Hamano, 2013-07-01 21:56

Subject: Re: [PATCH 1/2] show-ref.c: Add missing call to git_config()
Message-ID: <7vtxkeaq06.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vtxkeaq06.fsf%40alter.siamese.dyndns.org
In-Reply-To: <51C0A939.8030200@ramsay1.demon.co.uk>

```
Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> Yes, I will send a v2 (soon-ish, I hope).

Ping?

No need to hurry, but just to make sure this didn't disappear from
everybody's radar.

Thanks.

```

## Ramsay Jones, 2013-07-04 18:25

Subject: Re: [PATCH 1/2] show-ref.c: Add missing call to git_config()
Message-ID: <51D5BE28.9040703@ramsay1.demon.co.uk>
URL: https://gitlist.dev/e/51D5BE28.9040703%40ramsay1.demon.co.uk
In-Reply-To: <7vtxkeaq06.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano wrote:
> Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
> 
>> Yes, I will send a v2 (soon-ish, I hope).
> 
> Ping?
> 
> No need to hurry, but just to make sure this didn't disappear from
> everybody's radar.

Yep, this is still on my TODO list.

Sorry for being tardy on these patches. :(

ATB,
Ramsay Jones

```
