Skip to contentSkip to conversation

use a lowercase "usage:" string

PATCH In review David Aguilar 2 participants 19 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

v2 cover use a lowercase "usage:" string

The code content is unchanged from v1.

v2 adjusts the commit messages per Jonathan's review and adds a Reviewed-by: to the commit message except for patches 11 and 12, which are unchanged since v1.

David Aguilar (16):
git-sh-setup: use a lowercase "usage:" string
git-svn: use a lowercase "usage:" string
git-relink: use a lowercase "usage:" string
git-merge-one-file: use a lowercase "usage:" string
git-archimport: use a lowercase "usage:" string
git-cvsexportcommit: use a lowercase "usage:" string
git-cvsimport: use a lowercase "usage:" string
git-cvsimport: use a lowercase "usage:" string contrib/credential: use a lowercase "usage:" string contrib/fast-import: use a lowercase "usage:" string contrib/fast-import/import-zips.py: fix broken error message contrib/fast-import/import-zips.py: use spaces instead of tabs contrib/examples: use a lowercase "usage:" string contrib/hooks/setgitperms.perl: use a lowercase "usage:" string templates/hooks--update.sample: use a lowercase "usage:" string Documentation/user-manual.txt: use a lowercase "usage:" string

 Documentation/user-manual.txt                      |  4 +-
 .../gnome-keyring/git-credential-gnome-keyring.c   |  2 +-
 .../osxkeychain/git-credential-osxkeychain.c       |  2 +-
 .../credential/wincred/git-credential-wincred.c    |  2 +-
 contrib/examples/git-remote.perl                   |  2 +-
 contrib/examples/git-svnimport.perl                |  2 +-
 contrib/fast-import/git-import.perl                |  2 +-
 contrib/fast-import/git-import.sh                  |  2 +-
 contrib/fast-import/import-zips.py                 | 98 +++++++++++-----------
 contrib/hooks/setgitperms.perl                     |  2 +-
 git-archimport.perl                                |  2 +-
 git-cvsexportcommit.perl                           |  2 +-
 git-cvsimport.perl                                 |  2 +-
 git-cvsserver.perl                                 |  2 +-
 git-merge-one-file.sh                              |  2 +-
 git-relink.perl                                    |  2 +-
 git-sh-setup.sh                                    |  6 +-
 git-svn.perl                                       |  2 +-
 templates/hooks--update.sample                     |  2 +-
 19 files changed, 70 insertions(+), 70 deletions(-)
Signature · 1 line
1.8.2.rc0.263.g20d9441
#1 lore raw

PATCH v2 1/16 git-sh-setup: use a lowercase "usage:" string

mergetool, bisect, and other commands that use git-sh-setup print a usage string that is inconsistent with the rest of Git when they are invoked as "git $cmd -h".

The compiled builtins use the lowercase "usage:" string but these commands say "Usage:". Adjust the shell library to make these consistent.

---
 git-sh-setup.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
git-sh-setup.sh +3 -3
index 795edd2..9cfbe7f 100644
@@ -84,14 +84,14 @@ if test -n "$OPTIONS_SPEC"; then
 else
 	dashless=$(basename "$0" | sed -e 's/-/ /')
 	usage() {
-		die "Usage: $dashless $USAGE"
+		die "usage: $dashless $USAGE"
 	}
 
 	if [ -z "$LONG_USAGE" ]
 	then
-		LONG_USAGE="Usage: $dashless $USAGE"
+		LONG_USAGE="usage: $dashless $USAGE"
 	else
-		LONG_USAGE="Usage: $dashless $USAGE
+		LONG_USAGE="usage: $dashless $USAGE
 
 $LONG_USAGE"
 	fi
Signature · 1 line
1.8.2.rc0.263.g20d9441
#2 lore raw

