Skip to content

Commit be20427

Browse files
committed
Restore MERGE_HEAD and CHERRY_PICK_HEAD without newline
Including the trailing newline results in an error on Windows: fatal: Corrupt MERGE_HEAD file (<commit-hash>)
1 parent e4eb718 commit be20427

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/overcommit/git_repo.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def restore_merge_state
167167
FileUtils.touch(File.expand_path('MERGE_MODE', Overcommit::Utils.git_dir))
168168

169169
File.open(File.expand_path('MERGE_HEAD', Overcommit::Utils.git_dir), 'w') do |f|
170-
f.write("#{@merge_head}\n")
170+
f.write(@merge_head)
171171
end
172172
@merge_head = nil
173173
end
@@ -186,7 +186,7 @@ def restore_cherry_pick_state
186186
if @cherry_head
187187
File.open(File.expand_path('CHERRY_PICK_HEAD',
188188
Overcommit::Utils.git_dir), 'w') do |f|
189-
f.write("#{@cherry_head}\n")
189+
f.write(@cherry_head)
190190
end
191191
@cherry_head = nil
192192
end

0 commit comments

Comments
 (0)