File: stg-show

package info (click to toggle)
stgit 0.19-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,748 kB
  • sloc: python: 10,558; sh: 5,739; lisp: 2,678; makefile: 142; perl: 42
file content (27 lines) | stat: -rwxr-xr-x 554 bytes parent folder | download | duplicates (8)
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
#!/bin/bash
set -e

# stg-show - unlike "stg show", just "git show" with knowledge of stg refs

# Ex:
# stg-show --color-words -- files

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

command=(git show)

# subsitute git id's for stg ones until --
endofpatches=0
while [ "$#" -gt 0 ]; do
    case "$1" in
	--) endofpatches=1; break ;;
	-*) command+=("$1"); shift ;;
	*) command+=( $(stg id "$1" 2>/dev/null || echo "$1") ); shift ;;
    esac
done

# append remaining args
command+=("$@")

eval "${command[@]}"