sha1_to_hex: properly terminate the SHA1
[git.git] / pack-objects.c
index 4e941e7..caf3b6b 100644 (file)
@@ -4,7 +4,7 @@
 #include "pack.h"
 #include "csum-file.h"
 
-static const char pack_usage[] = "git-pack-objects [--local] [--incremental] [--window=N] [--depth=N] {--stdout | base-name} < object-list";
+static const char pack_usage[] = "git-pack-objects [--non-empty] [--local] [--incremental] [--window=N] [--depth=N] {--stdout | base-name} < object-list";
 
 struct object_entry {
        unsigned char sha1[20];
@@ -473,6 +473,8 @@ int main(int argc, char **argv)
        struct object_entry **list;
        int i;
 
+       setup_git_directory();
+
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];
 
@@ -524,7 +526,7 @@ int main(int argc, char **argv)
                unsigned char sha1[20];
 
                if (get_sha1_hex(line, sha1))
-                       die("expected sha1, got garbage");
+                       die("expected sha1, got garbage:\n %s", line);
                hash = 0;
                p = line+40;
                while (*p) {