PATCH v2 2/16 git-svn: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 git-svn.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-svn.perl +1 -1
index b46795f..a93166f 100755
@@ -382,7 +382,7 @@ sub usage {
 	my $fd = $exit ? \*STDERR : \*STDOUT;
 	print $fd <<"";
 git-svn - bidirectional operations between a single Subversion tree and git
-Usage: git svn <command> [options] [arguments]\n
+usage: git svn <command> [options] [arguments]\n
 
 	print $fd "Available commands:\n" unless $cmd;
 
Signature · 1 line
1.8.2.rc0.263.g20d9441
#3 lore raw

PATCH v2 3/16 git-relink: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 git-relink.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-relink.perl +1 -1
index f29285c..236a352 100755
@@ -163,7 +163,7 @@ sub link_two_files($$) {
 
 
 sub usage() {
-	print("Usage: git relink [--safe] <dir>... <master_dir> \n");
+	print("usage: git relink [--safe] <dir>... <master_dir> \n");
 	print("All directories should contain a .git/objects/ subdirectory.\n");
 	print("Options\n");
 	print("\t--safe\t" .
Signature · 1 line
1.8.2.rc0.263.g20d9441
#4 lore raw

PATCH v2 4/16 git-merge-one-file: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 git-merge-one-file.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-merge-one-file.sh +1 -1
index f612cb8..3373c04 100755
@@ -18,7 +18,7 @@
 
 USAGE='<orig blob> <our blob> <their blob> <path>'
 USAGE="$USAGE <orig mode> <our mode> <their mode>"
-LONG_USAGE="Usage: git merge-one-file $USAGE
+LONG_USAGE="usage: git merge-one-file $USAGE
 
 Blob ids and modes should be empty for missing files."
 
Signature · 1 line
1.8.2.rc0.263.g20d9441
#5 lore raw

PATCH v2 5/16 git-archimport: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 git-archimport.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-archimport.perl +1 -1
index bc32f18..9cb123a 100755
@@ -75,7 +75,7 @@ our($opt_h,$opt_f,$opt_v,$opt_T,$opt_t,$opt_D,$opt_a,$opt_o);
 
 sub usage() {
     print STDERR <<END;
-Usage: git archimport     # fetch/update GIT from Arch
+usage: git archimport     # fetch/update GIT from Arch
        [ -h ] [ -v ] [ -o ] [ -a ] [ -f ] [ -T ] [ -D depth ] [ -t tempdir ]
        repository/arch-branch [ repository/arch-branch] ...
 END
Signature · 1 line
1.8.2.rc0.263.g20d9441
#6 lore raw

PATCH v2 6/16 git-cvsexportcommit: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 git-cvsexportcommit.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-cvsexportcommit.perl +1 -1
index e6bf252..d13f02d 100755
@@ -420,7 +420,7 @@ sleep(1);
 
 sub usage {
 	print STDERR <<END;
-Usage: GIT_DIR=/path/to/.git git cvsexportcommit [-h] [-p] [-v] [-c] [-f] [-u] [-k] [-w cvsworkdir] [-m msgprefix] [ parent ] commit
+usage: GIT_DIR=/path/to/.git git cvsexportcommit [-h] [-p] [-v] [-c] [-f] [-u] [-k] [-w cvsworkdir] [-m msgprefix] [ parent ] commit
 END
 	exit(1);
 }
Signature · 1 line
1.8.2.rc0.263.g20d9441
#7 lore raw

PATCH v2 7/16 git-cvsimport: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 git-cvsimport.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-cvsimport.perl +1 -1
index 344f120..73d367c 100755
@@ -38,7 +38,7 @@ sub usage(;$) {
 	my $msg = shift;
 	print(STDERR "Error: $msg\n") if $msg;
 	print STDERR <<END;
-Usage: git cvsimport     # fetch/update GIT from CVS
+usage: git cvsimport     # fetch/update GIT from CVS
        [-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A author-conv-file]
        [-p opts-for-cvsps] [-P file] [-C GIT_repository] [-z fuzz] [-i] [-k]
        [-u] [-s subst] [-a] [-m] [-M regex] [-S regex] [-L commitlimit]
Signature · 1 line
1.8.2.rc0.263.g20d9441
#8 lore raw

PATCH v2 8/16 git-cvsimport: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 git-cvsserver.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-cvsserver.perl +1 -1
index 3679074..f1c3f49 100755
@@ -107,7 +107,7 @@ my $work =
 $log->info("--------------- STARTING -----------------");
 
 my $usage =
-    "Usage: git cvsserver [options] [pserver|server] [<directory> ...]\n".
+    "usage: git cvsserver [options] [pserver|server] [<directory> ...]\n".
     "    --base-path <path>  : Prepend to requested CVSROOT\n".
     "                          Can be read from GIT_CVSSERVER_BASE_PATH\n".
     "    --strict-paths      : Don't allow recursing into subdirectories\n".
Signature · 1 line
1.8.2.rc0.263.g20d9441
#9 lore raw

PATCH v2 9/16 contrib/credential: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 contrib/credential/gnome-keyring/git-credential-gnome-keyring.c | 2 +-
 contrib/credential/osxkeychain/git-credential-osxkeychain.c     | 2 +-
 contrib/credential/wincred/git-credential-wincred.c             | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
contrib/credential/gnome-keyring/git-credential-gnome-keyring.c +1 -1
index 41f61c5..f2cdefe 100644
@@ -401,7 +401,7 @@ static void usage(const char *name)
 	const char *basename = strrchr(name,'/');
 
 	basename = (basename) ? basename + 1 : name;
-	fprintf(stderr, "Usage: %s <", basename);
+	fprintf(stderr, "usage: %s <", basename);
 	while(try_op->name) {
 		fprintf(stderr,"%s",(try_op++)->name);
 		if(try_op->name)
contrib/credential/osxkeychain/git-credential-osxkeychain.c +1 -1
index 6beed12..3940202 100644
@@ -154,7 +154,7 @@ static void read_credential(void)
 int main(int argc, const char **argv)
 {
 	const char *usage =
-		"Usage: git credential-osxkeychain <get|store|erase>";
+		"usage: git credential-osxkeychain <get|store|erase>";
 
 	if (!argv[1])
 		die(usage);
contrib/credential/wincred/git-credential-wincred.c +1 -1
index cbaec5f..6619492 100644
@@ -313,7 +313,7 @@ static void read_credential(void)
 int main(int argc, char *argv[])
 {
 	const char *usage =
-	    "Usage: git credential-wincred <get|store|erase>\n";
+	    "usage: git credential-wincred <get|store|erase>\n";
 
 	if (!argv[1])
 		die(usage);
Signature · 1 line
1.8.2.rc0.263.g20d9441
#10 lore raw

PATCH v2 10/16 contrib/fast-import: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 contrib/fast-import/git-import.perl | 2 +-
 contrib/fast-import/git-import.sh   | 2 +-
 contrib/fast-import/import-zips.py  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
contrib/fast-import/git-import.perl +1 -1
index f9fef6d..0891b9e 100755
@@ -7,7 +7,7 @@
 use strict;
 use File::Find;
 
-my $USAGE = 'Usage: git-import branch import-message';
+my $USAGE = 'usage: git-import branch import-message';
 my $branch = shift or die "$USAGE\n";
 my $message = shift or die "$USAGE\n";
 
contrib/fast-import/git-import.sh +1 -1
index 0ca7718..f8d803c 100755
@@ -5,7 +5,7 @@
 # but is meant to be a simple fast-import example.
 
 if [ -z "$1" -o -z "$2" ]; then
-	echo "Usage: git-import branch import-message"
+	echo "usage: git-import branch import-message"
 	exit 1
 fi
 
contrib/fast-import/import-zips.py +1 -1
index 5cec9b0..f54c65b 100755
@@ -19,7 +19,7 @@ if hexversion < 0x01060000:
         sys.exit(1)
 
 if len(argv) < 2:
-	print 'Usage:', argv[0], '<zipfile>...'
+	print 'usage:', argv[0], '<zipfile>...'
 	exit(1)
 
 branch_ref = 'refs/heads/import-zips'
Signature · 1 line
1.8.2.rc0.263.g20d9441
#11 lore raw

PATCH v2 11/16 contrib/fast-import/import-zips.py: fix broken error message

The 'sys' module is not imported but all of the bits we want from it are. Adjust the script to not fail when run on old Python versions and fix the inconsistent use of tabs.

---
 contrib/fast-import/import-zips.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
contrib/fast-import/import-zips.py +3 -3
index f54c65b..b528798 100755
@@ -14,9 +14,9 @@ from time import mktime
 from zipfile import ZipFile
 
 if hexversion < 0x01060000:
-        # The limiter is the zipfile module
-        sys.stderr.write("import-zips.py: requires Python 1.6.0 or later.\n")
-        sys.exit(1)
+	# The limiter is the zipfile module
+	stderr.write("import-zips.py: requires Python 1.6.0 or later.\n")
+	exit(1)
 
 if len(argv) < 2:
 	print 'usage:', argv[0], '<zipfile>...'
Signature · 1 line
1.8.2.rc0.263.g20d9441
#12 lore raw

PATCH v2 12/16 contrib/fast-import/import-zips.py: use spaces instead of tabs

Follow the conventional Python style by using 4-space indents instead of hard tabs.

---
 contrib/fast-import/import-zips.py | 98 +++++++++++++++++++-------------------
 1 file changed, 49 insertions(+), 49 deletions(-)
contrib/fast-import/import-zips.py +49 -49
index b528798..d12c296 100755
@@ -14,13 +14,13 @@ from time import mktime
 from zipfile import ZipFile
 
 if hexversion < 0x01060000:
-	# The limiter is the zipfile module
-	stderr.write("import-zips.py: requires Python 1.6.0 or later.\n")
-	exit(1)
+    # The limiter is the zipfile module
+    stderr.write("import-zips.py: requires Python 1.6.0 or later.\n")
+    exit(1)
 
 if len(argv) < 2:
-	print 'usage:', argv[0], '<zipfile>...'
-	exit(1)
+    print 'usage:', argv[0], '<zipfile>...'
+    exit(1)
 
 branch_ref = 'refs/heads/import-zips'
 committer_name = 'Z Ip Creator'
@@ -28,51 +28,51 @@ committer_email = '[email protected]'
 
 fast_import = popen('git fast-import --quiet', 'w')
 def printlines(list):
-	for str in list:
-		fast_import.write(str + "\n")
+    for str in list:
+        fast_import.write(str + "\n")
 
 for zipfile in argv[1:]:
-	commit_time = 0
-	next_mark = 1
-	common_prefix = None
-	mark = dict()
-
-	zip = ZipFile(zipfile, 'r')
-	for name in zip.namelist():
-		if name.endswith('/'):
-			continue
-		info = zip.getinfo(name)
-
-		if commit_time < info.date_time:
-			commit_time = info.date_time
-		if common_prefix == None:
-			common_prefix = name[:name.rfind('/') + 1]
-		else:
-			while not name.startswith(common_prefix):
-				last_slash = common_prefix[:-1].rfind('/') + 1
-				common_prefix = common_prefix[:last_slash]
-
-		mark[name] = ':' + str(next_mark)
-		next_mark += 1
-
-		printlines(('blob', 'mark ' + mark[name], \
-					'data ' + str(info.file_size)))
-		fast_import.write(zip.read(name) + "\n")
-
-	committer = committer_name + ' <' + committer_email + '> %d +0000' % \
-		mktime(commit_time + (0, 0, 0))
-
-	printlines(('commit ' + branch_ref, 'committer ' + committer, \
-		'data <<EOM', 'Imported from ' + zipfile + '.', 'EOM', \
-		'', 'deleteall'))
-
-	for name in mark.keys():
-		fast_import.write('M 100644 ' + mark[name] + ' ' +
-			name[len(common_prefix):] + "\n")
-
-	printlines(('',  'tag ' + path.basename(zipfile), \
-		'from ' + branch_ref, 'tagger ' + committer, \
-		'data <<EOM', 'Package ' + zipfile, 'EOM', ''))
+    commit_time = 0
+    next_mark = 1
+    common_prefix = None
+    mark = dict()
+
+    zip = ZipFile(zipfile, 'r')
+    for name in zip.namelist():
+        if name.endswith('/'):
+            continue
+        info = zip.getinfo(name)
+
+        if commit_time < info.date_time:
+            commit_time = info.date_time
+        if common_prefix == None:
+            common_prefix = name[:name.rfind('/') + 1]
+        else:
+            while not name.startswith(common_prefix):
+                last_slash = common_prefix[:-1].rfind('/') + 1
+                common_prefix = common_prefix[:last_slash]
+
+        mark[name] = ':' + str(next_mark)
+        next_mark += 1
+
+        printlines(('blob', 'mark ' + mark[name], \
+                    'data ' + str(info.file_size)))
+        fast_import.write(zip.read(name) + "\n")
+
+    committer = committer_name + ' <' + committer_email + '> %d +0000' % \
+        mktime(commit_time + (0, 0, 0))
+
+    printlines(('commit ' + branch_ref, 'committer ' + committer, \
+        'data <<EOM', 'Imported from ' + zipfile + '.', 'EOM', \
+        '', 'deleteall'))
+
+    for name in mark.keys():
+        fast_import.write('M 100644 ' + mark[name] + ' ' +
+            name[len(common_prefix):] + "\n")
+
+    printlines(('',  'tag ' + path.basename(zipfile), \
+        'from ' + branch_ref, 'tagger ' + committer, \
+        'data <<EOM', 'Package ' + zipfile, 'EOM', ''))
 
 if fast_import.close():
-	exit(1)
+    exit(1)
Signature · 1 line
1.8.2.rc0.263.g20d9441
#13 lore raw

PATCH v2 13/16 contrib/examples: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 contrib/examples/git-remote.perl    | 2 +-
 contrib/examples/git-svnimport.perl | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
contrib/examples/git-remote.perl +1 -1
index b17952a..b549a3c 100755
@@ -347,7 +347,7 @@ sub rm_remote {
 }
 
 sub add_usage {
-	print STDERR "Usage: git remote add [-f] [-t track]* [-m master] <name> <url>\n";
+	print STDERR "usage: git remote add [-f] [-t track]* [-m master] <name> <url>\n";
 	exit(1);
 }
 
contrib/examples/git-svnimport.perl +1 -1
index b09ff8f..c414f0d 100755
@@ -36,7 +36,7 @@ our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,
 
 sub usage() {
 	print STDERR <<END;
-Usage: ${\basename $0}     # fetch/update GIT from SVN
+usage: ${\basename $0}     # fetch/update GIT from SVN
        [-o branch-for-HEAD] [-h] [-v] [-l max_rev] [-R repack_each_revs]
        [-C GIT_repository] [-t tagname] [-T trunkname] [-b branchname]
        [-d|-D] [-i] [-u] [-r] [-I ignorefilename] [-s start_chg]
Signature · 1 line
1.8.2.rc0.263.g20d9441
#14 lore raw

PATCH v2 14/16 contrib/hooks/setgitperms.perl: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 contrib/hooks/setgitperms.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/hooks/setgitperms.perl +1 -1
index a577ad0..2770a1b 100644
@@ -24,7 +24,7 @@ use File::Find;
 use File::Basename;
 
 my $usage =
-"Usage: setgitperms.perl [OPTION]... <--read|--write>
+"usage: setgitperms.perl [OPTION]... <--read|--write>
 This program uses a file `.gitmeta` to store/restore permissions and uid/gid
 info for all files/dirs tracked by git in the repository.
 
Signature · 1 line
1.8.2.rc0.263.g20d9441
#15 lore raw

PATCH v2 15/16 templates/hooks--update.sample: use a lowercase "usage:" string

Make the usage string consistent with Git.

---
 templates/hooks--update.sample | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
templates/hooks--update.sample +1 -1
index 71ab04e..d847583 100755
@@ -38,7 +38,7 @@ if [ -z "$GIT_DIR" ]; then
 fi
 
 if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
-	echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
+	echo "usage: $0 <ref> <oldrev> <newrev>" >&2
 	exit 1
 fi
 
Signature · 1 line
1.8.2.rc0.263.g20d9441
#16 lore raw

PATCH v2 16/16 Documentation/user-manual.txt: use a lowercase "usage:" string

Make the usage string in the example script consistent with Git.

---
 Documentation/user-manual.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/user-manual.txt +2 -2
index 5f36f81..35a279a 100644
@@ -2337,7 +2337,7 @@ origin)
 	fi
 	;;
 *)
-	echo "Usage: $0 origin|test|release" 1>&2
+	echo "usage: $0 origin|test|release" 1>&2
 	exit 1
 	;;
 esac
@@ -2351,7 +2351,7 @@ pname=$0
 
 usage()
 {
-	echo "Usage: $pname branch test|release" 1>&2
+	echo "usage: $pname branch test|release" 1>&2
 	exit 1
 }
 
Signature · 1 line
1.8.2.rc0.263.g20d9441
#17 lore raw
In reply to David Aguilar

Thanks.

After applying these patches, "git grep '^[^#]*Usage:'" still shows a handful more hits, such as contrib/examples/git-remote.perl that are touched by this series.

#18 lore raw
Quoted 5 lines · Junio C Hamano

Thanks.

After applying these patches, "git grep '^[^#]*Usage:'" still shows a handful more hits, such as contrib/examples/git-remote.perl that are touched by this series.

Thanks, I'll take a look at these.

I stayed away from tests and comments in the first round so that we could catch the user-facing strings. That seems to have settled in well so I can make another pass and catch these last remaining stragglers.

Signature · 1 line
David