sapling/eden/scm/tests/test-commit-size-limits.t
Mark Thomas 0387f1c67e localrepo: add configurable limits for description and extras
Summary:
Commit messages and extras can be unbounded in size.  This can cause problems if users create commits with exceptionally large messages or extras.  Mercurial will commit these to the changelog, increasing its size.  On Mononoke, large commit messages may go over the cacheing threshold, resulting in poor performance for requests involving these commits as Mononoke will need to reload on every access.

Commit messages should not usually be that large.  Mostly likely it will happen by accident, e.g. through use of `hg commit -l some-large-file`. Prevent this from happening by accident by adding configuration for soft limits when creating commits.

If a user really does need to create a commit with a very large message or extras, they can override using the config option.

Reviewed By: xavierd

Differential Revision: D19942522

fbshipit-source-id: 09b9fe1f470467237acc1b20286d2b1d2ab25613
2020-02-18 13:12:58 -08:00

21 lines
694 B
Perl

$ enable commitextras
$ newrepo
$ echo data > file
$ hg add file
Test commit message limit
$ hg commit -m "long message" --config commit.description-size-limit=11
abort: commit message length (12) exceeds configured limit (11)
[255]
$ hg commit -m "long message" --config commit.description-size-limit=12
$ echo data >> file
Test extras limit (limit includes 13 bytes for "branch=default")
$ hg commit -m "message" --extra "testextra=long value" \
> --config commit.extras-size-limit=31
abort: commit extras total size (32) exceeds configured limit (31)
[255]
$ hg commit -m "message" --extra "testextra=long value" \
> --config commit.extras-size-limit=32