Skip to contentSkip to conversation

gitweb: Add 'show-sizes' feature to show blob sizes in tree view

PATCH/RFC Jakub Narebski 1 participant 1 message Aug 13, 2016

lore
Share & tools
lore
#0 lore raw

Add support for 'show-sizes' feature to show (in separate column, between mode and filename) the size of blobs (files) in the 'tree' view. It passes '-l' option to "git ls-tree" invocation.

For the 'tree' and 'commit' (submodule) entries, '-' is shown in place of size; for generated '..' "up directory" entry nothing is shown.

The 'show-sizes' feature is enabled by default.

---
I don't quite like 'show-sizes' as a name for this feature. Does anyone has any better ideas?

Not tested extensively (just that it works, and looks correct), in particular I didn't test that having 'gitweb.showsizes' as config variable name while 'show-sizes' as feature name works as expected.

Previous version of this idea was presented in
http://thread.gmane.org/gmane.comp.version-control.git/54335/focus=54334
It required to pass '-l' to 'tree' action via 'opt' (extra options) parameter. This one uses features mechanism.

This patch might have @extra_options passed unnecessary...

 gitweb/gitweb.css  |    6 +++++
 gitweb/gitweb.perl |   69 +++++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 60 insertions(+), 15 deletions(-)
gitweb/gitweb.css +6 -0
index 8f68fe3..d60bfc1 100644
@@ -341,6 +341,12 @@ td.mode {
 	font-family: monospace;
 }
 
+/* format of (optional) objects size in 'tree' view */
+td.size {
+	font-family: monospace;
+	text-align: right;
+}
+
 /* styling of diffs (patchsets): commitdiff and blobdiff views */
 div.diff.header,
 div.diff.extended_header {
gitweb/gitweb.perl +54 -15

133 lines not on this page · raw message