Re: git advice
"Craig A. Berry" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
On Mar 10, 2012, at 4:56 PM, James K. Lowden wrote: > For an overnight tarball builder against > https://gitorious.org/freetds/freetds, what is the best way to get the > latest HEAD and branch code? > > Currently in CVS, I do: > > 1. cd $(TOPSRC) > 2. /bin/rm -rf .cvsignore * > 3. /usr/bin/cvs checkout -r $(BRANCH) freetds > > The equivalent would seem to be "git clone" but that seems somehow > barbaric. My intuition tells me that's not the git way, because > distributed repositories are designed to avoid refetching the code. > > If avoiding rm -rf, I'd like advice on programmatically detecting and > reverting modified files. (Files can be modified, both inadvertently > and intentionally in the process of producing the tarball. Consider > configure.ac and the SONAME.) > > Suggestions? You might create a clone once, but you wouldn't need to clone again for each snapshot. "git archive" can create a tarball of the repository, but if I understand correctly how things work with freetds, not everything you want to distribute with a tarball is under version control, so you need to run autoconf and make dist in order to produce the snapshot. The following command will wipe out any files that are not under version control: $ git clean -xdf That may be the only bit you were looking for, but I'm not sure. Here's how I create a local snapshot of an arbitrary branch of Perl: % cat branch_snap.sh #!/bin/csh set branch=`basename "$1"` echo "Working on $branch" cd ~/perlrep/perl git checkout $1 || exit 2 git pull git clean -xdf if (-e "~/Sites/$branch.zip") then rm "~/Sites/$branch.zip" endif perl Porting/make_dot_patch.pl > .patch git archive --format=zip --output="$HOME/Sites/$branch.zip" HEAD zip -pp="$branch/" ~/Sites/$branch.zip .patch git clean -xdf So I would simply do % ./branch_snap.sh maint-5.14 to get a zipball of the maint-5.14 branch in ~/Sites/maint-5.14.zip. I prefer info-zip to tar-gz, but you get the idea. The make_dot_patch.pl script dumps the branch name, the output of "git describe" and some other info into a text file and zip -pp adds that file to the archive. That part would be replaced by anything that you do to a freetds checkout to produce a snapshot. ________________________________________ Craig A. Berry mailto:[email protected] "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser