Code

Do not barf on too long action description
authorJunio C Hamano <junkio@cox.net>
Sat, 28 Apr 2007 07:15:48 +0000 (00:15 -0700)
committerJunio C Hamano <junkio@cox.net>
Sun, 29 Apr 2007 08:33:13 +0000 (01:33 -0700)
Reflog message is primarily about easier identification, and
leaving truncated entry is much better than dying.

Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-fetch--tool.c

index e9d676455078b40138ad4716a912c4b2b5e10c2e..2ad45dcd447c582fc37dc133c9a7bb3260dc31ea 100644 (file)
@@ -35,16 +35,13 @@ 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");
+       snprintf(msg, sizeof(msg), "%s: %s", rla, action);
        lock = lock_any_ref_for_update(refname, oldval);
        if (!lock)
                return 1;