-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
When I try to git-meld a commit that has thousands of files in it the safe_cmd() call containing the git archive shell command fails with an error == -1. I'm not sure what the exact problem is, because if I put the command that failed from the Perl script into a bash script and run it, it works.
But, if I change copy_file_names_tree() to call git archive with smaller batches of files it seems to work.
A patch follows; keep in mind that Perl is a non-native language to me, so it's probably less than idiomatic.
diff --git a/git-meld.pl b/git-meld.pl
index e581781..f98a2b6 100755
--- a/git-meld.pl
+++ b/git-meld.pl
@@ -146,8 +146,17 @@ sub copy_files_named_tree($$$) {
if (scalar @$file_list == 0) {
return;
}
- my $escaped_file_list = join(" ", map{shell_escape($_)} @$file_list);
- safe_cmd("cd \$(git rev-parse --show-toplevel) && git archive $tree $escaped_file_list | tar -x -C \"$out_dir\"");
+ #my $escaped_file_list = join(" ", map{shell_escape($_)} @$file_list);
+ #safe_cmd("cd \$(git rev-parse --show-toplevel) && git archive $tree $escaped_file_list | tar -x -C \"$out_dir\"");
+
+ safe_cmd("cd \$(git rev-parse --show-toplevel)");
+ my @flist = @$file_list;
+
+ while (scalar @flist != 0) {
+ my @sub_list = splice @flist, 0, 200;
+ my $escaped_file_list = join(" ", map{shell_escape($_)} @sub_list);
+ safe_cmd("git archive $tree $escaped_file_list | tar -x -C \"$out_dir\"");
+ }
}
# Links the files given as a list in the first argument from the working
Metadata
Metadata
Assignees
Labels
No labels