I think the logic is almost similar as the helper function in this patch, But I tried to wrap it within the if else block Reason why this is needed is I initially thought that this was just a path issue Turned out tests like t4137 and t7413 failed These failed tests were because I didn't take submodule active into consideration And at the end since this is the only place where the helper is needed I just wrapped it up for this specific thing Maybe if someone might need it in future or someone builds an helper function then using that might make sense but for now I think this is the middle ground approach we could find. -Jayatheerth