Re: [PATCH] Add git-bundle: move objects and references by archive

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

 



Hi,

On Thu, 22 Feb 2007, Simon 'corecode' Schubert wrote:

> Johannes Schindelin wrote:
> > 
> > On Thu, 22 Feb 2007, Simon 'corecode' Schubert wrote:
> > 
> > > Maybe something like this would be cleaner:
> > > 
> > > if (IS_REF(st.st_mode) && lseek(input_fd, 0, SEEK_CUR) != st.st_size)
> > > 	die("...");
> > 
> > The lseek would fail whenever the input is _not_ a file, dying. Since
> > index-pack is called from fetch-pack, with a socket instead of a file, it
> > would fail for the most common user.
> 
> that's why i put IS_REF (should read IS_REG) there.

Ah, yes, I understand.

> but as nicolas pointed out, this won't work for read-ahead.

Well, you could do this:

if (S_ISREG(st.st_mode) &&
		lseek(input_fd, 0, SEEK_CUR) - input_len != st.st_size)
	die("...");

Of course, this suggests that a file containing a pack must not have 
_anything_ after the pack. But AFAIR the reading part chokes on "garbage 
after pack" anyway.

Ciao,
Dscho

-
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]