57
57
when /--config-dir=(.*)?/
58
58
# Spaces in the directory should be fine since this whole thing is passed
59
59
# as a single argument via the multi-arg syntax for system() below.
60
- # TODO: Test this spaces business. I don't buy it. -todb
61
60
@configdir = $1
62
61
@configdir_index = i
62
+ when /--git-remote=([^\s ]*)?/
63
+ @git_remote = $1
64
+ @git_remote_index = i
65
+ when /--git-branch=([^\s ]*)?/
66
+ @git_branch = $1
67
+ @git_branch_index = i
63
68
end
64
69
end
65
70
66
71
@args [ @wait_index ] = nil if @wait_index
67
72
@args [ @configdir_index ] = nil if @configdir_index
73
+
74
+ @args [ @git_remote_index ] = nil if @git_remote_index
75
+ @args [ @git_branch_index ] = nil if @git_branch_index
68
76
@args = @args . compact
69
77
70
78
####### Since we're SVN, do it all this way #######
89
97
90
98
####### Since we're Git, do it all that way #######
91
99
if is_git
100
+ remote = @git_remote || "origin"
101
+ branch = @git_branch || "master"
92
102
# Always lose any local changes, but not unchecked files
103
+ # This is actually safer than the old svn way of msfupdate
104
+ # which would happily just generate conflicts over changes.
93
105
# TODO: Allow for git stash and git stash pop
94
106
res = system ( "git" , "reset" , "HEAD" , "--hard" )
95
107
if res . nil?
@@ -101,10 +113,9 @@ if is_git
101
113
exit 1
102
114
end
103
115
104
- # TODO: Allow msfupdate to take a branch argument
105
- system ( "git" , "checkout" , "master" )
116
+ system ( "git" , "checkout" , branch )
106
117
system ( "git" , "fetch" )
107
- system ( "git" , "merge" , "origin/master " )
118
+ system ( "git" , "merge" , "#{ remote } / #{ branch } " )
108
119
end
109
120
110
121
unless is_svn || is_git
0 commit comments