File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -340,6 +340,30 @@ exit 1
340340assert ! ( res != HookResult :: Ok ) ;
341341}
342342
343+ #[ test]
344+ fn test_env_containing_path ( ) {
345+ let ( _td, repo) = repo_init ( ) . unwrap ( ) ;
346+ let root = repo. path ( ) . parent ( ) . unwrap ( ) ;
347+ let repo_path: & RepoPath =
348+ & root. as_os_str ( ) . to_str ( ) . unwrap ( ) . into ( ) ;
349+
350+ let hook = b"#!/bin/sh
351+ export
352+ exit 1
353+ " ;
354+
355+ create_hook ( repo_path, HOOK_PRE_COMMIT , hook) ;
356+ let res = hooks_pre_commit ( repo_path) . unwrap ( ) ;
357+
358+ let HookResult :: NotOk ( out) = res else {
359+ unreachable ! ( )
360+ } ;
361+
362+ assert ! ( out
363+ . lines( )
364+ . any( |line| line. starts_with( "export PATH" ) ) ) ;
365+ }
366+
343367#[ test]
344368fn test_pre_commit_fail_hookspath ( ) {
345369let ( _td, repo) = repo_init ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments