Skip to content

Commit

Permalink
Merge branch 'improve-preview-performance'
Browse files Browse the repository at this point in the history
* Branch commit log:
  jj-fzf: cut off the preview after a few thausand lines
	Cutting off the preview process at a point where users are
	unlikely to scroll to vastly improves preview performance
	for giant imports.
  jj-fzf: split-files: try using `jj diff` instead of `git diff-tree`

Signed-off-by: Tim Janik <[email protected]>
  • Loading branch information
tim-janik committed Dec 22, 2024
2 parents 4e996bd + e6afe36 commit 6525fb3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions jj-fzf
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ then
then
jj --no-pager --ignore-working-copy ${JJFZF_ATOP:+--at-op $JJFZF_ATOP} evolog --color=always -r "$REVISION"
else # show commit and diff
jj --no-pager --ignore-working-copy ${JJFZF_ATOP:+--at-op $JJFZF_ATOP} log --color=always --no-graph -T "$JJ_FZF_SHOWDETAILS" -s -r "$REVISION"
exec jj --no-pager --ignore-working-copy ${JJFZF_ATOP:+--at-op $JJFZF_ATOP} show --color=always -T ' "\n" ' -r "$REVISION" --ignore-space-change
{ jj --no-pager --ignore-working-copy ${JJFZF_ATOP:+--at-op $JJFZF_ATOP} log --color=always --no-graph -T "$JJ_FZF_SHOWDETAILS" -s -r "$REVISION"
jj --no-pager --ignore-working-copy ${JJFZF_ATOP:+--at-op $JJFZF_ATOP} show --color=always -T ' "\n" ' -r "$REVISION" --ignore-space-change
} | head -n 4000
fi
else # no valid revision
true
Expand All @@ -67,7 +68,7 @@ case "${1:-}" in
preview_oppatch)
[[ " ${2:-} " =~ $OPRPAT ]] && {
jj --no-pager --ignore-working-copy --color=always op show -p "${BASH_REMATCH[1]}"
} ; exit ;;
} | head -n 4000 ; exit ;;
preview_opdiff)
[[ " ${2:-} " =~ $OPRPAT ]] && {
jj --no-pager --ignore-working-copy --color=always op diff -f "${BASH_REMATCH[1]}" -t @
Expand Down Expand Up @@ -1042,7 +1043,7 @@ split-files()
R="$(xrev "${1:-@}")"
cd "$JJROOT" # operate on root relative file names
# read files affected by $R
mapfile -t MAPFILE < <(git diff-tree --no-commit-id --name-only -r "$(rev_commitid "$R")")
mapfile -t MAPFILE < <(jj diff --name-only -r "$(rev_commitid "$R")")
[[ ${#MAPFILE[@]} -gt 1 ]] ||
return
# show undo hint
Expand Down

0 comments on commit 6525fb3

Please sign in to comment.