mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
walk: handle removed files correctly
A file that was not checked in, added, and then removed would be shown as modified, and not skipped. It would also be stuck in the index forever. This change skips showing untracked moved files and purges them from the index.
This commit is contained in:
parent
aa0b6bedf4
commit
6fbf81a98f
1 changed files with 10 additions and 3 deletions
|
@ -496,9 +496,14 @@ main(int argc, char **argv)
|
|||
c = strcmp(idx[i].path, wdir[j].path);
|
||||
/* exists in both index and on disk */
|
||||
if(c == 0){
|
||||
if(idx[i].state == 'R' && checkedin(&idx[i], 0))
|
||||
show(o, Rflg, rstr, idx[i].path);
|
||||
else if(idx[i].state == 'A' && !checkedin(&idx[i], 1))
|
||||
if(idx[i].state == 'R'){
|
||||
if(checkedin(&idx[i], 0))
|
||||
show(o, Rflg, rstr, idx[i].path);
|
||||
else{
|
||||
idx[i].state = 'U';
|
||||
staleidx = 1;
|
||||
}
|
||||
}else if(idx[i].state == 'A' && !checkedin(&idx[i], 1))
|
||||
show(o, Aflg, astr, idx[i].path);
|
||||
else if(!samedata(&idx[i], &wdir[j]))
|
||||
show(o, Mflg, mstr, idx[i].path);
|
||||
|
@ -534,6 +539,8 @@ main(int argc, char **argv)
|
|||
for(i = 0; i < nidx; i++){
|
||||
while(i+1 < nidx && strcmp(idx[i].path, idx[i+1].path) == 0)
|
||||
i++;
|
||||
if(idx[i].state == 'U')
|
||||
continue;
|
||||
Bprint(w, "%c %Q %o %s\n",
|
||||
idx[i].state,
|
||||
idx[i].qid,
|
||||
|
|
Loading…
Reference in a new issue