httpd: Add `path` property to `CodeLocation`
For the web client to be able to show file we need to provide the web client with the file path. Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
parent
00ea587c6d
commit
564886b165
|
|
@ -2089,7 +2089,8 @@ mod routes {
|
||||||
"inline": [
|
"inline": [
|
||||||
{
|
{
|
||||||
"location": {
|
"location": {
|
||||||
"blob": HEAD,
|
"blob": "82eb77880c693655bce074e3dbbd9fa711dc018b",
|
||||||
|
"path": "./README.md",
|
||||||
"commit": HEAD,
|
"commit": HEAD,
|
||||||
"lines": {
|
"lines": {
|
||||||
"start": 1,
|
"start": 1,
|
||||||
|
|
@ -2148,7 +2149,8 @@ mod routes {
|
||||||
"inline": [
|
"inline": [
|
||||||
{
|
{
|
||||||
"location": {
|
"location": {
|
||||||
"blob": HEAD,
|
"blob": "82eb77880c693655bce074e3dbbd9fa711dc018b",
|
||||||
|
"path": "./README.md",
|
||||||
"commit": HEAD,
|
"commit": HEAD,
|
||||||
"lines": {
|
"lines": {
|
||||||
"start": 1,
|
"start": 1,
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
@ -466,6 +467,8 @@ impl fmt::Display for Verdict {
|
||||||
pub struct CodeLocation {
|
pub struct CodeLocation {
|
||||||
/// File being commented on.
|
/// File being commented on.
|
||||||
pub blob: git::Oid,
|
pub blob: git::Oid,
|
||||||
|
/// Path of file being commented on.
|
||||||
|
pub path: PathBuf,
|
||||||
/// Commit commented on.
|
/// Commit commented on.
|
||||||
pub commit: git::Oid,
|
pub commit: git::Oid,
|
||||||
/// Line range commented on.
|
/// Line range commented on.
|
||||||
|
|
@ -480,12 +483,20 @@ impl PartialOrd for CodeLocation {
|
||||||
|
|
||||||
impl Ord for CodeLocation {
|
impl Ord for CodeLocation {
|
||||||
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
||||||
(&self.blob, &self.commit, &self.lines.start, &self.lines.end).cmp(&(
|
(
|
||||||
&other.blob,
|
&self.blob,
|
||||||
&other.commit,
|
&self.path,
|
||||||
&other.lines.start,
|
&self.commit,
|
||||||
&other.lines.end,
|
&self.lines.start,
|
||||||
))
|
&self.lines.end,
|
||||||
|
)
|
||||||
|
.cmp(&(
|
||||||
|
&other.blob,
|
||||||
|
&other.path,
|
||||||
|
&other.commit,
|
||||||
|
&other.lines.start,
|
||||||
|
&other.lines.end,
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue