mirror of
https://github.com/git/git
synced 2024-08-25 10:45:59 +00:00
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>
This commit is contained in:
parent
5b5fe9a526
commit
4e6380e5c3
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue