This file is indexed.

/usr/bin/stg-gitk is in stgit-contrib 0.17.1-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/sh
set -e

# stg-gitk - helper script to graphically display an StGIT stack

# Displays given branches and stacks, without getting disturbed by
# patch logs.

# LIMITATIONS:
# - no support for spaces in branch names

# Copyright (c) 2007 Yann Dirson <ydirson@altern.org>
# Subject to the GNU GPL, version 2.

helptext="Usage: $(basename $0) [--refs] [<branches>|--all] [-- <gitk args>]"

usage()
{
    echo >&2 "$helptext"
    exit 1
}

allbranches=0
refsonly=0
branches=''
while [ "$#" -gt 0 ]; do
    case "$1" in
	--refs) refsonly=1 ;;
	--all) allbranches=1 ;;
	--help) echo "$helptext"; exit 0 ;;
	--) shift; break ;;
	--*) usage ;;
	*) branches="$branches $1" ;;
    esac
    shift
done
# Now any remaining stuff in $@ are additional options for gitk

if [ $allbranches = 1 ] && [ "$branches" != "" ]; then
    usage
fi

GIT_DIR=$(git rev-parse --git-dir)
GIT_DIR_SPKIPLEN=$(printf "$GIT_DIR/X" | wc -c)

refdirs=''
if [ $allbranches = 1 ]; then
    refdirs="$GIT_DIR/refs"
else
    # default to current branch
    if [ "$branches" = "" ]; then
	branches="$(stg branch)"
    fi
    if [ "$branches" = "" ]; then
	echo >&2 "ERROR: cannot find current branch."
	exit 1
    fi

    # expand patches for each named branch
    for b in $branches; do
	if [ -e "$GIT_DIR/refs/patches/$b" ]; then
	    # StGIT branch: show all patches
	    refdirs="$refdirs $GIT_DIR/refs/heads/$b $GIT_DIR/refs/patches/$b"
	elif [ -e "$GIT_DIR/refs/heads/$b" ]; then
	    # other GIT branch
	    refdirs="$refdirs $GIT_DIR/refs/heads/$b"
	elif [ $(git for-each-ref "refs/$b" | wc -l) != 0 ]; then
	    # other ref
	    refdirs="$refdirs $(git for-each-ref --format="$GIT_DIR/%(refname)" "refs/$b")"
	else
	    echo >&2 "ERROR: no such ref '$b'"
	    usage
	fi
    done
fi

printrefs()
{
    find $refdirs -type f -not -name '*.log' | cut -c${GIT_DIR_SPKIPLEN}-
}

if [ $refsonly = 1 ]; then
    printrefs
elif grep -q -- --argscmd $(which gitk); then
    # This gitk supports --argscmd.
    # Let's use a hack to pass --all, which was consumed during command-line parsing
    if [ $allbranches = 1 ]; then
	gitk --argscmd="$0 --refs --all" "$@"
    else
	gitk --argscmd="$0 --refs $branches" "$@"
    fi
else
    # This gitk does not support --argscmd, just compute refs onces
    gitk $(printrefs) "$@"
fi