Skip to content

Commit

Permalink
add -e option to select editor for git-re-edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Dominus committed Jan 1, 2013
1 parent 435ada9 commit 0e7ce08
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion git-re-edit
Expand Up @@ -8,6 +8,11 @@
# stuff you were working on before. Useful following a failed merge.
#

use Getopt::Std;
my %opt = ( e => $ENV{VISUAL} || $ENV{EDITOR} || "emacs",
);
getopts('e:', \%opt) or usage();

chomp(my @changed = grep !/^\?\? /, qx{git status --porcelain});
exit 1 unless $? == 0;
s/^.. // or die "<$_>???\n" for @changed;
Expand All @@ -20,6 +25,6 @@ exit 1 unless $? == 0;

# maybe should use output of "git var GIT_EDITOR" here?
# But then I have to involve the !@&*!@*(&!@ shell
my $ed = $ENV{VISUAL} || $ENV{EDITOR} || "emacs";
my $ed = $opt{e};
exec $ed, @lines;
die "exec $ed: $!\n";

0 comments on commit 0e7ce08

Please sign in to comment.