March 8th, 2008

fedora 蓝色小药丸

Binary or Text

Dear LazyWeb:

Simply speaking, I need a way to fast convert files, so files from VSS can be committed to a Git repo (Why? I like it. and .)

Files containing trailing blanks can only be committed with "git commit -n", but I don't like that. Since the VSS=>Git operation is not done frequently, I was using dos2unix then sed to trim the blanks, but sed cannot recognize a file is binary or text, and my existing method to probe that is too slow.

Suggest me to use Hg or bzr please. Any speed benchmark on win32? Repo size is 13k files, 250M (single snapshot).



update: I got it with git's own pre-commit hook (use diff to find text file or not). Commit first, then trim trailing blanks, then commit again: diff will be faster, and object can be reused I think (so add can be faster). Code like this, how to use xargs?

Collapse )
fedora 蓝色小药丸

VSS and local Git

Since all codes in Git can build, don't overwrite them with files from VSS if you want a stable testing environment.

If you do need a later version, take care to download the minimum from VSS, and you can always go back with "git reset --hard" which means drop all local changes. Before downloading new code from VSS, remember to commit your local modification to a branch, and switch to "master" to do the test build. Once build is done, then switch back and rebase the branch. The "master" branch is used to track upstream.

When you are going to commit to VSS, first do a rebase, then make sure it works, then merge it to "master" and (optionally) delete the branch. Finally, commit to VSS. In this way the history can be retained by the merge.

I sent this email today, donno if this is the right way (TM) to use Git. But we must do it. Try it first.