File: git-compl-lib

package info (click to toggle)
git-completion 0%2B20060817-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 84 kB
  • ctags: 1
  • sloc: makefile: 30
file content (66 lines) | stat: -rw-r--r-- 1,290 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# 'git' bash completion and library routines used by porcelain completions.
#
# Copyright (c) Paolo Giarrusso, 2005
# Copyright (c) Ben Clifford, 2005
#
# The master version is available at:
#       http://www.hawaga.org.uk/gitcompletion.git

bashdefault="-o bashdefault"
default="-o default"

__git_tags()
{
    REVERTGLOB=`shopt -p nullglob`
    shopt -s nullglob
    if [ -n ".git/refs/tags/*" ] ; then
        for i in $(echo .git/refs/tags/*); do
            echo ${i#.git/refs/tags/}
        done
    fi
    $REVERTGLOB
}

__git_heads()
{
    REVERTGLOB=`shopt -p nullglob`
    shopt -s nullglob
    if [ -n ".git/refs/heads/*" ] ; then
        for i in $(echo .git/refs/heads/*); do
            echo ${i#.git/refs/heads/}
        done
    fi
    $REVERTGLOB
}
 
__git_remotes()
{
    REVERTGLOB=`shopt -p nullglob`
    shopt -s nullglob
    if [ -n ".git/remotes/*" ] ; then
        for i in $(echo .git/remotes/*); do
            echo ${i#.git/remotes/}
        done
    fi
    $REVERTGLOB
}
 
__git_refs()
{
   __git_heads
   __git_tags
    echo HEAD
}

__git_repo_urls()
{
    REVERTGLOB=`shopt -p nullglob`
    shopt -s nullglob
    if [ -n ".git/branches/*" ] ; then
        for i in $(echo .git/branches/*); do
            head -n 1 ${i}
        done
    fi
    $REVERTGLOB
}