fn get_optional_normalized_task(
    config: &Config,
    name: &str,
    support_alias: bool,
) -> Result<Task, CargoMakeError> {
    let actual_task_name = if support_alias {
        get_actual_task_name(config, name)
    } else {
        Ok(name.to_string())
    }?;

    match config.tasks.get(&actual_task_name) {
        Some(task_config) => {
            let mut clone_task = task_config.clone();
            let mut normalized_task = clone_task.get_normalized_task();

            normalized_task = match normalized_task.extend {
                Some(ref extended_task_name) => {
                    let mut extended_task =
                        get_normalized_task(config, extended_task_name, support_alias)?;

                    if let Some(ref env) = normalized_task.env {
                        if env.len() == 2
                            && env.contains_key("CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE")
                            && env
                                .contains_key("CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY")
                        {
                            normalized_task.env = None;
                        }
                    }
                    extended_task.extend(&normalized_task);

                    extended_task
                }
                None => normalized_task,
            };

            Ok(normalized_task)
        }
        None => Err(CargoMakeError::NotFound(format!(
            "Task {:#?} not found",
            name
        ))),
    }
}
Resolves alias and normalizes task.

# Panics
if there is a cycle in the alias chain.
src/lib/execution_plan.rs