Code

pretty-options.txt: tiny doc fix
[git.git] / builtin-fetch--tool.c
index 3145c01f7e0e81bf28314b92737ccf2abb129dcd..e2f8ede9ae4507ed1e431f9d14fc649f6475627d 100644 (file)
@@ -1,3 +1,4 @@
+#include "builtin.h"
 #include "cache.h"
 #include "refs.h"
 #include "commit.h"
@@ -6,11 +7,11 @@
 
 static char *get_stdin(void)
 {
-       int offset = 0;
+       size_t offset = 0;
        char *data = xmalloc(CHUNK_SIZE);
 
        while (1) {
-               int cnt = xread(0, data + offset, CHUNK_SIZE);
+               ssize_t cnt = xread(0, data + offset, CHUNK_SIZE);
                if (cnt < 0)
                        die("error reading standard input: %s",
                            strerror(errno));
@@ -35,17 +36,14 @@ static int update_ref(const char *action,
                      unsigned char *sha1,
                      unsigned char *oldval)
 {
-       int len;
        char msg[1024];
        char *rla = getenv("GIT_REFLOG_ACTION");
        static struct ref_lock *lock;
 
        if (!rla)
                rla = "(reflog update)";
-       len = snprintf(msg, sizeof(msg), "%s: %s", rla, action);
-       if (sizeof(msg) <= len)
-               die("insanely long action");
-       lock = lock_any_ref_for_update(refname, oldval);
+       snprintf(msg, sizeof(msg), "%s: %s", rla, action);
+       lock = lock_any_ref_for_update(refname, oldval, 0);
        if (!lock)
                return 1;
        if (write_ref_sha1(lock, sha1, msg) < 0)