t/t9600: remove exit after test_done
[gitweb.git] / hash-object.c
index a4d127cf78013ca43339c5493b7f7ef90b2145a8..37e66779ab9e14dbe5b5416d0e19b04d7f122d52 100644 (file)
@@ -8,6 +8,7 @@
 #include "blob.h"
 #include "quote.h"
 #include "parse-options.h"
+#include "exec_cmd.h"
 
 static void hash_fd(int fd, const char *type, int write_object, const char *path)
 {
@@ -34,10 +35,8 @@ static void hash_object(const char *path, const char *type, int write_object,
 
 static void hash_stdin_paths(const char *type, int write_objects)
 {
-       struct strbuf buf, nbuf;
+       struct strbuf buf = STRBUF_INIT, nbuf = STRBUF_INIT;
 
-       strbuf_init(&buf, 0);
-       strbuf_init(&nbuf, 0);
        while (strbuf_getline(&buf, stdin, '\n') != EOF) {
                if (buf.buf[0] == '"') {
                        strbuf_reset(&nbuf);
@@ -83,6 +82,8 @@ int main(int argc, const char **argv)
 
        type = blob_type;
 
+       git_extract_argv0_path(argv[0]);
+
        git_config(git_default_config, NULL);
 
        argc = parse_options(argc, argv, hash_object_options, hash_object_usage, 0);
@@ -112,7 +113,7 @@ int main(int argc, const char **argv)
        }
 
        if (errstr) {
-               error (errstr);
+               error("%s", errstr);
                usage_with_options(hash_object_usage, hash_object_options);
        }