# [PATCH v2 03/16] git-relink: use a lowercase "usage:" string

19 messages from 2013-02-24 to 2013-02-24. Participants: David Aguilar, Junio C Hamano.
Thread: https://gitlist.dev/t/32993

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 00/16] use a lowercase "usage:" string
Message-ID: <1361667024-49776-1-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-1-git-send-email-davvid%40gmail.com

```
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(-)

-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 01/16] git-sh-setup: use a lowercase "usage:" string
Message-ID: <1361667024-49776-2-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-2-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-1-git-send-email-davvid@gmail.com>

```
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.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-sh-setup.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 795edd2..9cfbe7f 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -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
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 02/16] git-svn: use a lowercase "usage:" string
Message-ID: <1361667024-49776-3-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-3-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-2-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-svn.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-svn.perl b/git-svn.perl
index b46795f..a93166f 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -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;
 
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 03/16] git-relink: use a lowercase "usage:" string
Message-ID: <1361667024-49776-4-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-4-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-3-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-relink.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-relink.perl b/git-relink.perl
index f29285c..236a352 100755
--- a/git-relink.perl
+++ b/git-relink.perl
@@ -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" .
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 04/16] git-merge-one-file: use a lowercase "usage:" string
Message-ID: <1361667024-49776-5-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-5-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-4-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-merge-one-file.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
index f612cb8..3373c04 100755
--- a/git-merge-one-file.sh
+++ b/git-merge-one-file.sh
@@ -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."
 
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 05/16] git-archimport: use a lowercase "usage:" string
Message-ID: <1361667024-49776-6-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-6-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-5-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-archimport.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-archimport.perl b/git-archimport.perl
index bc32f18..9cb123a 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -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
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 06/16] git-cvsexportcommit: use a lowercase "usage:" string
Message-ID: <1361667024-49776-7-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-7-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-6-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-cvsexportcommit.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index e6bf252..d13f02d 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -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);
 }
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 07/16] git-cvsimport: use a lowercase "usage:" string
Message-ID: <1361667024-49776-8-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-8-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-7-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-cvsimport.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 344f120..73d367c 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -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]
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 08/16] git-cvsimport: use a lowercase "usage:" string
Message-ID: <1361667024-49776-9-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-9-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-8-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-cvsserver.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 3679074..f1c3f49 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -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".
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 09/16] contrib/credential: use a lowercase "usage:" string
Message-ID: <1361667024-49776-10-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-10-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-9-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 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(-)

diff --git a/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c b/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
index 41f61c5..f2cdefe 100644
--- a/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
+++ b/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
@@ -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)
diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
index 6beed12..3940202 100644
--- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c
+++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
@@ -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);
diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c
index cbaec5f..6619492 100644
--- a/contrib/credential/wincred/git-credential-wincred.c
+++ b/contrib/credential/wincred/git-credential-wincred.c
@@ -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);
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 10/16] contrib/fast-import: use a lowercase "usage:" string
Message-ID: <1361667024-49776-11-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-11-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-10-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 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(-)

diff --git a/contrib/fast-import/git-import.perl b/contrib/fast-import/git-import.perl
index f9fef6d..0891b9e 100755
--- a/contrib/fast-import/git-import.perl
+++ b/contrib/fast-import/git-import.perl
@@ -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";
 
diff --git a/contrib/fast-import/git-import.sh b/contrib/fast-import/git-import.sh
index 0ca7718..f8d803c 100755
--- a/contrib/fast-import/git-import.sh
+++ b/contrib/fast-import/git-import.sh
@@ -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
 
diff --git a/contrib/fast-import/import-zips.py b/contrib/fast-import/import-zips.py
index 5cec9b0..f54c65b 100755
--- a/contrib/fast-import/import-zips.py
+++ b/contrib/fast-import/import-zips.py
@@ -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'
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 11/16] contrib/fast-import/import-zips.py: fix broken error message
Message-ID: <1361667024-49776-12-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-12-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-11-git-send-email-davvid@gmail.com>

