Re: [ANNOUNCE] Stacked Git 0.15-rc1
2009/7/13 Linus Torvalds <torvalds@linux-foundation.org>:
Show 19 quoted lines
> On Mon, 13 Jul 2009, Catalin Marinas wrote:
>>
>> os.environ.setdefault('PAGER', config.get('stgit.pager'))
>> + if os.environ.get('PAGER').startswith('less'):
>> + os.environ.setdefault('LESS', '-FRSX')
>> # FIXME: handle EDITOR the same way ?
>
> That's not very smart.
>
> First off, PAGER could easily be something like "/usr/local/bin/less".
>
> Secondly, if it isn't less, so what? If it's not less, it won't care about
> the LESS environment variable.
>
> So just do an unconditional
>
> os.environ.setdefault('LESS', '-FRSX')
>
> and it will (a) work better, (b) be simpler and more efficient.Good point. Thanks. This is the new version:
diff --git a/stgit/config.py b/stgit/config.py
index f205e5b..4a6cb3b 100644
--- a/stgit/config.py
+++ b/stgit/config.py
@@ -37,7 +37,7 @@ class GitConfig:
'stgit.keepoptimized': 'no',
'stgit.extensions': '.ancestor .current .patched',
'stgit.shortnr': '5',
- 'stgit.pager': 'less -FRSX'
+ 'stgit.pager': 'less'
}
__cache = None
@@ -121,6 +121,7 @@ def config_setup():
global config
os.environ.setdefault('PAGER', config.get('stgit.pager'))
+ os.environ.setdefault('LESS', '-FRSX')
# FIXME: handle EDITOR the same way ?
class ConfigOption:
--
Catalin