gps 7.3.3

Official CLI & library for Git Patch Stack
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::config_get_error::ConfigGetError;
use std::result::Result;

pub fn config_get_to_option<T>(
    res_val: Result<T, git2::Error>,
) -> Result<Option<T>, ConfigGetError> {
    match res_val {
        Ok(v) => Ok(Some(v)),
        Err(e) => {
            if e.class() == git2::ErrorClass::Config && e.code() == git2::ErrorCode::NotFound {
                Ok(None)
            } else {
                Err(ConfigGetError::Failed(e))
            }
        }
    }
}