--- a/shelldap Tue Mar 19 16:36:30 2013 -0700
+++ b/shelldap Thu Apr 18 12:06:48 2013 -0700
@@ -1511,6 +1511,7 @@
if ( $hash_orig eq $self->chksum($self->{'ldif_fname'}) ) {
print "Entry not modified.\n";
unlink $self->{'ldif_fname'};
+ $self->{'edit_again'} = undef;
return;
}
@@ -1523,6 +1524,7 @@
}
else {
unlink $self->{'ldif_fname'};
+ $self->{'edit_again'} = undef;
return;
}
}
@@ -1554,7 +1556,7 @@
my $diff_bit = $diff->Diff();
my %seen_attr;
- # attr removals
+ # attr removal hunk
#
if ( $diff_bit == 1 ) {
foreach ( $diff->Items(1) ) {
@@ -1564,7 +1566,7 @@
}
}
- # attr insertions
+ # attr insertion hunk
#
if ( $diff_bit == 2 ) {
foreach ( $diff->Items(2) ) {
@@ -1574,9 +1576,12 @@
}
}
- # attr change
+ # attr change hunk
#
if ( $diff_bit == 3 ) {
+
+ # modification to existing line
+ #
foreach ( $diff->Items(2) ) {
my ( $attr, $val ) = $parse->( $_ ) or next;
$self->debug("MODIFY: $_");
@@ -1608,6 +1613,15 @@
$e->replace( $attr => \@new_vals );
}
}
+
+ # deletion within the same hunk
+ #
+ foreach ( $diff->Items(1) ) {
+ my ( $attr, $val ) = $parse->( $_ ) or next;
+ next if $seen_attr{ $attr };
+ $self->debug("DELETE: $_");
+ $e->delete( $attr => [ $val ] );
+ }
}
}
@@ -2143,7 +2157,7 @@
use warnings;
$0 = 'shelldap';
-my $VERSION = '1.0.0';
+my $VERSION = '1.0.1';
use Getopt::Long;
use YAML::Syck;