summaryrefslogtreecommitdiff
path: root/.gitattributes
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2014-12-10 10:42:10 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-12-11 15:34:35 -0800
commitfac908389d4571ab5004872a54e50349272b63fc (patch)
tree314519fd3e5a7713d3ce3ccfffbf678d0861ad14 /.gitattributes
parentcommit: accept more date formats for "--date" (diff)
downloadtgif-fac908389d4571ab5004872a54e50349272b63fc.tar.xz
commit: loosen ident checks when generating template
When we generate the commit-message template, we try to report an author or committer ident that will be of interest to the user: an author that does not match the committer, or a committer that was auto-configured. When doing so, if we encounter what we consider to be a bogus ident, we immediately die. This is a bad idea, because our use of the idents here is purely informational. Any ident rules should be enforced elsewhere, because commits that do not invoke the editor will not even hit this code path (e.g., "git commit -mfoo" would work, but "git commit" would not). So at best, we are redundant with other checks, and at worse, we actively prevent commits that should otherwise be allowed. We should therefore do the minimal parsing we can to get a value and not do any validation (i.e., drop the call to sane_ident_split()). In theory we could notice when even our minimal parsing fails to work, and do the sane thing for each check (e.g., if we have an author but can't parse the committer, assume they are different and print the author). But we can actually simplify this even further. We know that the author and committer strings we are parsing have been generated by us earlier in the program, and therefore they must be parseable. We could just call split_ident_line without even checking its return value, knowing that it will put _something_ in the name/mail fields. Of course, to protect ourselves against future changes to the code, it makes sense to turn this into an assert, so we are not surprised if our assumption fails. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '.gitattributes')
0 files changed, 0 insertions, 0 deletions