Bug 446506

Summary: git modifies COMP_WORDBREAKS
Product: [openSUSE] openSUSE 11.1 Reporter: Ludwig Nussel <lnussel>
Component: OtherAssignee: Petr Baudis <pbaudis>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: tiwai, werner
Version: Beta 5   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on: 446504    
Bug Blocks:    

Description Ludwig Nussel 2008-11-19 11:16:45 UTC
/etc/bash_completion.d/git.sh adds a colon to COMP_WORDBREAKS.
This setting not only affects git completions but the whole system. git
shouldn't decide whether or not COMP_WORDBREAKS may contain a colon but should
be able to deal with any setting (like other scripts do).
Comment 1 Takashi Iwai 2008-11-19 11:29:25 UTC
This is actually a workaround against other completion scrips dropping the colon explicitly from COMP_WORDBREAKS...  The commit is below.

commit db8a9ff03831a26aa8bfad8bb026b90739d684ec
Author: Shawn O. Pearce <spearce@spearce.org>
Date:   Tue Jul 15 05:52:04 2008 +0000

    bash completion: Resolve git show ref:path<tab> losing ref: portion
    
    Linus reported that the bash completion for git show often dropped
    the ref portion of the argument (stuff before the :) when trying
    to complete a file name of a file in another branch or tag.
    
    Björn Steinbrink tracked it down to the gvfs completion script
    which comes standard on many Fedora Core based systems.  That is
    removing : from COMP_WORDBREAKS, making readline treat the entire
    argument (including the ref) as the name that must be completed.
    When the git completion routines supplied a completion of just the
    filename, readline replaced everything.
    
    Since Git users often need to use "ref:path" or "ref:ref" sort of
    arguments, and expect completion support on both sides of the :
    we really want the : in COMP_WORDBREAKS to provide a good user
    experience.  This is also the default that ships with bash as it
    can be useful in other contexts, such as rcp/scp.
    
    We now try to add : back to COMP_WORDBREAKS if it has been removed
    by a script that loaded before us.  However if this doesn't work
    (as the : is stripped after we load) we fallback in the completion
    routines to include "ref:" as part of the prefix for completions,
    allowing readine to fully insert the argument the user wanted.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Comment 2 Ludwig Nussel 2008-11-19 13:09:58 UTC
yes, that's why I opened bug 446504 too :) It's absurd if individual packages play ping-pong with this value.
Comment 3 Petr Baudis 2008-11-19 18:56:07 UTC
Ok, but I'd like that one to be fixed first. ;-)
Comment 4 Petr Baudis 2010-06-01 01:14:01 UTC
Committing a fix, finally. :)