File: test_windows_cmd_escaping.rb

package info (click to toggle)
ruby-git 1.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,124 kB
  • sloc: ruby: 5,385; sh: 507; perl: 64; makefile: 6
file content (22 lines) | stat: -rw-r--r-- 745 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env ruby
# encoding: utf-8

require File.dirname(__FILE__) + '/../test_helper'

# Test diff when the file path has to be quoted according to core.quotePath
# See https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath
#
class TestWindowsCmdEscaping < Test::Unit::TestCase
  def test_commit_with_double_quote_in_commit_message
    expected_commit_message = 'Commit message with "double quotes"'
    in_temp_dir do |path|
      create_file('README.md', "# README\n")
      git = Git.init('.')
      git.add
      git.commit(expected_commit_message)
      commits = git.log(1)
      actual_commit_message = commits.first.message
      assert_equal(expected_commit_message, actual_commit_message)
    end
  end
end