Skip to contentSkip to conversation

binary safe?

DISCUSSION Randal L. Schwartz 7 participants 9 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

I'm currently about to abandon CVS for my website management, replacing it with git.

What problems, if any, will I have using git to manage the binary files for my site, like the custom icons? CVS is doing that just fine now.

I presume emailing diff-patches is out of the question, but if all I'm doing is git-push and git-pull (using the shared central repository model), and if I'm stupid enough to have a merge error it's OK to just blow up on a binary file, will everything else work fine?

Signature · 4 lines
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
#1 lore raw
Quoted 3 lines · Randal L. Schwartz

What problems, if any, will I have using git to manage the binary files for my site, like the custom icons? CVS is doing that just fine now.

We're now using git in production to distribute content, of which well over 90% is binary files. Works great.

Signature · 2 lines
For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled.
#2 lore raw
In reply to Randal L. Schwartz
Quoted 4 lines · [email protected] (Randal L. Schwartz) writes:

I presume emailing diff-patches is out of the question, but if all I'm doing is git-push and git-pull (using the shared central repository model), and if I'm stupid enough to have a merge error it's OK to just blow up on a binary file, will everything else work fine?

It should. I trust git well enough to track some png files in my day-job project.

#3 lore raw
Quoted 9 lines · Junio C Hamano
Quoted 4 lines · [email protected] (Randal L. Schwartz) writes:

I presume emailing diff-patches is out of the question, but if all I'm doing is git-push and git-pull (using the shared central repository model), and if I'm stupid enough to have a merge error it's OK to just blow up on a binary file, will everything else work fine?

It should. I trust git well enough to track some png files in my day-job project.

Yes it works, and cvsimport -k will do the right thing for you.

We are tracking projects with several binary files. The only issue as you note is that trading patches with git-format-patch and git-am doesn't quite deal with it. But you can still do it across different git heads with git-read-tree -m as long as your binary file merges are truly trivial.

cheers,

martin

#4 lore raw
Quoted 1 line · Martin Langhoff

Yes it works, and cvsimport -k will do the right thing for you.

Unless it has changed from 0.99.9b, 'cvsimport -k' will very much scramble some binary files. '-k' passes the '-kk' option which causes CVS to strip the keywords down. It needs to pass -ko through if you want it to be able to handle binary files.

However, since CVS (RCS really) can remember the state of this flag, it does work to 'cvs admin -ko filename' beforehand, and then do the cvsimport without the '-k' option.

Dave

#5 lore raw
Quoted 8 lines · David Brown
Quoted 1 line · Martin Langhoff

Yes it works, and cvsimport -k will do the right thing for you.

Unless it has changed from 0.99.9b, 'cvsimport -k' will very much scramble some binary files. '-k' passes the '-kk' option which causes CVS to strip the keywords down. It needs to pass -ko through if you want it to be able to handle binary files.

There is a misunderstanding here. We don't pass '-kk' to the cvs utility -- we pass it at the protocol level. Strangely enough, when passing ko we were getting broken files, and when passing kk we got all the files correctly. I explored and tested this quite a bit when I added the flag, and explicitly tested it with files that _would_ get broken with cvs update -kk.

To recap: my main test repository has a lot of binary files, files that do get broken if I do a cvs checkout with -kk. git-cvsimport gets them right with its -k parameter. Don't ask me why, though: the cvs protocol is really messy, and I suspect that part of the -kk option is being 'implemented' on the client side.

(That being said, if you have a case where git-cvsimport is doing the wrong thing, let me know!)

Quoted 3 lines

However, since CVS (RCS really) can remember the state of this flag, it does work to 'cvs admin -ko filename' beforehand, and then do the cvsimport without the '-k' option.

Yes, but a repo you don't control, where people are using keywords, means thatyou need to do -kk to kill the keywords or your imported files are going to have a horrid amount of noise in them.

cheers,

martin

#6 lore raw
Quoted 10 lines · Martin Langhoff

(That being said, if you have a case where git-cvsimport is doing the wrong thing, let me know!)

Quoted 3 lines

However, since CVS (RCS really) can remember the state of this flag, it does work to 'cvs admin -ko filename' beforehand, and then do the cvsimport without the '-k' option.

Yes, but a repo you don't control, where people are using keywords, means thatyou need to do -kk to kill the keywords or your imported files are going to have a horrid amount of noise in them.

Yes, the unpleasantness of CVS.

However, I was unable to do a proper git-cvsimport of the SourceForge 'vim' archive, with '-k'. By not giving it '-k' and using cvs admin '-ko' on the appropriate files, I was able to get the correct results.

May be the interpretation of the option depends on the particular server being used?

I can investigate later which particular file is causing the problem.

Dave

#7 lore raw
In reply to Randal L. Schwartz
Quoted 7 lines · Randal L. Schwartz

I'm currently about to abandon CVS for my website management, replacing it with git.

What problems, if any, will I have using git to manage the binary files for my site, like the custom icons? CVS is doing that just fine now.

Git doesn't have any textual representations anywhere.

So the _only_ problem should be "git diff" (and related patch-based tools
- git-apply etc). They'll simply not work. For similar reasons, a three-way merge will obviously fail.

Quoted 4 lines

I presume emailing diff-patches is out of the question, but if all I'm doing is git-push and git-pull (using the shared central repository model), and if I'm stupid enough to have a merge error it's OK to just blow up on a binary file, will everything else work fine?

Yes. I don't think it's been heavily tested, but the very architecture of git should mean that there just shouldn't be any issues with binary files outside of the obvious ones.

The only binary file the kernel ever uses is the logo.gif thing, so it's been "tested" in the sense that binary files exist, but there's never been any changes to that file, so..

Linus

#8 lore raw
Quoted 3 lines · Linus Torvalds

So the _only_ problem should be "git diff" (and related patch-based tools - git-apply etc). They'll simply not work. For similar reasons, a three-way merge will obviously fail.

I always thought it would be nice for binary files if SCMs could export a summary of what ranges of bytes changes or even xdelta'ish details.

Given that people do stick large multi-MB binary blobs in SCMs and sometimes these update only a few bytes at a time it has some value.