From: Johannes Schindelin Date: Thu, 22 Feb 2007 17:09:02 GMT Subject: Re: [PATCH] Add git-bundle: move objects and references by archive Message-ID: In-Reply-To: <45DDC8D7.60902@fs.ei.tum.de> 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