Re: [PATCH] Add git-bundle: move objects and references by archive
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 22, 2007, 17:09 UTC
- Message-ID
- <Pine.LNX.4.63.0702221805070.22628@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <45DDC8D7.60902@fs.ei.tum.de>
Hi,
On Thu, 22 Feb 2007, Simon 'corecode' Schubert wrote:
Show 14 quoted lines
> 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