```
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.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 contrib/fast-import/import-zips.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/contrib/fast-import/import-zips.py b/contrib/fast-import/import-zips.py
index f54c65b..b528798 100755
--- a/contrib/fast-import/import-zips.py
+++ b/contrib/fast-import/import-zips.py
@@ -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>...'
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 12/16] contrib/fast-import/import-zips.py: use spaces instead of tabs
Message-ID: <1361667024-49776-13-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-13-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-12-git-send-email-davvid@gmail.com>

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

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 contrib/fast-import/import-zips.py | 98 +++++++++++++++++++-------------------
 1 file changed, 49 insertions(+), 49 deletions(-)

diff --git a/contrib/fast-import/import-zips.py b/contrib/fast-import/import-zips.py
index b528798..d12c296 100755
--- a/contrib/fast-import/import-zips.py
+++ b/contrib/fast-import/import-zips.py
@@ -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 = 'zip@example.com'
 
 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)
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 13/16] contrib/examples: use a lowercase "usage:" string
Message-ID: <1361667024-49776-14-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-14-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-13-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 contrib/examples/git-remote.perl    | 2 +-
 contrib/examples/git-svnimport.perl | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/examples/git-remote.perl b/contrib/examples/git-remote.perl
index b17952a..b549a3c 100755
--- a/contrib/examples/git-remote.perl
+++ b/contrib/examples/git-remote.perl
@@ -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);
 }
 
diff --git a/contrib/examples/git-svnimport.perl b/contrib/examples/git-svnimport.perl
index b09ff8f..c414f0d 100755
--- a/contrib/examples/git-svnimport.perl
+++ b/contrib/examples/git-svnimport.perl
@@ -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]
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 14/16] contrib/hooks/setgitperms.perl: use a lowercase "usage:" string
Message-ID: <1361667024-49776-15-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-15-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-14-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 contrib/hooks/setgitperms.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/hooks/setgitperms.perl b/contrib/hooks/setgitperms.perl
index a577ad0..2770a1b 100644
--- a/contrib/hooks/setgitperms.perl
+++ b/contrib/hooks/setgitperms.perl
@@ -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.
 
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 15/16] templates/hooks--update.sample: use a lowercase "usage:" string
Message-ID: <1361667024-49776-16-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-16-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-15-git-send-email-davvid@gmail.com>

```
Make the usage string consistent with Git.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 templates/hooks--update.sample | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/hooks--update.sample b/templates/hooks--update.sample
index 71ab04e..d847583 100755
--- a/templates/hooks--update.sample
+++ b/templates/hooks--update.sample
@@ -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
 
-- 
1.8.2.rc0.263.g20d9441

```

## David Aguilar, 2013-02-24 00:50

Subject: [PATCH v2 16/16] Documentation/user-manual.txt: use a lowercase "usage:" string
Message-ID: <1361667024-49776-17-git-send-email-davvid@gmail.com>
URL: https://gitlist.dev/e/1361667024-49776-17-git-send-email-davvid%40gmail.com
In-Reply-To: <1361667024-49776-16-git-send-email-davvid@gmail.com>

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

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 Documentation/user-manual.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 5f36f81..35a279a 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -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
 }
 
-- 
1.8.2.rc0.263.g20d9441

```

## Junio C Hamano, 2013-02-24 21:45

Subject: Re: [PATCH v2 00/16] use a lowercase "usage:" string
Message-ID: <7vobf94c95.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vobf94c95.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1361667024-49776-1-git-send-email-davvid@gmail.com>

```
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.

```

## David Aguilar, 2013-02-24 22:32

Subject: Re: [PATCH v2 00/16] use a lowercase "usage:" string
Message-ID: <CAJDDKr4+n3HgfWr-_eXSCOqUD1GpBVsU_2p5CfHj6kGs0OajYw@mail.gmail.com>
URL: https://gitlist.dev/e/CAJDDKr4%2Bn3HgfWr-_eXSCOqUD1GpBVsU_2p5CfHj6kGs0OajYw%40mail.gmail.com
In-Reply-To: <7vobf94c95.fsf@alter.siamese.dyndns.org>

```
On Sun, Feb 24, 2013 at 1:45 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 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.
-- 
David

```
