]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-edit
public-inbox v1.2.0
[public-inbox.git] / script / public-inbox-edit
index 16d785294f49bcb79a62620af2a5548437ba508c..f2090abfe583992ab6c398213438c3a76a3775d3 100755 (executable)
@@ -65,7 +65,7 @@ sub find_mid ($) {
 
 sub show_cmd ($$) {
        my ($ibx, $smsg) = @_;
-       " GIT_DIR=$ibx->{mainrepo}/all.git \\\n    git show $smsg->{blob}\n";
+       " GIT_DIR=$ibx->{inboxdir}/all.git \\\n    git show $smsg->{blob}\n";
 }
 
 sub show_found () {
@@ -121,7 +121,7 @@ $mids
 
 my $tmpl = 'public-inbox-edit-XXXXXX';
 foreach my $to_edit (values %$found) {
-       my ($edit_fh, $edit_fn) = tempfile($tmpl, TMPDIR => 1);
+       my ($edit_fh, $edit_fn) = tempfile($tmpl, TMPDIR => 1, UNLINK => 1);
        $edit_fh->autoflush(1);
        my ($ibx, $smsg) = @{$to_edit->[0]};
        my $old_raw = $ibx->msg_by_smsg($smsg);
@@ -138,7 +138,7 @@ foreach my $to_edit (values %$found) {
 
        # run the editor, respecting spaces/quote
 retry_edit:
-       if (system(qw(sh -c), qq(eval "$editor" '"\$@"'), '--', $edit_fn)) {
+       if (system(qw(sh -c), $editor.' "$@"', $editor, $edit_fn)) {
                if (!(-t STDIN) && !$opt->{force}) {
                        die "E: $editor failed: $?\n";
                }