repo: diff: add option to show "creation event" diff for root commit
At its inception, Git did not show a "creation event" diff for a project's root commit since early projects, such as the Linux kernel, were already well established, and a large root diff was considered uninteresting noise. On the other hand, new projects adopting Git typically have small root commits, and such a "creation event" is likely to have meaning, rather than being pure noise. Consequently, git-diff-tree gained a --root flag in dc26bd89 (diff-tree: add "--root" flag to show a root commit as a big creation event, 2005-05-19), though it was disabled by default. Displaying the root "creation event" diff, however, became the default behavior when configuration option 'log.showroot' was added to git-log in 0f03ca94 (config option log.showroot to show the diff of root commits; 2006-11-23). And, gitk (belatedly) followed suit when it learned to respect 'log.showroot' in b2b76d10 (gitk: Teach gitk to respect log.showroot; 2011-10-04). By default, these tools now all show the root diff as a "creation event", however, git-arr suppresses it unconditionally. Resolve this shortcoming by adding a new git-arr configuration option "rootdiff" to control the behavior (enabled by default). Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
This commit is contained in:
parent
9ef78aaffd
commit
bebc7fa3f0
2
git-arr
2
git-arr
@ -46,6 +46,7 @@ def load_config(path):
|
|||||||
"""
|
"""
|
||||||
defaults = {
|
defaults = {
|
||||||
'tree': 'yes',
|
'tree': 'yes',
|
||||||
|
'rootdiff': 'yes',
|
||||||
'desc': '',
|
'desc': '',
|
||||||
'recursive': 'no',
|
'recursive': 'no',
|
||||||
'commits_in_summary': '10',
|
'commits_in_summary': '10',
|
||||||
@ -108,6 +109,7 @@ def load_config(path):
|
|||||||
if r.info.max_pages <= 0:
|
if r.info.max_pages <= 0:
|
||||||
r.info.max_pages = sys.maxint
|
r.info.max_pages = sys.maxint
|
||||||
r.info.generate_tree = config.getboolean(s, 'tree')
|
r.info.generate_tree = config.getboolean(s, 'tree')
|
||||||
|
r.info.root_diff = config.getboolean(s, 'rootdiff')
|
||||||
|
|
||||||
r.info.web_url = config.get(s, 'web_url')
|
r.info.web_url = config.get(s, 'web_url')
|
||||||
web_url_file = fullpath + '/' + config.get(s, 'web_url_file')
|
web_url_file = fullpath + '/' + config.get(s, 'web_url_file')
|
||||||
|
4
git.py
4
git.py
@ -198,8 +198,6 @@ class Repo:
|
|||||||
def __init__(self, path, branch = None, name = None, info = None):
|
def __init__(self, path, branch = None, name = None, info = None):
|
||||||
self.path = path
|
self.path = path
|
||||||
self.branch = branch
|
self.branch = branch
|
||||||
|
|
||||||
# We don't need these, but provide them for the users' convenience.
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.info = info or SimpleNamespace()
|
self.info = info or SimpleNamespace()
|
||||||
|
|
||||||
@ -303,6 +301,8 @@ class Repo:
|
|||||||
cmd.patch = None
|
cmd.patch = None
|
||||||
cmd.numstat = None
|
cmd.numstat = None
|
||||||
cmd.find_renames = None
|
cmd.find_renames = None
|
||||||
|
if (self.info.root_diff):
|
||||||
|
cmd.root = None
|
||||||
# Note we intentionally do not use -z, as the filename is just for
|
# Note we intentionally do not use -z, as the filename is just for
|
||||||
# reference, and it is safer to let git do the escaping.
|
# reference, and it is safer to let git do the escaping.
|
||||||
|
|
||||||
|
@ -11,6 +11,15 @@ path = /srv/git/repo/
|
|||||||
# Useful to disable an expensive operation in very large repositories.
|
# Useful to disable an expensive operation in very large repositories.
|
||||||
#tree = yes
|
#tree = yes
|
||||||
|
|
||||||
|
# Show a "creation event" diff for a root commit? (optional)
|
||||||
|
# For projects placed under revision control from inception, the root commit
|
||||||
|
# diff is often meaningful. However, in cases when a well established, large
|
||||||
|
# project is placed under revision control belatedly, the root commit may
|
||||||
|
# represent a lump import of the entire project, in which case such a
|
||||||
|
# "creation event" diff would likely be considered meaningless noise.
|
||||||
|
# Default: yes
|
||||||
|
#rootdiff = yes
|
||||||
|
|
||||||
# How many commits to show in the summary page (optional).
|
# How many commits to show in the summary page (optional).
|
||||||
#commits_in_summary = 10
|
#commits_in_summary = 10
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user