Handle case when CONSERVANCY_REPOSITORY isn't set at all
This commit is contained in:
		
							parent
							
								
									5a8da108b9
								
							
						
					
					
						commit
						cc4be8b010
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		|  | @ -702,9 +702,10 @@ def parse_repo_relative_path(path: str) -> str: | |||
|     if not os.path.exists(path): | ||||
|         raise argparse.ArgumentTypeError(f'File {path} does not exist.') | ||||
|     real_path = os.path.realpath(path) | ||||
|     repo = os.path.realpath(os.getenv('CONSERVANCY_REPOSITORY')) | ||||
|     if not repo: | ||||
|         raise argparse.ArgumentTypeError('$CONSERVANCY_REPOSITORY is not set.') | ||||
|     try: | ||||
|         repo = os.path.realpath(os.environ['CONSERVANCY_REPOSITORY']) | ||||
|     except KeyError: | ||||
|         raise argparse.ArgumentTypeError('$CONSERVANCY_REPOSITORY environment variable is not set.') | ||||
|     if not real_path.startswith(repo): | ||||
|         raise argparse.ArgumentTypeError( | ||||
|             f'File {real_path} does not share a common prefix with $CONSERVANCY_REPOSITORY {repo}.' | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue