Skip to content

Commit a137ead

Browse files
committed
flatten: interactive is an option, like in rebase
1 parent 8783111 commit a137ead

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

git-flatten.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def interactive_edit ref, revs, squash, opts={}
175175
USAGE
176176
end
177177
end
178-
system git_editor, filename
178+
system git_editor, filename if opts[:interactive]
179179
res = []
180180
File.open(filename) do |file|
181181
file.each_line do |line|
@@ -223,12 +223,12 @@ def flatten ref, refs, opts={}
223223
squash = opts[:squash] || []
224224
orig = parse_flatten ref, :read => true
225225
target = rev_list ref,
226-
"^#{git_branch}",
227-
"^#{orig}",
226+
"^#{git_branch}", "^#{orig}",
228227
*[refs, squash.map{|s| "^#{s}"}].flatten
229228
stored_last = store_last
230229
last = stored_last
231-
revs = interactive_edit orig, target, squash
230+
revs = interactive_edit orig, target, squash,
231+
:interactive => opts[:interactive]
232232
revs.each do |action, abbrev, str|
233233
hash = ref_to_hash abbrev
234234
if stored_last
@@ -274,6 +274,8 @@ def flatten ref, refs, opts={}
274274
case arg
275275
when /-h|--help/
276276
usage
277+
when /-i|--interactive/
278+
opts[:interactive] = true
277279
when /-s|--squash/
278280
opts[:squash] ||= []
279281
opts[:squash] << (arg =~ /=/ ? arg.sub(/.*=\s*/,'') : args.shift )

0 commit comments

Comments
 (0)