Skip to content

Commit

Permalink
feat: Support query committer_name and committer_email of commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrDeveloper committed Jun 18, 2024
1 parent e92669d commit f75faa8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
22 changes: 12 additions & 10 deletions docs/structure/tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ 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 |
| parents_count | Integer | Number of commit parents |
| 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 |
| committer_name | Text | Committer name |
| committer_email | Text | Committer email |
| parents_count | Integer | Number of commit parents |
| datetime | Date | Commit date time |
| repo | Text | Repository full path |

---

Expand Down
16 changes: 12 additions & 4 deletions src/git_data_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,22 @@ fn select_commits(
}

if field_name == "name" {
let name = commit.author().name.to_string();
values.push(Value::Text(name));
values.push(Value::Text(commit.author().name.to_string()));
continue;
}

if field_name == "email" {
let email = commit.author().email.to_string();
values.push(Value::Text(email));
values.push(Value::Text(commit.author().email.to_string()));
continue;
}

if field_name == "committer_name" {
values.push(Value::Text(commit.committer().name.to_string()));
continue;
}

if field_name == "committer_email" {
values.push(Value::Text(commit.committer().email.to_string()));
continue;
}

Expand Down
4 changes: 4 additions & 0 deletions src/git_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ pub fn tables_fields_types() -> &'static HashMap<&'static str, DataType> {
map.insert("title", DataType::Text);
map.insert("message", DataType::Text);
map.insert("name", DataType::Text);
map.insert("committer_name", DataType::Text);
map.insert("committer_email", DataType::Text);
map.insert("full_name", DataType::Text);
map.insert("insertions", DataType::Integer);
map.insert("deletions", DataType::Integer);
Expand Down Expand Up @@ -40,6 +42,8 @@ pub fn tables_fields_names() -> &'static HashMap<&'static str, Vec<&'static str>
"message",
"name",
"email",
"committer_name",
"committer_email",
"datetime",
"parents_count",
"repo",
Expand Down

0 comments on commit f75faa8

Please sign in to comment.