* core.pager handling broken
@ 2007-08-06 15:56 Brian Gernhardt
2007-08-06 17:32 ` [PATCH] check_repository_format_version(): run git_default_config() again Johannes Schindelin
0 siblings, 1 reply; 5+ messages in thread
From: Brian Gernhardt @ 2007-08-06 15:56 UTC (permalink / raw)
To: Git Mailing List
I don't have time to look into it, but something broke the core.pager
variable. I've bisected it down to
"e90fdc39b6903502192b2dd11e5503cea721a1ad: Clean up work-tree
handling". With this commit:
$ git config core.pager
tig
$ git log
# Uses less
$ GIT_PAGER=tig git log
# Uses tig
I don't have time to track it down right now (I'm off visiting
family), but will look into it tomorrow unless someone thinks it's
obvious and points it out before then.
~~ Brian
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] check_repository_format_version(): run git_default_config() again
2007-08-06 15:56 core.pager handling broken Brian Gernhardt
@ 2007-08-06 17:32 ` Johannes Schindelin
[not found] ` <7vbqdkcxy3.fsf@assigned-by-dhcp.cox.net>
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2007-08-06 17:32 UTC (permalink / raw)
To: Brian Gernhardt; +Cc: Git Mailing List, gitster
I broke this in "e90fdc39: Clean up work-tree handling". It is
needed, for example for interpreting core.pager before starting the
pager.
Noticed by Brian Gernhardt.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
My first commit with git-gui! Yeah!
On Mon, 6 Aug 2007, Brian Gernhardt wrote:
> I don't have time to look into it, but something broke the
> core.pager variable. I've bisected it down to
> "e90fdc39b6903502192b2dd11e5503cea721a1ad: Clean up work-tree
> handling".
Thanks.
setup.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/setup.c b/setup.c
index 4945eb3..35fa031 100644
--- a/setup.c
+++ b/setup.c
@@ -355,7 +355,8 @@ int check_repository_format_version(const char *var, const char *value)
free(git_work_tree_cfg);
git_work_tree_cfg = xstrdup(value);
inside_work_tree = -1;
- }
+ } else
+ return git_default_config(var, value);
return 0;
}
--
1.5.3.rc4.17.gb980
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] check_repository_format_version(): run git_default_config() again
[not found] ` <7vbqdkcxy3.fsf@assigned-by-dhcp.cox.net>
@ 2007-08-06 20:26 ` Junio C Hamano
2007-08-06 23:08 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2007-08-06 20:26 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Brian Gernhardt, Git Mailing List
Junio C Hamano <gitster@pobox.com> writes:
> Sorry, I do not understand this patch from the commit log
> description.
>
> In the old days in 1.5.2 before either implementation of
> work-tree stuff, this function never called git_default_config()
> and presumably "git log" worked as expected for Brian. Why is
> this call needed _here_, not in some of the callers?
Sorry scratch that. v1.5.2 did not even have core.pager.
I see git_config(git_default_config) is called from
setup_git_directory_gently() in the version that introduced
core.pager. Curiously enough it does the config twice, once
where no GIT_DIR is set and it sets inside_work_tree, and
another by calling git_config(git_setup_config) -- big thanks
for sorting this mess out.
I however have a mild suspicion that this has to be done much
earlier.
For example, "git -p log" would first call handle_options(),
which calls the setup_pager() logic, and then we call
handle_internal_command() which calls setup_git_directory() that
eventually leads to the callchain of finding the .git directory
and .git/config file to be used. In that case, when we make the
call to setup_pager() from handle_options(), we haven't even
figured out if there is a configuration file, let alone reading
from it.
We could work this around by having the "we need config -- where
is it" logic in setup_pager(), but if we later have new options
like -p that affects the way how git wrapper itself behaves
based on the configuration, we would need the same "early config
read" logic to support it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] check_repository_format_version(): run git_default_config() again
2007-08-06 20:26 ` Junio C Hamano
@ 2007-08-06 23:08 ` Junio C Hamano
2007-08-06 23:26 ` Johannes Schindelin
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2007-08-06 23:08 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Brian Gernhardt, Git Mailing List
Junio C Hamano <gitster@pobox.com> writes:
> I see git_config(git_default_config) is called ... big thanks
> for sorting this mess out.
>
> I however have a mild suspicion that this has to be done much
> earlier.
> ...
> We could work this around by having the "we need config -- where
> is it" logic in setup_pager(), but if we later have new options
> like -p that affects the way how git wrapper itself behaves
> based on the configuration, we would need the same "early config
> read" logic to support it.
Ok, how about this as an interim solution?
This is a minimum change in the sense that it restores the old
behaviour of not even reading config in setup_git_directory(),
but have the core.pager honored when we know it matters.
---
| 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
--git a/pager.c b/pager.c
index 3bfed02..8bac9d9 100644
--- a/pager.c
+++ b/pager.c
@@ -31,8 +31,11 @@ void setup_pager(void)
if (!isatty(1))
return;
- if (!pager)
+ if (!pager) {
+ if (!pager_program)
+ git_config(git_default_config);
pager = pager_program;
+ }
if (!pager)
pager = getenv("PAGER");
if (!pager)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] check_repository_format_version(): run git_default_config() again
2007-08-06 23:08 ` Junio C Hamano
@ 2007-08-06 23:26 ` Johannes Schindelin
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2007-08-06 23:26 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Brian Gernhardt, Git Mailing List
Hi,
On Mon, 6 Aug 2007, Junio C Hamano wrote:
> This is a minimum change in the sense that it restores the old
> behaviour of not even reading config in setup_git_directory(),
> but have the core.pager honored when we know it matters.
Looks obviously correct to me, and much better than relying on other sites
reading the config.
ACK.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-08-06 23:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-06 15:56 core.pager handling broken Brian Gernhardt
2007-08-06 17:32 ` [PATCH] check_repository_format_version(): run git_default_config() again Johannes Schindelin
[not found] ` <7vbqdkcxy3.fsf@assigned-by-dhcp.cox.net>
2007-08-06 20:26 ` Junio C Hamano
2007-08-06 23:08 ` Junio C Hamano
2007-08-06 23:26 ` Johannes Schindelin
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).