Re: Cleaning up git user-interface warts
From: Junio C Hamano <hidden>
Date: 2016-08-11 19:39:25
Petr Baudis [off-list ref] writes: You already said this kind of details are subjective so I'd omit the usual "I would think" and answer them without worrying about a big style flamewar. People, please be civil ;-).
What about [ instead of test?
[ ] is not more readable.
if foo; then instead of if foo then
Having "then" on the beginning of line is much more readable.
Am I the only one who hates
case "$log_given" in
tt*)
die "Only one of -c/-C/-F can be used." ;;
*tm*|*mt*)
die "Option -m cannot be combined with -c/-C/-F." ;;
esacThis is much more readable without "case". "abandon the old rule that told us to avoid if when case would do" applies. Although it is about multiple possibility switch (so a case can be made that "case" is appropriate here), we should reduce the use of "case" to cases like the outermost big "case" you find in git-merge-one-file-script.
It would be really great if Git would have something alike the Cogito's optparse infrastructure. I'm not sure if you can implement it in Bourne sh with reasonable performance, though...
getopt(1) is fine, unless somebody screams that it is not available on his platform.