From 248b96d8a38b2d52a73d7091a82f688f4688295e Mon Sep 17 00:00:00 2001 From: zeripath Date: Thu, 9 Sep 2021 21:13:36 +0100 Subject: Use git attributes to determine generated and vendored status for language stats and diffs (#16773) Replaces #16262 Replaces #16250 Replaces #14833 This PR first implements a `git check-attr` pipe reader - using `git check-attr --stdin -z --cached` - taking account of the change in the output format in git 1.8.5 and creates a helper function to read a tree into a temporary index file for that pipe reader. It then wires this in to the language stats helper and into the git diff generation. Files which are marked generated will be folded by default. Fixes #14786 Fixes #12653 --- web_src/js/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'web_src/js/index.js') diff --git a/web_src/js/index.js b/web_src/js/index.js index 5ea16f44f8..78caa51fd6 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -2349,8 +2349,9 @@ function initCodeView() { } $(document).on('click', '.fold-file', ({currentTarget}) => { const box = currentTarget.closest('.file-content'); + const chevron = currentTarget.querySelector('a.chevron'); const folded = box.dataset.folded !== 'true'; - currentTarget.innerHTML = svg(`octicon-chevron-${folded ? 'right' : 'down'}`, 18); + chevron.innerHTML = svg(`octicon-chevron-${folded ? 'right' : 'down'}`, 18); box.dataset.folded = String(folded); }); $(document).on('click', '.blob-excerpt', async ({currentTarget}) => { -- cgit v1.2.3