* [GSOC 2012] Some questions regarding a possible project to improve big file support
@ 2012-03-25 20:48 Peter C.
2012-03-26 1:21 ` Nguyen Thai Ngoc Duy
0 siblings, 1 reply; 2+ messages in thread
From: Peter C. @ 2012-03-25 20:48 UTC (permalink / raw)
To: git
Hello, I'm considering working on Git for GSOC 2012, specifically in
improving big file support, however I wanted to ask a few questions
first, some about the low level operations of how Git handles diffs
between files, and also a question or two regarding implementation.
My first question is more of a question regarding low level
functionality of how Git diffs files. The question is, in the diff
process, does git just parse the file and see if there are diffs, or
does it use something like hashing to first tell if the file has been
modified at all, and then go to the diff process if the hash is
different. An extension to this question is, in Git's internal database,
does it set any kind of flag to say that a file is a binary if it is one.
My thought process in implementation involves checking the hash, and if
the hash is the same, skip it, if the hash is different, check the MIME
type possibly using libmagic, and if it matches a known binary format,
then just commit the new version, rather than trying to run a whole diff
and load the whole file in the process.
The thing I'm worried about is, would anything involved in this break
existing Git functionality, or backward compatibility. I'd also greatly
appreciate any feedback on my ideas.
Thanks,
Peter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [GSOC 2012] Some questions regarding a possible project to improve big file support
2012-03-25 20:48 [GSOC 2012] Some questions regarding a possible project to improve big file support Peter C.
@ 2012-03-26 1:21 ` Nguyen Thai Ngoc Duy
0 siblings, 0 replies; 2+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-03-26 1:21 UTC (permalink / raw)
To: Peter C.; +Cc: git
On Mon, Mar 26, 2012 at 3:48 AM, Peter C. <th3flyboy@gmail.com> wrote:
> My first question is more of a question regarding low level
> functionality of how Git diffs files. The question is, in the diff
> process, does git just parse the file and see if there are diffs, or
> does it use something like hashing to first tell if the file has been
> modified at all, and then go to the diff process if the hash is
> different. An extension to this question is, in Git's internal database,
> does it set any kind of flag to say that a file is a binary if it is one.
If hashes are available, we compare hash first (e.g. diff-tree). We
can mark a file binary with gitattributes. I think the binary
detection code, buffer_is_binary, could be just moved up a little bit
before we unpack file contents. But I'm not really familiar with this
area.
> My thought process in implementation involves checking the hash, and if
> the hash is the same, skip it, if the hash is different, check the MIME
> type possibly using libmagic, and if it matches a known binary format,
> then just commit the new version, rather than trying to run a whole diff
> and load the whole file in the process.
Overkill, compared to how binary is detected today :)
#define FIRST_FEW_BYTES 8000
int buffer_is_binary(const char *ptr, unsigned long size)
{
if (FIRST_FEW_BYTES < size)
size = FIRST_FEW_BYTES;
return !!memchr(ptr, 0, size);
}
If you are interested in this big file support, I think you should
focus on the "Many large files do not delta well..." item in the wiki
page. The framework has already been done by Junio. That can make git
manage gigabyte files just fine (aka "bup").
--
Duy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-26 1:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-25 20:48 [GSOC 2012] Some questions regarding a possible project to improve big file support Peter C.
2012-03-26 1:21 ` Nguyen Thai Ngoc Duy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.