Skip to content

Commit

Permalink
feat: Support query parents_count to check if this commit is merge or…
Browse files Browse the repository at this point in the history
… not
  • Loading branch information
AmrDeveloper committed Jun 18, 2024
1 parent d399f5b commit e92669d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
19 changes: 10 additions & 9 deletions docs/structure/tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

---

Expand Down
5 changes: 5 additions & 0 deletions src/git_data_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/git_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -40,6 +41,7 @@ pub fn tables_fields_names() -> &'static HashMap<&'static str, Vec<&'static str>
"name",
"email",
"datetime",
"parents_count",
"repo",
],
);
Expand Down

0 comments on commit e92669d

Please sign in to comment.