@@ -35,8 +35,16 @@ fn canonicalize_path(path: &Path) -> Result<PathBuf, std::io::Error> {
3535fn find_root_git_commit ( commit : Commit ) -> Commit {
3636 let mut current = commit;
3737
38- while let Ok ( parent) = current. parent ( 0 ) {
39- current = parent;
38+ loop {
39+ match current. parent ( 0 ) {
40+ Ok ( parent) => {
41+ current = parent;
42+ }
43+ Err ( e) => {
44+ println ! ( "parent error: {:?}" , e) ;
45+ break ;
46+ }
47+ }
4048 }
4149
4250 current
@@ -68,9 +76,13 @@ fn main() {
6876 // This isn't reliable, especially on Windows. So we use libgit2 to extract data
6977 // from the git repo, if present.
7078 if let Ok ( repo) = Repository :: discover ( & cwd) {
79+ println ! ( "discovered repo at {}" , repo. path( ) . display( ) ) ;
7180 if let Ok ( head_ref) = repo. head ( ) {
81+ println ! ( "head ref: {}" , head_ref. name( ) . unwrap( ) ) ;
7282 if let Ok ( commit) = head_ref. peel_to_commit ( ) {
83+ println ! ( "commit: {}" , commit. id( ) . to_string( ) ) ;
7384 let root = find_root_git_commit ( commit. clone ( ) ) ;
85+ println ! ( "root commit: {}" , root. id( ) . to_string( ) ) ;
7486
7587 if root. id ( ) . to_string ( ) == ROOT_COMMIT {
7688 let path = canonicalize_path ( repo. workdir ( ) . expect ( "could not obtain workdir" ) )
@@ -83,6 +95,8 @@ fn main() {
8395 }
8496 }
8597
98+ panic ! ( "done with repo discovery" ) ;
99+
86100 if force_git_source {
87101 repo_path = "" . to_string ( ) ;
88102 }
0 commit comments