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
|
# File 'lib/git/whence.rb', line 10
def run(argv)
options = parse_options(argv)
commit = argv[0]
unless system("git rev-parse --git-dir 2>&1 >/dev/null")
warn "Not in a git directory"
return 1
end
commit = expand(commit)
if is_merge?(commit)
warn "Commit is a merge"
show_commit(commit, options)
1
else
if merge = find_merge(commit)
show_commit(merge, options)
0
else
warn "Unable to find merge"
show_commit(commit, options) if options[:open]
1
end
end
end
|