-
Notifications
You must be signed in to change notification settings - Fork 1
/
git-missing.sh
executable file
·77 lines (65 loc) · 1.28 KB
/
git-missing.sh
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
#!/bin/bash
#
# git-missing.sh: show missing commits between branches
#
# Copyright (C) 2012 Paul Harris <[email protected]>
#
if [ $# -eq 0 ]; then
set -- -h
fi
OPTS_SPEC="\
git missing [options] <commit>
--
d show debug messages
oneline show oneline log messages
p,patch show patch
"
eval "$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)"
PATH=$PATH:$(git --exec-path)
. git-sh-setup
debug=
log_opts=""
debug()
{
if [ -n "$debug" ]; then
echo "$@" >&2
fi
}
assert()
{
if "$@"; then
:
else
die "assertion failed: " "$@"
fi
}
#echo "Options: $*"
while [ $# -gt 0 ]; do
opt="$1"
shift
case "$opt" in
-d) debug=1 ;;
--) break ;;
*) log_opts="${log_opts} $opt" ;;
esac
done
branch="$1"
debug "branch: {$branch}"
debug "log_opts: {$log_opts}"
debug "debug: {$debug}"
debug
if [ -z "$branch" ]; then
die "You must provide the commit."
fi
debug "OUR: git log ${log_opts} $branch:HEAD"
(
echo "You have these extra commits:"
echo "------------------------------------------------------------"
git log --color=always ${log_opts} $branch..HEAD
echo
echo
echo
echo "You are missing these commits:"
echo "------------------------------------------------------------"
git log --color=always ${log_opts} HEAD..$branch
) | less -r