summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@ens-lyon.org>2012-02-17 18:59:10 +0100
committerGuilhem Moulin <guilhem.moulin@ens-lyon.org>2012-02-17 18:59:10 +0100
commit653e1ff8bbd9307920cb933d4cb766179d3c3812 (patch)
tree0230eafe158e13053ab914b57910ed727240d5cf
parent32d8b0131bea5bb8dbd485643c9c126064055b5f (diff)
bug fix in revert
-rwxr-xr-xvideomv.pl19
1 files changed, 10 insertions, 9 deletions
diff --git a/videomv.pl b/videomv.pl
index a96e62d..f45d463 100755
--- a/videomv.pl
+++ b/videomv.pl
@@ -539,21 +539,24 @@ else {
my $old_tar;
if (defined $old_symlink) {
$old_tar = readlink $old_symlink;
- &perform ("Deleting old symlink... ", unlink $old_symlink);
+ &perform ("Deleting old symlink... ", unlink $old_symlink) unless $r;
}
-opendir my $DIR, catdir($directors, $old_director) or die "Can't open: $!";
-if (scalar(grep(!/^\.\.?$/, readdir $DIR) == 0)) {
- &perform ("Removing empty dir... ", rmdir catdir($directors, $old_director));
+unless ($r) {
+ opendir my $DIR, catdir($directors, $old_director) or die "Can't open: $!";
+ if (scalar(grep(!/^\.\.?$/, readdir $DIR) == 0)) {
+ &perform ("Removing empty dir... ", rmdir catdir($directors, $old_director));
+ }
+ closedir $DIR or die "Can't close: $!";
}
-closedir $DIR or die "Can't close: $!";
&perform ("Creating new symlink... ",
symlink catfile(updir(),'DIRECTORS',$new_director,$new_filename),
- $new_symlink);
+ $new_symlink)
+ unless $r;
-unless (defined $ignoredb_flag || $old_filename eq $new_filename) {
+unless ($r || defined ($ignoredb_flag) || $old_filename eq $new_filename) {
print LOG "Updating database... ";
if ($nRES == 0) {
$r = 2;
@@ -600,8 +603,6 @@ sub ack {
# Perform the given action; revert successful changes in case of failing
sub perform {
- return if $r;
-
my ($action,$test) = @_;
print LOG $action;