From 3713e2226bcda64513efd537f370ce4d7f767a1e Mon Sep 17 00:00:00 2001 From: Dmitry Statyvka Date: Fri, 30 Jul 2010 04:30:13 +0200 Subject: git svn: add an option to recode pathnames Introduce a new option 'svn.pathnameencoding' that instructs git svn to recode pathnames to a given encoding. It can be used by windows users and by those who work in non-utf8 locales to avoid corrupted file names with non-ascii characters. [rp: renamed the option and added manpage documentation] Signed-off-by: Dmitry Statyvka Signed-off-by: Robert Pollak Acked-by: Eric Wong --- git-svn.perl | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'git-svn.perl') diff --git a/git-svn.perl b/git-svn.perl index c4163584a..c92238ece 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -4050,6 +4050,7 @@ sub new { $self->{absent_dir} = {}; $self->{absent_file} = {}; $self->{gii} = $git_svn->tmp_index_do(sub { Git::IndexInfo->new }); + $self->{pathnameencoding} = Git::config('svn.pathnameencoding'); $self; } @@ -4133,6 +4134,10 @@ sub open_directory { sub git_path { my ($self, $path) = @_; + if (my $enc = $self->{pathnameencoding}) { + require Encode; + Encode::from_to($path, 'UTF-8', $enc); + } if ($self->{path_strip}) { $path =~ s!$self->{path_strip}!! or die "Failed to strip path '$path' ($self->{path_strip})\n"; @@ -4521,6 +4526,10 @@ sub split_path { sub repo_path { my ($self, $path) = @_; + if (my $enc = $self->{pathnameencoding}) { + require Encode; + Encode::from_to($path, $enc, 'UTF-8'); + } $self->{path_prefix}.(defined $path ? $path : ''); } -- cgit v1.2.1 From 181264ad590ffef9d956fdd023369869c2d0a55f Mon Sep 17 00:00:00 2001 From: "David D. Kilzer" Date: Mon, 2 Aug 2010 12:58:19 -0700 Subject: git svn: fix dcommit to work with touched files The dcommit command fails if an otherwise unmodified file has been touched in the working directory: Cannot dcommit with a dirty index. Commit your changes first, or stash them with `git stash'. This happens because "git diff-index" reports a difference between the index and the filesystem: :100644 100644 d00491...... 000000...... M file The fix is to run "git update-index --refresh" before "git diff-index" as is done in git-rebase and git-rebase--interactive before "git diff-files". This changes dcommit to display a list of modified files before exiting. Also add a similar test case for "git svn rebase". [ew: rearranged commit message subject] Signed-off-by: David D. Kilzer Acked-by: Eric Wong --- git-svn.perl | 1 + 1 file changed, 1 insertion(+) (limited to 'git-svn.perl') diff --git a/git-svn.perl b/git-svn.perl index c92238ece..8d2ef3d16 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -494,6 +494,7 @@ sub cmd_set_tree { sub cmd_dcommit { my $head = shift; + command_noisy(qw/update-index --refresh/); git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) } 'Cannot dcommit with a dirty index. Commit your changes first, ' . "or stash them with `git stash'.\n"; -- cgit v1.2.1