Skip to content

Commit

Permalink
Do not barf on too long action description
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Apr 29, 2007
1 parent 5b5fe9a commit 4e6380e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions builtin-fetch--tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4e6380e

Please sign in to comment.