logging: Check if typescripts with a similar name already exist
[sunny256-utils.git] / git-wn
blob5274c74927fce37394058fe7f6590c6f7ea2fcf6
1 #!/usr/bin/env bash
3 #=======================================================================
4 # git-wn
5 # File ID: 149ce758-8aca-11e0-afed-37ea9f2067e0
7 # "git what's new", show descendants of a specific commit
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
13 progname=git-wn
14 VERSION=0.3.0
16 ARGS="$(getopt -o "\
22 " -l "\
23 help,\
24 patch,\
25 quiet,\
26 verbose,\
27 word-diff,\
28 version,\
29 " -n "$progname" -- "$@")"
30 test "$?" = "0" || exit 1
31 eval set -- "$ARGS"
33 opt_help=0
34 opt_patch=0
35 opt_quiet=0
36 opt_verbose=0
37 opt_word_diff=0
38 while :; do
39 case "$1" in
40 -h|--help) opt_help=1; shift ;;
41 -p|--patch) opt_patch=1; shift ;;
42 -q|--quiet) opt_quiet=$(($opt_quiet + 1)); shift ;;
43 -v|--verbose) opt_verbose=$(($opt_verbose + 1)); shift ;;
44 -w|--word-diff) opt_word_diff=1; shift ;;
45 --version) echo $progname $VERSION; exit 0 ;;
46 --) shift; break ;;
47 *) echo $progname: Internal error >&2; exit 1 ;;
48 esac
49 done
50 opt_verbose=$(($opt_verbose - $opt_quiet))
52 if test "$opt_help" = "1"; then
53 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
54 cat <<END
56 "git what's new", show descendants of a specific commit. For example,
57 after "git fetch", list all new commits.
59 Usage: $progname [options] [commit] [git_log_args]
61 Options:
63 -h, --help
64 Show this help.
65 -p, --patch
66 Use extended format with patch.
67 -q, --quiet
68 Be more quiet. Can be repeated to increase silence.
69 -v, --verbose
70 Increase level of verbosity. Can be repeated.
71 -w, --word-diff
72 Same as -p, but use word diff instead
73 --version
74 Print version information.
76 If commit is not specified, use HEAD. To use git_log_args, a
77 commit/branch/tag/whatever has to be specified as \$1.
79 END
80 exit 0
83 unset word_diff_str
84 test "$opt_word_diff" = "1" && { opt_patch=1; word_diff_str="--word-diff"; }
86 unset branches
87 from="$1"
88 shift
89 test -z "$from" && from=HEAD
90 git log -1 $from &>/dev/null || { echo $from: Invalid ref >&2; exit 1; }
91 log_args="$@"
93 for f in $(git lc $from); do
94 branches="$branches $from..$f"
95 done
97 if test "$opt_patch" = "1"; then
98 git log --date-order --date=iso --decorate=short --format=fuller --graph \
99 $word_diff_str -c -p $log_args $branches
100 else
101 git log --abbrev-commit --date-order --decorate=short --graph \
102 --pretty=format:'%Cred%h %Cblue%p%Creset -%Creset %s %Cgreen(%cd %Cblue%an%Cgreen)%Creset%C(yellow)%d%Creset' \
103 $log_args $branches