summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2026-04-05 10:00:18 +0800
committerSadeep Madurange <sadeep@asciimx.com>2026-04-05 10:00:18 +0800
commiteb93a00ae4faafd7b6b3907546515d471c5cc30a (patch)
tree9c578fcb246a071d35f75a9b34c517526fcaf6a8
parent2ca21847adfbc38e83738010f44c854e45e590d5 (diff)
downloadcvn-eb93a00ae4faafd7b6b3907546515d471c5cc30a.tar.gz
Clean up.
-rw-r--r--vcx18
1 files changed, 11 insertions, 7 deletions
diff --git a/vcx b/vcx
index 16c34cd..d6139b5 100644
--- a/vcx
+++ b/vcx
@@ -70,12 +70,13 @@ sub run_init {
}
sub run_status {
- open my $fh, '<', HEAD or die "VCX not initialized.\n";
+ open my $fh, '<', HEAD or die "Not a repository.\n";
my $head = <$fh>; chomp $head; close $fh;
print "On revision [$head]\n";
my %staged_diffs;
my $staged_diff_bundle = TMP_DIFF;
+
if (-e TMP_DIFF) {
my @list = qx(tar -tf '$staged_diff_bundle');
foreach (@list) {
@@ -86,18 +87,21 @@ sub run_status {
my ($tree_ptr) = bsd_glob(File::Spec->catfile(REV_DIR, $head, "tree-*"));
my ($tree_hash) = $tree_ptr =~ /tree-([a-f0-9]{40})$/;
- my $latest_tree_dir = File::Spec->catdir(OBJ_DIR, $tree_hash);
+ my $latest_tree = File::Spec->catdir(OBJ_DIR, $tree_hash);
# Pass 1: Workspace -> History (Detects New and Modified)
find({
wanted => sub {
- return if $File::Find::name =~ /^\.\/\Q${\VCX_DIR}\E/;
+ if ($File::Find::name =~ /\/\Q${\VCX_DIR}\E$/ || $_ eq VCX_DIR) {
+ $File::Find::prune = 1;
+ return;
+ }
return if -d $File::Find::name;
my $rel = File::Spec->abs2rel($File::Find::name, '.');
$rel =~ s|^\./||;
- my $base_in_tree = File::Spec->catfile($latest_tree_dir, $rel);
+ my $base_in_tree = File::Spec->catfile($latest_tree, $rel);
my $path_hash = sha1_hex($rel);
if (-e $base_in_tree || -l $base_in_tree) {
@@ -116,11 +120,11 @@ sub run_status {
}, '.');
# Pass 2: History -> Workspace (Detects Deletions)
- if (-d $latest_tree_dir) {
+ if (-d $latest_tree) {
find({
wanted => sub {
return if -d $_;
- my $rel = File::Spec->abs2rel($_, $latest_tree_dir);
+ my $rel = File::Spec->abs2rel($_, $latest_tree);
# If it's in the commit tree but GONE from the workspace
if (!-e $rel && !-l $rel) {
@@ -130,7 +134,7 @@ sub run_status {
}
},
no_chdir => 1
- }, $latest_tree_dir);
+ }, $latest_tree);
}
}