Get the right file linked to the inode directory
authorZygo Blaxell <zblaxell@esightcorp.com>
Thu, 13 May 2010 20:41:13 +0000 (16:41 -0400)
committerZygo Blaxell <zblaxell@esightcorp.com>
Thu, 13 May 2010 20:41:13 +0000 (16:41 -0400)
dm6

diff --git a/dm6 b/dm6
index b0ff96b84b633c717bf0516038f74e6ae2be494d..c6f93d906e94025621b230a6baa07e83dda44a5f 100755 (executable)
--- a/dm6
+++ b/dm6
@@ -156,6 +156,10 @@ while (<STDIN>) {
                                        undef $digest_st;
                                }
                        }
                                        undef $digest_st;
                                }
                        }
+                       print STDERR "\b";
+
+                       # Which file are we keeping?
+                       my $keep_file;
 
                        # If digest link exists, link it to file
                        if ($digest_st) {
 
                        # If digest link exists, link it to file
                        if ($digest_st) {
@@ -165,14 +169,17 @@ while (<STDIN>) {
                                # Old, replace input with old file
                                print STDERR '-';
                                link_files($digest_link, $file);
                                # Old, replace input with old file
                                print STDERR '-';
                                link_files($digest_link, $file);
+                               $keep_file = $digest_link;
                        } else {
                                # New, add input to digest
                                print STDERR '+';
                                link_files($file, $digest_link);
                        } else {
                                # New, add input to digest
                                print STDERR '+';
                                link_files($file, $digest_link);
+                               $keep_file = $file;
                        }
 
                        # A link to the inode indicates we are done, so do it last
                        }
 
                        # A link to the inode indicates we are done, so do it last
-                       link_files($file, $inode_link);
+                       print STDERR '_';
+                       link_files($keep_file, $inode_link);
 
                }
        };
 
                }
        };