]> sipb.mit.edu Git - ikiwiki.git/commitdiff
patch: headless gits: replace bad wannabe plumbing with the real thing (now packed...
authorJoe Rayhawk <jrayhawk@omgwallhack.org>
Tue, 3 May 2011 07:43:55 +0000 (00:43 -0700)
committerJoe Rayhawk <jrayhawk@omgwallhack.org>
Tue, 3 May 2011 07:43:55 +0000 (00:43 -0700)
doc/todo/headless_git_branches.mdwn

index 280405730f27bc4be1cba0fded7b511c84aceec6..1dd8677655b2bc241c66c690e8e9f1ead87d541e 100644 (file)
@@ -16,28 +16,30 @@ Summary: Change three scary loud failure cases related to empty branches into th
 
 <pre>
 diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
 
 <pre>
 diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
-index cf7fbe9..a1b5ed3 100644
+index cf7fbe9..e5bafcf 100644
 --- a/IkiWiki/Plugin/git.pm
 +++ b/IkiWiki/Plugin/git.pm
 --- a/IkiWiki/Plugin/git.pm
 +++ b/IkiWiki/Plugin/git.pm
-@@ -439,17 +439,20 @@ sub git_commit_info ($;$) {
+@@ -439,17 +439,21 @@ sub git_commit_info ($;$) {
  
        my @opts;
        push @opts, "--max-count=$num" if defined $num;
  
        my @opts;
        push @opts, "--max-count=$num" if defined $num;
-+      my @raw_lines;
-+      my @ci;
+-
 -      my @raw_lines = run_or_die('git', 'log', @opts,
 -              '--pretty=raw', '--raw', '--abbrev=40', '--always', '-c',
 -              '-r', $sha1, '--', '.');
 -      my @raw_lines = run_or_die('git', 'log', @opts,
 -              '--pretty=raw', '--raw', '--abbrev=40', '--always', '-c',
 -              '-r', $sha1, '--', '.');
-+      if (-e $config{srcdir} . '/.git/refs/heads/' . $config{gitmaster_branch}) {
-+              @raw_lines = run_or_die('git', 'log', @opts,
-+                      '--pretty=raw', '--raw', '--abbrev=40', '--always', '-c',
-+                      '-r', $sha1, '--', '.');
--      my @ci;
+-
++      my @raw_lines;
+       my @ci;
 -      while (my $parsed = parse_diff_tree(\@raw_lines)) {
 -              push @ci, $parsed;
 -      }
 -      while (my $parsed = parse_diff_tree(\@raw_lines)) {
 -              push @ci, $parsed;
 -      }
++        
++      # Test to see if branch actually exists yet.
++      if (run_or_non('git', 'show-ref', '--quiet', '--verify', '--', 'refs/heads/' . $config{gitmaster_branch}) ) {
++              @raw_lines = run_or_die('git', 'log', @opts,
++                      '--pretty=raw', '--raw', '--abbrev=40', '--always', '-c',
++                      '-r', $sha1, '--', '.');
++
 +              while (my $parsed = parse_diff_tree(\@raw_lines)) {
 +                      push @ci, $parsed;
 +              }
 +              while (my $parsed = parse_diff_tree(\@raw_lines)) {
 +                      push @ci, $parsed;
 +              }
@@ -48,19 +50,19 @@ index cf7fbe9..a1b5ed3 100644
  
        return wantarray ? @ci : $ci[0];
  }
  
        return wantarray ? @ci : $ci[0];
  }
-@@ -474,7 +477,10 @@ sub rcs_update () {
+@@ -474,7 +478,10 @@ sub rcs_update () {
        # Update working directory.
  
        if (length $config{gitorigin_branch}) {
 -              run_or_cry('git', 'pull', '--prune', $config{gitorigin_branch});
 +              run_or_cry('git', 'fetch', '--prune', $config{gitorigin_branch});
        # Update working directory.
  
        if (length $config{gitorigin_branch}) {
 -              run_or_cry('git', 'pull', '--prune', $config{gitorigin_branch});
 +              run_or_cry('git', 'fetch', '--prune', $config{gitorigin_branch});
-+              if (-e $config{srcdir} . '/.git/refs/remotes/' . $config{gitorigin_branch} . '/' . $config{gitmaster_branch}) {
++              if (run_or_non('git', 'show-ref', '--quiet', '--verify', '--', 'refs/remotes/' . $config{gitorigin_branch} . '/' . $config{gitmaster_branch}) ) {
 +                      run_or_cry('git', 'merge', $config{gitorigin_branch} . '/' . $config{gitmaster_branch});
 +              }
        }
  }
  
 +                      run_or_cry('git', 'merge', $config{gitorigin_branch} . '/' . $config{gitmaster_branch});
 +              }
        }
  }
  
-@@ -559,7 +565,7 @@ sub rcs_commit_helper (@) {
+@@ -559,7 +566,7 @@ sub rcs_commit_helper (@) {
        # So we should ignore its exit status (hence run_or_non).
        if (run_or_non('git', 'commit', '-m', $params{message}, '-q', @opts)) {
                if (length $config{gitorigin_branch}) {
        # So we should ignore its exit status (hence run_or_non).
        if (run_or_non('git', 'commit', '-m', $params{message}, '-q', @opts)) {
                if (length $config{gitorigin_branch}) {