Skip to content

Commit

Permalink
get and show commit body
Browse files Browse the repository at this point in the history
  • Loading branch information
phil294 committed Jun 3, 2022
1 parent b4469d7 commit 4fb4cf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions web/src/views/SelectedCommit.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ export default defineComponent

``###* @type {Ref<{path:string,insertions:number,deletions:number}[]>} ###
changed_files = ref []
body = ref ''
watchEffect =>
changed_files.value = (try await git "diff --numstat --format='' #{props.commit.hash} #{props.commit.hash}~1")
?.split('\n').map((l) =>
split = l.split('\t')
path: split[2]
insertions: Number split[1]
deletions: Number split[0]) or []
body.value = await git "show -s --format='%b' #{props.commit.hash}"

show_diff = (###* @type string ### filepath) =>
open_diff props.commit.hash, filepath
Expand All @@ -46,4 +48,5 @@ export default defineComponent
keep_open
changed_files
show_diff
body
}
4 changes: 4 additions & 0 deletions web/src/views/SelectedCommit.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<template lang="slm">
div
h2.summary :title="commit.subject" {{ commit.subject }}

p.body {{ body }}

div v-if="branch_tips.length"
h3 Branches:
Expand Down Expand Up @@ -65,4 +67,6 @@ div
font-family monospace
text-align right
width 2rem
.body
white-space pre-wrap
</style>

0 comments on commit 4fb4cf2

Please sign in to comment.