From 152a9e9a03d8c5ead25e9a0ecfe46aa527bf0257 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sun, 5 Apr 2026 07:36:12 +0800 Subject: Snapshot first and last. --- vcx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/vcx b/vcx index cf8b4bc..cbe5620 100644 --- a/vcx +++ b/vcx @@ -22,7 +22,7 @@ use constant REV_DIR => VCX_DIR . '/rev'; # Commits use constant TMP_DIR => VCX_DIR . '/index'; use constant TMP_TREE => TMP_DIR . '/tree'; use constant TMP_DIFF => TMP_DIR . '/deltas'; -use constant TMP_META_FILE => TMP_DIR . '/meta'; +use constant TMP_META => TMP_DIR . '/meta'; Getopt::Long::Configure("bundling"); @@ -160,7 +160,7 @@ sub run_add { my $next_id_hex = to_hex_id(from_hex_id($head) + 1); my %entries; - open my $afh, '>>', TMP_META_FILE or die $!; + open my $afh, '>>', TMP_META or die $!; init_stage($latest_tree_dir, \%entries); @@ -202,15 +202,12 @@ sub run_add { # CASE 2: Symlink elsif (-l _) { my $target = readlink($File::Find::name); - if (-l $prev_link) { return if readlink($prev_link) eq $target; } - if (-l $staged_path) { return if readlink($staged_path) eq $target; } - stage_link($File::Find::name, $staged_path); } }, @@ -251,7 +248,7 @@ sub run_add { sub run_commit { my ($msg) = @_; - my $content_changed = -s TMP_META_FILE; + my $content_changed = -s TMP_META; my ($staged_tree_ptr) = bsd_glob(File::Spec->catfile(TMP_DIR, "tree-*")); my ($tree_hash) = $staged_tree_ptr =~ /tree-([a-f0-9]{40})$/; @@ -277,8 +274,8 @@ sub run_commit { make_path($rev_dir); # Save file to store - if (-e TMP_META_FILE) { - open my $mfh, '<', TMP_META_FILE or die $!; + if (-e TMP_META) { + open my $mfh, '<', TMP_META or die $!; while (my $rel = <$mfh>) { chomp $rel; my $obj_name = sha1_hex($rel); -- cgit v1.2.3