Admission: That second patch was horribly broken.
I've attached a third patch, this one actually works on git repositories
*with* commits too.
--
Eric Gerlach, Network Administrator
Federation of Students
University of Waterloo
p: (519) 888-4567 x36329
e: [EMAIL PROTECTED]
--- /usr/bin/debcommit.orig 2008-09-10 18:38:30.000000000 -0400
+++ /usr/bin/debcommit 2008-09-17 18:21:40.000000000 -0400
@@ -585,11 +585,20 @@
} elsif ($prog eq 'bzr') {
@diffcmd = ($prog, 'diff', '--diff-options', '-wu');
} elsif ($prog eq 'git') {
- if ($all) {
- @diffcmd = ('git', 'diff', '-w', '--no-color');
- } else {
- @diffcmd = ('git', 'diff', '-w', '--cached', '--no-color');
- }
+ # Test to see if there is a valid head in this tree
+ my $git_head = qx{git rev-parse --verify --quiet HEAD};
+ # If there is a head, the above command returs a sha1 hash. If
+ # not, it returns nothing. So, we'll use 10 characters as the test
+ if (length($git_head) < 10) {
+ # No valid head! Rather than fail, cheat and use 'diff'
+ @diffcmd = ('diff', '-u', '/dev/null');
+ } else {
+ if ($all) {
+ @diffcmd = ('git', 'diff', '-w', '--no-color');
+ } else {
+ @diffcmd = ('git', 'diff', '-w', '--cached', '--no-color');
+ }
+ }
} elsif ($prog eq 'svn') {
@diffcmd = ($prog, 'diff', '--diff-cmd', '/usr/bin/diff',
'--extensions', '-wu');
} elsif ($prog eq 'svk') {