Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Handle ignored files with quoted (non-ASCII) filenames #694

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/git/lib.rb
Expand Up @@ -559,9 +559,7 @@ def ls_files(location=nil)
command_lines('ls-files', '--stage', location).each do |line|
(info, file) = line.split("\t")
(mode, sha, stage) = info.split
if file.start_with?('"') && file.end_with?('"')
file = Git::EscapedPath.new(file[1..-2]).unescape
end
file = unescape_if_quoted(file)
hsh[file] = {:path => file, :mode_index => mode, :sha_index => sha, :stage => stage}
end
hsh
Expand All @@ -586,6 +584,15 @@ def ls_remote(location=nil, opts={})

def ignored_files
command_lines('ls-files', '--others', '-i', '--exclude-standard')
.map { |f| unescape_if_quoted(f) }
end

def unescape_if_quoted(file)
if file.start_with?('"') && file.end_with?('"')
Git::EscapedPath.new(file[1..-2]).unescape
else
file
end
end


Expand Down