diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2026-04-19 11:16:54 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2026-04-19 11:16:54 +0800 |
| commit | 5d19dc06cf3760d0300c90959bb4e392eb02dcbe (patch) | |
| tree | ee1064833902c38b1c7fdf5d112ecf332473f25e | |
| parent | 58f70660e29a98056cbe5e5ba00c6eb471097b49 (diff) | |
| download | urn-5d19dc06cf3760d0300c90959bb4e392eb02dcbe.tar.gz | |
Fix undefined paths in status command.
| -rw-r--r-- | urn | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -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 |
