summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2026-04-19 11:16:54 +0800
committerSadeep Madurange <sadeep@asciimx.com>2026-04-19 11:16:54 +0800
commit5d19dc06cf3760d0300c90959bb4e392eb02dcbe (patch)
treeee1064833902c38b1c7fdf5d112ecf332473f25e
parent58f70660e29a98056cbe5e5ba00c6eb471097b49 (diff)
downloadurn-5d19dc06cf3760d0300c90959bb4e392eb02dcbe.tar.gz
Fix undefined paths in status command.
-rw-r--r--urn15
1 files changed, 10 insertions, 5 deletions
diff --git a/urn b/urn
index c9d8e14..7e6a07c 100644
--- a/urn
+++ b/urn
@@ -91,16 +91,21 @@ sub run_status {
# Iterate while any of the three sources have entries
while ($idx || $wrk || $old) {
+ # Extract paths safely to avoid "uninitialized" errors on undef iterators
+ my $p_idx = $idx ? $idx->{path} : undef;
+ my $p_wrk = $wrk ? $wrk->{path} : undef;
+ my $p_old = $old ? $old->{path} : undef;
+
# Find the alphabetically "lowest" path among the three streams
- my $path = (sort grep { defined } ($idx->{path}, $wrk->{path}, $old->{path}))[0];
+ my $path = (sort grep { defined } ($p_idx, $p_wrk, $p_old))[0];
my $flag = "";
my $suffix = "";
- # Logical check for Deletions (In Old Tree, but missing elsewhere)
- my $in_old = (defined $old && $old->{path} eq $path);
- my $in_idx = (defined $idx && $idx->{path} eq $path);
- my $in_wrk = (defined $wrk && $wrk->{path} eq $path);
+ # Logical check using extracted path strings
+ my $in_old = (defined $p_old && $p_old eq $path);
+ my $in_idx = (defined $p_idx && $p_idx eq $path);
+ my $in_wrk = (defined $p_wrk && $p_wrk eq $path);
if ($in_old && !$in_idx) {
# File existed in last commit but is gone from index -> Staged for Deletion