File tree 3 files changed +23
-4
lines changed
3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change
1
+ . * .swp
Original file line number Diff line number Diff line change @@ -75,5 +75,16 @@ def am_info
75
75
def to_be_committed
76
76
@git . diff_index ( { :cached => true , :name_only => true } , "HEAD" ) . split ( "\n " )
77
77
end
78
+
79
+ def path2ref ( name )
80
+ name . gsub %r!^refs/heads/! , ""
81
+ end
82
+
83
+ def merge_ref ( branch )
84
+ repo = @git . config ( { } , "branch.#{ branch } .remote" ) . strip
85
+ ref = @git . config ( { } , "branch.#{ branch } .merge" ) . strip
86
+ path = "#{ repo } /#{ path2ref ( ref ) } "
87
+ return path
88
+ end
78
89
end
79
90
end
Original file line number Diff line number Diff line change 35
35
36
36
STDOUT . sync = true
37
37
38
- top = `git rev-parse --show-cdup 2>&1` . strip
38
+ # cd to the top of this git tree. If run via git's alias
39
+ # infrastructure, this is done for us. We do it again, just
40
+ # to be sure.
39
41
42
+ top = `git rev-parse --show-cdup 2>&1` . strip
40
43
Dir . chdir top unless top . empty?
41
44
42
45
repo = Grit ::Repo . new ( "." )
48
51
# TODO parse +out+ for details to show the user.
49
52
50
53
current = repo . resolve_rev "HEAD"
51
- origin = repo . resolve_rev "origin"
52
-
53
54
branch = repo . git . symbolic_ref ( { :q => true } , "HEAD" ) . strip
54
55
56
+ branch_name = branch . gsub %r!^refs/heads/! , ""
57
+
58
+ origin_ref = repo . merge_ref branch_name
59
+ origin = repo . resolve_rev origin_ref
60
+
55
61
common = repo . find_ancestor ( origin , current )
56
62
57
63
to_replay = repo . revs_between ( common , current )
58
64
to_receive = repo . revs_between ( common , origin )
59
65
60
66
if opts . analyze
67
+ puts "Automatically merging in refs from: #{ origin_ref } / #{ origin [ 0 , 7 ] } "
61
68
puts "Closest ancestor between HEAD and origin: #{ common [ 0 , 7 ] } "
62
69
puts
63
70
68
75
69
76
puts "#{ to_receive . size } new commits."
70
77
if opts . verbose
71
- system "git log --pretty=oneline #{ common } ..origin "
78
+ system "git log --pretty=oneline #{ common } ..#{ origin_ref } "
72
79
puts
73
80
end
74
81
You can’t perform that action at this time.
0 commit comments