@@ -101,11 +101,17 @@ end
101
101
if is_git
102
102
remote = @git_remote || "origin"
103
103
branch = @git_branch || "master"
104
- # Always lose any local changes, but not unchecked files
105
- # This is actually safer than the old svn way of msfupdate
106
- # which would happily just generate conflicts over changes.
107
- # TODO: Allow for git stash and git stash pop
108
- res = system ( "git" , "reset" , "HEAD" , "--hard" )
104
+ # This will save local changes in a stash, but won't
105
+ # attempt to reapply them. If the user wants them back
106
+ # they can always git stash pop them, and that presumes
107
+ # they know what they're doing when they're editing local
108
+ # checkout, which presumes they're not using msfupdate
109
+ # to begin with.
110
+ #
111
+ # Note, this requires at least user.name and user.email
112
+ # to be configured in the global git config. Installers should
113
+ # take care that this is done. TODO: Enforce this in msfupdate
114
+ res = system ( "git" , "stash" )
109
115
if res . nil?
110
116
$stderr. puts "[-] ERROR: Failed to run git"
111
117
$stderr. puts ""
@@ -115,6 +121,7 @@ if is_git
115
121
exit 1
116
122
end
117
123
124
+ system ( "git" , "reset" , "HEAD" , "--hard" )
118
125
system ( "git" , "checkout" , branch )
119
126
system ( "git" , "fetch" )
120
127
system ( "git" , "merge" , "#{ remote } /#{ branch } " )
0 commit comments