diff --git a/docs/structure/tables.md b/docs/structure/tables.md index dccdab43..e743eb89 100644 --- a/docs/structure/tables.md +++ b/docs/structure/tables.md @@ -22,15 +22,16 @@ show tables --- -| Name | Type | Description | -| --------- | ---- | -------------------- | -| commit_id | Text | Commit id | -| title | Text | Commit title | -| message | Text | Commit full message | -| name | Text | Author name | -| email | Text | Author email | -| datetime | Date | Commit date time | -| repo | Text | Repository full path | +| Name | Type | Description | +| ------------- | ------- | ------------------------ | +| commit_id | Text | Commit id | +| title | Text | Commit title | +| message | Text | Commit full message | +| name | Text | Author name | +| email | Text | Author email | +| parents_count | Integer | Number of commit parents | +| datetime | Date | Commit date time | +| repo | Text | Repository full path | --- diff --git a/src/git_data_provider.rs b/src/git_data_provider.rs index 0119df4e..ae328c2f 100644 --- a/src/git_data_provider.rs +++ b/src/git_data_provider.rs @@ -272,6 +272,11 @@ fn select_commits( continue; } + if field_name == "parents_count" { + values.push(Value::Integer(commit.parents.len() as i64)); + continue; + } + if field_name == "repo" { values.push(Value::Text(repo_path.to_string())); continue; diff --git a/src/git_schema.rs b/src/git_schema.rs index cd1c166d..2bdc4c3b 100644 --- a/src/git_schema.rs +++ b/src/git_schema.rs @@ -20,6 +20,7 @@ pub fn tables_fields_types() -> &'static HashMap<&'static str, DataType> { map.insert("is_head", DataType::Boolean); map.insert("is_remote", DataType::Boolean); map.insert("commit_count", DataType::Integer); + map.insert("parents_count", DataType::Integer); map.insert("updated", DataType::DateTime); map.insert("repo", DataType::Text); map @@ -40,6 +41,7 @@ pub fn tables_fields_names() -> &'static HashMap<&'static str, Vec<&'static str> "name", "email", "datetime", + "parents_count", "repo", ], );