summaryrefslogtreecommitdiff
path: root/t/t1300-repo-config.sh
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2006-12-31 03:13:05 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-12-31 06:22:14 (GMT)
commitd77a64d353cea0f72655b86dd04bcf9f86cbbea6 (patch)
treec22b7a32a3e49131834cf304c03cdc3ef823d0d3 /t/t1300-repo-config.sh
parent95d3c4f546c664c3571dd4a93f11ae2f54e55e6e (diff)
downloadgit-d77a64d353cea0f72655b86dd04bcf9f86cbbea6.zip
git-d77a64d353cea0f72655b86dd04bcf9f86cbbea6.tar.gz
git-d77a64d353cea0f72655b86dd04bcf9f86cbbea6.tar.bz2
Teach Git how to parse standard power of 2 suffixes.
Sometimes its necessary to supply a value as a power of two in a configuration parameter. In this case the user may want to use the standard suffixes such as K, M, or G to indicate that the numerical value should be multiplied by a constant base before being used. Shell scripts/etc. can also benefit from this automatic option parsing with `git repo-config --int`. [jc: with a couple of test and a slight input tightening] Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 't/t1300-repo-config.sh')
-rwxr-xr-xt/t1300-repo-config.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index e48a4ec..a29caa0 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -391,5 +391,15 @@ EOF
test_expect_success "rename succeeded" "diff -u expect .git/config"
+test_expect_success numbers '
+
+ git-repo-config kilo.gram 1k &&
+ git-repo-config mega.ton 1m &&
+ k=$(git-repo-config --int --get kilo.gram) &&
+ test z1024 = "z$k" &&
+ m=$(git-repo-config --int --get mega.ton) &&
+ test z1048576 = "z$m"
+'
+
test_done