pgr0ss / rake_commit

A program that helps with checking in code. It automates common git or svn commands.
13 stars 13 forks source link

cannot rake_commit on initial commit #3

Open phinze opened 13 years ago

phinze commented 13 years ago

trying to rc a first commit of a new repo yields this error:

gems/rake_commit-0.11.0/lib/shell.rb:11:in `backtick': Command failed: "git merge-base master origin/master"
pgr0ss commented 13 years ago

If there are no commits, then the squash fails because rc cannot find a previous commit from origin. I'm not sure how to handle this in an elegant way considering it will only happen once on new repos.

phinze commented 13 years ago

this will yield 0 on a new repo, and > 1 if there are commits:

git count-objects | awk '{print $1}'

it's existed in git since 2006 - so should be pretty reliably available

https://github.com/gitster/git/blob/c74320872b445104fe5c265e60785d9d26d94cc5/builtin-count.c