* updated yet more dir-less .cache DEPs
[t2sde.git] / package / develop / git / svn-messages-prog.patch
blobf65446a952fe0f8f688fd0cbeb30d6d95a77e7e9
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/git/svn-messages-prog.patch
3 # Copyright (C) 2024 The T2 SDE Project
4 #
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
7 #
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 https://stackoverflow.com/questions/10764746/how-to-modify-commit-messages-when-converting-from-svn-to-git
16 --- git-2.45.2/perl/Git/SVN.pm.vanilla 2024-06-17 11:21:39.989933253 +0200
17 +++ git-2.45.2/perl/Git/SVN.pm 2024-06-17 11:31:23.862909973 +0200
18 @@ -9,6 +9,7 @@
19 $_use_log_author $_add_author_from $_localtime $_use_fsync/;
20 use Carp qw/croak/;
21 use File::Path qw/mkpath/;
22 +use IPC::Open2;
23 use IPC::Open3;
24 use Memoize; # core since 5.8.0, Jul 2002
25 use POSIX qw(:signal_h);
26 @@ -1473,6 +1474,22 @@
27 $gs
30 +sub call_messages_prog {
31 + my ($orig_message) = @_;
32 + my ($pid, $in, $out);
34 + $pid = open2($in, $out, $::_messages_prog)
35 + or die "$::_messages_prog failed with exit code $?\n";
36 + print $out $orig_message;
37 + close($out);
38 + my ($message) = "";
39 + while (<$in>) {
40 + $message .= $_;
41 + }
42 + close($in);
43 + return $message;
46 sub call_authors_prog {
47 my ($orig_author) = @_;
48 $orig_author = command_oneline('rev-parse', '--sq-quote', $orig_author);
49 @@ -1973,6 +1990,9 @@
51 $log_entry{date} = parse_svn_date($log_entry{date});
52 $log_entry{log} .= "\n";
53 + if (defined $::_messages_prog) {
54 + $log_entry{log} = call_messages_prog($log_entry{log});
55 + }
56 my $author = $log_entry{author} = check_author($log_entry{author});
57 my ($name, $email) = defined $::users{$author} ? @{$::users{$author}}
58 : ($author, undef);
59 --- git-2.45.2/git-svn.perl.vanilla 2024-05-31 02:43:41.000000000 +0200
60 +++ git-2.45.2/git-svn.perl 2024-06-17 11:10:55.627958946 +0200
61 @@ -7,7 +7,7 @@
62 use vars qw/ $AUTHOR $VERSION
63 $oid $oid_short $oid_length
64 $_revision $_repository
65 - $_q $_authors $_authors_prog %users/;
66 + $_q $_authors $_authors_prog $_messages_prog %users/;
67 $AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
68 $VERSION = '@@GIT_VERSION@@';
70 @@ -130,6 +130,7 @@
71 my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
72 'authors-file|A=s' => \$_authors,
73 'authors-prog=s' => \$_authors_prog,
74 + 'messages-prog=s' => \$_messages_prog,
75 'repack:i' => \$Git::SVN::_repack,
76 'noMetadata' => \$Git::SVN::_no_metadata,
77 'useSvmProps' => \$Git::SVN::_use_svm_props,
78 @@ -364,6 +365,11 @@
79 $_authors_prog = "'" . $abs_file . "'" if -x $abs_file;
82 +if (defined $_messages_prog) {
83 + my $abs_file = File::Spec->rel2abs($_messages_prog);
84 + $_messages_prog = "'" . $abs_file . "'" if -x $abs_file;
87 unless ($cmd =~ /^(?:clone|init|multi-init|commit-diff)$/) {
88 Git::SVN::Migration::migration_check();