Re: [PATCH v2 00/13] bash prompt speedup

2013-06-18 Thread Simon Oosthoek
* Junio C Hamano  [2013-06-18 09:48:28 -0700]:

> SZEDER Gábor  writes:
> 
> > This patch series eliminates many command substitutions and commands
> > in __git_ps1() from top to bottom by replacing them with bash builtins
> > or consolidating them.  A few timing results are shown in the log
> > message of patch 10.
> 
> Nice.  I think I saw Peff's comment and discussion between you two
> already resuted in a fixup, so perhaps I'll see a reroll sometime
> later when the dust settles?
> 
> Also, could you help review the other topic by Eduardo R. D'Avila
> about colored prompt (Sion Oosthoek, who did the color support,
> CC'ed)?
> 
> http://thread.gmane.org/gmane.comp.version-control.git/228017
> 
> The impression I got when the PROMPT_COMMAND series was discussed
> last October was that you need to use \[...\] pairs to get the
> cursor position right for the purpose of command line editing, and
> D'Avila's series seemed to only do so in PROMPT_COMMAND mode.
> 

Hi Junio e.a.

Unfortunately I'm very busy with lots of stuff, so hardly time to look at this. 
(I didn't read the full patch or resulting file)

The PROMPT_COMMAND business was not something I was glad to use, I was unable 
to get command substitution mode to work with colours and keep bash happy about 
the prompt string length. The thing to test is not whether or not colours 
appear when using substitution in PS1, but to see whether bash will not mess up 
the commandline when browsing through the history. This is especially 
inconvenient with very long commandlines (as you can imagine).

An optimisation which I've not yet had time to work on would be to do a lot of 
the processing in separate functions and use the result in separate functions 
for pcmode and subst. mode. The idea being that the maintainability of the 
logic for generating the prompt goes up (no duplicate code, clear separation, 
etc.) and the size of the called functions to gerenate the prompt goes down. 
And perhaps most important that it would be very easy to build a customised 
version of __git_ps1() using those functions from the standard code. 

I know this is pretty vague, I wish it wasn't so...

If it's somehow possible to eliminate the PROMPT_COMMAND mode, I'm all for it. 
But I doubt it can be done while keeping commandline browsing working ok... 
(please go ahead and prove me wrong!)

Cheers

Simon
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/13] bash prompt speedup

2013-06-18 Thread Junio C Hamano
SZEDER Gábor  writes:

> This patch series eliminates many command substitutions and commands
> in __git_ps1() from top to bottom by replacing them with bash builtins
> or consolidating them.  A few timing results are shown in the log
> message of patch 10.

Nice.  I think I saw Peff's comment and discussion between you two
already resuted in a fixup, so perhaps I'll see a reroll sometime
later when the dust settles?

Also, could you help review the other topic by Eduardo R. D'Avila
about colored prompt (Sion Oosthoek, who did the color support,
CC'ed)?

http://thread.gmane.org/gmane.comp.version-control.git/228017

The impression I got when the PROMPT_COMMAND series was discussed
last October was that you need to use \[...\] pairs to get the
cursor position right for the purpose of command line editing, and
D'Avila's series seemed to only do so in PROMPT_COMMAND mode.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/13] bash prompt speedup

2013-06-17 Thread SZEDER Gábor
Forgot to mention that it's built on top of 2847cae8 (prompt: squelch
error output from cat, 2013-06-14).


Best,
Gábor


On Tue, Jun 18, 2013 at 04:16:53AM +0200, SZEDER Gábor wrote:
> Hi,
> 
> displaying the git-specific bash prompt on Windows/MinGW takes quite
> long, long enough to be noticeable.  This is mainly caused by the
> numerous fork()s and exec()s to create subshells and run git or other
> commands, which are rather expensive on Windows.
> 
> This patch series eliminates many command substitutions and commands
> in __git_ps1() from top to bottom by replacing them with bash builtins
> or consolidating them.  A few timing results are shown in the log
> message of patch 10.
> 
> 
> SZEDER Gábor (13):
>   bash prompt: fix redirection coding style in tests
>   bash prompt: fix here document indentation in interactive rebase test
>   completion, bash prompt: move __gitdir() tests to completion test
> suite
>   bash prompt: add a test for symbolic link symbolic refs
>   bash prompt: return early from __git_ps1() when not in a git
> repository
>   bash prompt: run 'git rev-parse --git-dir' directly instead of
> __gitdir()
>   bash prompt: use bash builtins to find out rebase state
>   bash prompt: use bash builtins to find out current branch
>   bash prompt: use bash builtins to get detached HEAD abbrev. object
> name
>   bash prompt: combine 'git rev-parse' executions
>   bash prompt: use bash builtins to check stash state
>   bash prompt: avoid command substitution when checking for untracked
> files
>   bash prompt: avoid command substitution when finalizing gitstring
> 
>  contrib/completion/git-completion.bash |   2 -
>  contrib/completion/git-prompt.sh   | 223 ---
>  t/t9902-completion.sh  | 134 ++
>  t/t9903-bash-prompt.sh | 319 
> +++--
>  4 files changed, 345 insertions(+), 333 deletions(-)
> 
> -- 
> 1.8.3.1.487.g8f4672d
> 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html