nix ls-{nar,store}: Don't abort on missing files
This commit is contained in:
		
							parent
							
								
									b8d446829e
								
							
						
					
					
						commit
						5773d667ee
					
				
					 2 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -214,7 +214,7 @@ void listNar(JSONPlaceholder & res, ref<FSAccessor> accessor,
 | 
				
			||||||
        obj.attr("target", accessor->readLink(path));
 | 
					        obj.attr("target", accessor->readLink(path));
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
        abort();
 | 
					        throw Error("path '%s' does not exist in NAR", path);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,3 +32,7 @@ diff -u baz.cat-nar $storePath/foo/baz
 | 
				
			||||||
[[ $(nix ls-store --json $storePath) = '{"type":"directory","entries":{"foo":{},"foo-x":{},"qux":{},"zyx":{}}}' ]]
 | 
					[[ $(nix ls-store --json $storePath) = '{"type":"directory","entries":{"foo":{},"foo-x":{},"qux":{},"zyx":{}}}' ]]
 | 
				
			||||||
[[ $(nix ls-store --json -R $storePath/foo) = '{"type":"directory","entries":{"bar":{"type":"regular","size":0},"baz":{"type":"regular","size":0},"data":{"type":"regular","size":58}}}' ]]
 | 
					[[ $(nix ls-store --json -R $storePath/foo) = '{"type":"directory","entries":{"bar":{"type":"regular","size":0},"baz":{"type":"regular","size":0},"data":{"type":"regular","size":58}}}' ]]
 | 
				
			||||||
[[ $(nix ls-store --json -R $storePath/foo/bar) = '{"type":"regular","size":0}' ]]
 | 
					[[ $(nix ls-store --json -R $storePath/foo/bar) = '{"type":"regular","size":0}' ]]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Test missing files.
 | 
				
			||||||
 | 
					nix ls-store --json -R $storePath/xyzzy 2>&1 | grep 'does not exist in NAR'
 | 
				
			||||||
 | 
					nix ls-store $storePath/xyzzy 2>&1 | grep 'does not exist'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue