James Bowes has a super simple git-rebase explanation: git rebase: keeping your branches current.

If you have any difficulty understanding the concept, or want an easy way to explain to someone, go ahead.

I’m just starting to use git-svn and git-rebase, and the combination rocks.

Git status exit status ?

March 14th, 2008

1
2
3
4
5
$ git status
# On branch master
nothing to commit (working directory clean)
$ echo $?
1

Shouldn’t a successful git status in a git repository return a status code of 0 ? Doing it in a random folder returns a sensible value:

1
2
3
4
5
$ git status
fatal: Not a git repository
Failed to find a valid git directory.
$ echo $?
128

Can anybody shed some light on this ?

I found Possible bug in ‘git status’ exit code is 1 instead of 0. What is the rational for this ? It goes against everything Unix ?!?

Well, I just got the answer I needed: how to clone just the tip of a remote Git repository ? Here’s how:

Sometimes you just want to distribute the source code without its history, and that’s where git-archive comes in.

git archive <tree-ish> > my_new_archive.tar

Kate Rhodes in Getting just the tip of a Git repo

I think I might use this in Piston. I’m not too sure yet, as I haven’t implemented piston-git, but it looks like a promising candidate.

Piston will get Git support

March 6th, 2008

Now that I’ve had a good change to play with Git, I’m ready to implement Git support in Piston. This will involve a couple of refactorings. I can see 4 cases currently:

Repository Working Copy Strategy
Subversion Subversion Use current strategy of storing data in Subversion properties
Subversion Git Clone the Git repository, copy the files over and store the metadata as Subversion properties. Use Git to handle the merging for Piston (Yay!)
Git Subversion svn export the data and use a hidden YAML file to store the metadata in the pistonized directory
Git Git Use Git submodules perhaps ? Or git clone + copy + YAML

I have no idea how git submodules work, so I can’t really say that I will be handling that last case in the most efficient manner. I’m planning on having completed this work by the end of next week (March 14th). Stay tuned for details !

My friend, Carl Mercier, unveiled Defensio in November 2007. At the time, I had repeatedly told Carl I would write a plugin for Mephisto to integrate with Defensio. Then, in December 2007, TheWebFellas released a plugin that integrated Mephisto and Defensio.

I installed the plugin, but it didn’t work out for me. And then, I had other stuff to do (like nobody does, duh). And now, a couple of months later, I am just learning about Git, and how Git empowers people to make wholesale changes to an application, and still be able to exchange that code with everyone.

I was on the #github channel on Friday night, having some problems creating a new repository. Comes alongs halorgium telling me “why didn’t you name your repository Mephiso ?” Good question. And I asked him if Rick Olson (techno-weenie) had a public Git repository for Mephisto. Halorgium replied with Rick’s repository URL, and told me that it was down at the moment. But, he had a recent clone, which he pushed to GitHub. I then simply forked his repository, and started coding like mad.

It’s now 4 days later, and I am releasing a refactored Mephisto. Instead of being intimately tied to Akismet, or Defensio for that matter, this version of Mephisto uses the Strategy and Adapter design patterns to enable any spam detection engine to connect to Mephisto.

I don’t know Rick personally, nor do I know Mark Dagget, but if they wish, they can now pull from my repository, and the whole Mephisto community will have a much better Mephisto available to them all.

So:

  • If halorgium hadn’t been on #github on Friday, I wouldn’t have known about Rick’s Mephisto repository;
  • If halorgium hadn’t had a clone, I wouldn’t have started then;
  • If I hadn’t been using Git, I wouldn’t have attempted this (too many changes in too many places for Subversion);

Git empowered me to make big changes to a foreign code base. I’m not afraid of losing any of my changes, and anyone can pull from my repository. This is a completely different working model than Subversion.

If you wish to play with this Mephisto version, you can pull from my public clone URL: git://github.com/francois/mephisto.git

Update 2008-03-03: After discussion with Halorgium on #github, I have pushed a multiengine branch. Use that instead of my master, which has been reset.

1
2
3
4
5
git clone git://github.com/francois/mephisto.git mephisto_defensio
cd mephisto_defensio
git checkout multiengine
rake db:bootstrap db:migrate
thin start

If you already have a clone of Mephisto’s repository from someone else, add mine as a remote:

1
2
3
4
5
6
7
cd mephisto
git remote add francois git://github.com/francois/mephisto.git
git fetch francois
git branch --track multiengine francois/multiengine
git checkout multiengine
rake db:migrate
thin start

In case you want to look at the code first, you can browse the GitHub repository using http://github.com/francois/mephisto/tree/multiengine

I suggest starting with Mephisto::SpamDetectionEngine::Base, and exploring from there.

Piston is now on Gitorious

February 5th, 2008

Well, after reading many interesting articles on Git, I moved Piston’s repository to Gitorious. Clone, fix and extend at will. I will maintain the existing Subversion repository and do releases when fixes come in. I will not maintain Piston itself in any significant ways though.

So, for those of you that expressed an interest in maintaining Piston, go ahead ! Get Git, get coding and publish your repository so I can pull from it.

Piston on Gitorious is available at http://gitorious.org/projects/piston. The mainline (or trunk in Subversion terms) is available as http://gitorious.org/projects/piston/repos/mainline

Directory renames under Git

January 16th, 2008

Hmmm, I know Subversion doesn’t do it any better, but I was led to believe Git tracked directory renames. At least, it didn’t behave as I expected. Here’s a reproduction recipe:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# This is repro.sh -- use at your own risks
rm -rf recipe > /dev/null
mkdir recipe
cd recipe
git init
mkdir lib
echo "v1" > lib/main.rb
git add lib/
git commit -m "initial version"
git checkout -b perf
echo "v2" >> lib/main.rb
git commit --all -m "perf improvements"
echo "v1" > lib/helper.rb
git add lib/helper.rb
git commit -m "new file"
git checkout master
git mv lib lib0
git commit -m "renamed"
git checkout perf
git merge master
find | grep -v .git
$ . repro.sh 
/home/francois/src/recipe
Initialized empty Git repository in .git/
Created initial commit a50ea59: initial version
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 lib/main.rb
Switched to a new branch "perf" 
Created commit 73d3379: perf improvements
 1 files changed, 1 insertions(+), 0 deletions(-)
Created commit 01c0e0e: new file
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 lib/helper.rb
Switched to branch "master" 
Created commit 66ac898: renamed
 2 files changed, 1 insertions(+), 1 deletions(-)
 delete mode 100644 lib/main.rb
 create mode 100644 lib0/main.rb
Switched to branch "perf" 
Merge made by recursive.
 {lib => lib0}/main.rb |    0 
 1 files changed, 0 insertions(+), 0 deletions(-)
 rename {lib => lib0}/main.rb (100%)
.
./lib
./lib/helper.rb
./lib0
./lib0/main.rb

In prose, here’s what I did:

  • Initial development was in lib/main.rb
  • Then, I branched master to create a perf branch
  • On the perf branch, I added lib/helper.rb, and modified lib/main.rb
  • Back on master, I renamed lib/ to lib0/
  • Back on perf, I merged from master

What I expected to see is a move of lib/helper.rb and lib/main.rb to lib0/. Oh well, I don’t rename directories that often anyway. It’s more of a caveat than anything else.

An alternative to gitk: qgit

January 16th, 2008

At Montreal on Rails this evening, Jean-François Couture presented Git. I installed it on my Ubuntu Desktop machine, and I found that gitk was horrible to look at. Even after following Jean-François’ Various Tips For Setting Up Git: Improve Gitk Look And Get Bash Completion, gitk wasn’t really up to snuff with the rest of my UI.

On the Git home page, I found a reference to qgit, a much nicer looking application. Install and see for yourself.

 

Search

A picture of me

I am François Beausoleil, a Ruby on Rails coder. During the day, I work on XLsuite. At night, I am interested many things. Read my biography

Tags

(3) (1) (0) (2) (1) (1) (2) (2) (1) (2) (1) (2) (1) (2) (1) (1) (1) (1) (2) (14) (1) (1) (1) (1) (2) (1) (1) (2) (0) (1) (2) (1) (3) (1) (1) (1) (1) (1) (1) (0) (3) (2) (1) (2) (2) (1) (3) (2) (8) (8) (9) (12) (1) (1) (3) (1) (1) (1) (1) (1) (1) (2) (2) (2) (1) (1) (3) (1) (3) (1) (0) (23) (1) (1) (0) (1) (1) (1) (23) (25) (1) (1) (13) (1) (1) (2) (3) (1) (1) (4) (1) (2) (3) (0) (1) (7) (3) (1) (5) (5) (2) (2) (2) (4) (6) (7) (1) (0) (1) (1) (2) (2) (1) (4) (12) (2) (1) (2) (4) (1) (1) (1) (2) (8) (2) (3) (2) (2) (1) (3) (1) (1)

Links

Projects I work on

Categories

Archives