After discussion with some people on the git mailing list, I've revised
the patch. Attached.
Discussion thread is here for anyone interested:
http://kerneltrap.org/mailarchive/git/2008/9/6/3209094
--
Eric Gerlach, Network Administrator
Federation of Students
University of Waterloo
p: (519) 888-4567 x36329
e: [EMAIL PROTECTED]
--- /usr/bin/debcommit.old 2008-07-26 17:19:54.000000000 -0400
+++ /usr/bin/debcommit 2008-09-05 19:55:43.000000000 -0400
@@ -580,11 +580,19 @@
} 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 @test_empty_git_cmd = ('git', 'rev-parse', '--verify',
'--quiet', '>/dev/null');
+ # Reutrn value of system will should be 1<<8 = 256
+ if (system(@test_empty_git_cmd) == 256) {
+ # 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') {