Do not barf on too long action description
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>
Junio C Hamano committed
Apr 28, 2007 at 00:15 UTC
4e6380e5c3af2d8cea8ffac2a7759b4f4e62089b
1 file changed
+1
-4
builtin-fetch--tool.c
+1
-4
@@ -35,16 +35,13 @@ static int update_ref(const char *action,
35
unsigned char *sha1,
36
unsigned char *oldval)
37
{
38
- int len;
38
char msg[1024];
39
char *rla = getenv("GIT_REFLOG_ACTION");
40
static struct ref_lock *lock;
41
42
if (!rla)
43
rla = "(reflog update)";
45
- len = snprintf(msg, sizeof(msg), "%s: %s", rla, action);
46
- if (sizeof(msg) <= len)
47
- die("insanely long action");
44
+ snprintf(msg, sizeof(msg), "%s: %s", rla, action);
45
lock = lock_any_ref_for_update(refname, oldval);
46
if (!lock)
47
return 1;