Re: [PATCH] Function for updating refs.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007/9/5, Junio C Hamano <gitster@xxxxxxxxx>:
> Carlos Rica <jasampler@xxxxxxxxx> writes:
> > -     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)
> > -             return 1;
> > -     return 0;
> > +     if (snprintf(msg, sizeof(msg), "%s: %s", rla, action) >= sizeof(msg))
> > +             error("reflog message too long: %.*s...", 50, msg);
>
> The original I did was sloppy and did not detect this situation;
> thanks for fixing it.  You do not refuse the primary operation,
> which is to update the ref, so this should be a warning instead
> of an error, I think.

Yes, it is. Also, I tested what would happen when the lock fails. I tried to
lock an already locked ref, and it died printing the message
die("unable to create '%s.lock': %s", path, strerror(errno));  from
lockfile.c. I think this is interesting. There are other failing
reasons that could
make the update_ref function to print its error, but I haven't tested them.

> > diff --git a/send-pack.c b/send-pack.c
> > ...
> This removal makes "struct ref_lock *lock" (not shown in the
> context) unused.  I will remove the declaration.

Thank you. Also in builtin-update-ref.c the main function could return
directly that value returned from the call to update_ref().
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux