| @@ -346,7 +346,7 @@ struct Head { |
| | } |
| | |
| | impl Head { |
| | /// Parse `%H %an %ct %cs %s`, separated by 0x1f. The subject goes last and the split stops |
| | /// Parse `%H %an %ct %cd %s`, separated by 0x1f. The subject goes last and the split stops |
| | /// at five fields, so a subject that itself contains the separator byte stays whole. |
| | fn parse(out: &str) -> Option<Head> { |
| | let f: Vec<&str> = out.trim_end_matches('\n').splitn(5, '\x1f').collect(); |
| @@ -526,7 +526,9 @@ impl Repo { |
| | fn latest_raw(&self, rev: &str, path: &[u8]) -> Option<String> { |
| | let lookup = || { |
| | let mut args: Vec<&OsStr> = |
| | ["log", "-1", "--format=%H%x1f%an%x1f%ct%x1f%cs%x1f%s", rev, "--"].map(OsStr::new).to_vec(); |
| | ["log", "-1", "--date=format:%-d %b %Y", "--format=%H%x1f%an%x1f%ct%x1f%cd%x1f%s", rev, "--"] |
| | .map(OsStr::new) |
| | .to_vec(); |
| | if !path.is_empty() { |
| | args.push(OsStr::from_bytes(path)); |
| | } |
| @@ -545,20 +547,30 @@ impl Repo { |
| | fn entry_commit(&self, commit: &str, path: &[u8]) -> Option<templates::EntryCommit> { |
| | let key = self.key("entry-commit", commit, &encode(path)); |
| | let record = cached(key, || { |
| | let args = ["log", "-1", "--format=%H%x00%ct%x00%cI%x00%s%x00%B", commit, "--"].map(OsStr::new); |
| | let args = [ |
| | "log", |
| | "-1", |
| | "--date=format:%-d %b %Y, %H:%M:%S %z", |
| | "--format=%H%x00%ct%x00%cI%x00%cd%x00%s%x00%B", |
| | commit, |
| | "--", |
| | ] |
| | .map(OsStr::new); |
| | self.git(&[args.as_slice(), &[OsStr::from_bytes(path)]].concat()).filter(|out| !out.is_empty()) |
| | })?; |
| | let mut fields = record.splitn(5, '\0'); |
| | let mut fields = record.splitn(6, '\0'); |
| | let oid = fields.next()?; |
| | let stamp = fields.next()?; |
| | let datetime = fields.next()?; |
| | let full_date = fields.next()?; |
| | let subject = subject_or_placeholder(fields.next()?); |
| | let message = fields.next()?.trim_end(); |
| | Some(templates::EntryCommit { |
| | url: self.url("commit", &[("id", oid)]), |
| | subject: subject.into(), |
| | message: if message.is_empty() { subject } else { message }.into(), |
| | when: ago(stamp, datetime.split('T').next().unwrap_or(datetime)), |
| | when: ago(stamp, full_date.split(',').next().unwrap_or(full_date)), |
| | full_date: full_date.into(), |
| | datetime: datetime.into(), |
| | }) |
| | } |
| @@ -902,7 +914,7 @@ fn view_tree(repo: &Repo, q: &Q) -> Option<View> { |
| | ago(&head.stamp, &head.date) |
| | ); |
| | } |
| | body += r#"<ul class="rows">"#; |
| | body += r#"<ul class="rows tree-list">"#; |
| | if !path.is_empty() { |
| | let up = repo.url_at("tree", &reference, parent_of(&path), ""); |
| | let _ = write!( |
| @@ -1096,7 +1108,8 @@ fn view_log(repo: &Repo, q: &Q) -> Option<View> { |
| | "log", |
| | &format!("-n{}", PAGE + 1), |
| | &format!("--skip={skip}"), |
| | "--format=%H%x1f%an%x1f%ct%x1f%cs%x1f%s", |
| | "--date=format:%-d %b %Y", |
| | "--format=%H%x1f%an%x1f%ct%x1f%cd%x1f%s", |
| | &commit, |
| | "--", |
| | ])?; |
| @@ -1340,7 +1353,7 @@ fn view_tags(repo: &Repo) -> Option<View> { |
| | let out = repo.git(&[ |
| | "for-each-ref", |
| | "--sort=-creatordate", |
| | "--format=%(refname:lstrip=2)%1f%(objectname)%1f%(*objectname)%1f%(creatordate:unix)%1f%(creatordate:short)%1f%(objecttype)%1f%(contents:subject)", |
| | "--format=%(refname:lstrip=2)%1f%(objectname)%1f%(*objectname)%1f%(creatordate:unix)%1f%(creatordate:format:%-d %b %Y)%1f%(objecttype)%1f%(contents:subject)", |
| | "refs/tags", |
| | ])?; |
| | let mut rows = String::new(); |