Skip to Content.
Sympa Menu

freetds - Re: [freetds] git advice

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] git advice
  • Date: Sun, 11 Mar 2012 11:38:17 +0000

2012/3/10 James K. Lowden <jklowden AT freetds.org>:
> 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
>

Personally I use a separate directory for my development and stuff
like this. This cause if I want do do some experiment without
committing or other dirty stuff and I don't want to lose files.

To "copy" from external repository to your you can do a "git fetch".
If you want to remove files created you can use, as Craig suggested,
the "git clean" command. To get a specified branch the command is "git
checkout" that works on your repo (in cvs there is not such
distinction). If you have to revert changes you did to some files (in
the repo) you can use "git reset --hard HEAD".

Another way to achieve this is to fetch a given tar/gz from a repo and
extract in an empty directory, something like

REPO=/your_even_dirty_working_directory
WORK=/your_temporary_directory

cd $REPO
git fetch --all # get all branches into your repo
for B in master Branch-0_91; do
cd $WORK
rm -rf $B
cd $REPO
git archive $B --prefix=$B/ | (cd $WORK && tar xf -)
cd $WORK
# put your stuff here
...
done

Probably you can avoid some cd using --git-dir

REPO=/your_even_dirty_working_directory/.git
WORK=/your_temporary_directory

git --git-dir=$REPO fetch --all # get all branches into your repo
cd $WORK
for B in master Branch-0_91; do
rm -rf $B
git --git-dir=$REPO archive $B --prefix=$B/ | tar xf -
# put your stuff here
...
done

I would also suggest a "set -e" command to stop on every error (from
the "Paranoid shell scripts" guide :) But perhaps even on the good
one)

> 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.
>

In this case you have to fetch in order to be sure updating a version
from server

> 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?
>

Mmmm... why they have to be modified?? I don't remember.

Frediano




Archive powered by MHonArc 2.6.24.

Top of Page