summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoeRayhawk <JoeRayhawk@web>2011-04-23 17:54:06 -0400
committerJoey Hess <joey@kitenet.net>2011-04-23 17:54:06 -0400
commita8e3040d0aa6c717bec072bff9cd80223e399a0c (patch)
tree893882c20aced1b5c4a96e0f45bfcff8746e3398
parent1227505b70ab36f8027ee3a182797d1be845191c (diff)
todo: Curse of the headless git [PATCH]
-rw-r--r--doc/todo/headless_git_branches.mdwn56
1 files changed, 56 insertions, 0 deletions
diff --git a/doc/todo/headless_git_branches.mdwn b/doc/todo/headless_git_branches.mdwn
new file mode 100644
index 000000000..8a1e68201
--- /dev/null
+++ b/doc/todo/headless_git_branches.mdwn
@@ -0,0 +1,56 @@
+Ikiwiki should really survive being asked to work with a git branch that has no existing commits.
+
+ mkdir iki-gittest
+ cd iki-gittest
+ GIT_DIR=barerepo.git git init
+ git clone barerepo.git srcdir
+ ikiwiki --rcs=git srcdir destdir
+
+I've fixed this initial construction case, and, based on my testing, I've also fixed the post-update executing on a new master, and ikiwiki.cgi executing on a non-existent master cases. Unfortunately these cases still generate a lot of warnings from recentchanges; I suspect a much more invasive patch would be needed to shut those up.
+
+Please commit so my users stop whining at me about having clean branches to push to, the big babies.
+
+Summary: Change three scary loud failure cases related to empty branches into three scary loud success cases.
+<pre>
+diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
+index cf7fbe9..5b1e334 100644
+--- a/IkiWiki/Plugin/git.pm
++++ b/IkiWiki/Plugin/git.pm
+@@ -439,10 +439,13 @@ sub git_commit_info ($;$) {
+
+ my @opts;
+ push @opts, "--max-count=$num" if defined $num;
++ my @raw_lines;
+
+- 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;
+ while (my $parsed = parse_diff_tree(\@raw_lines)) {
+@@ -474,7 +477,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});
++ if (-e $config{srcdir} . '/.git/refs/remotes/' . $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 (@) {
+ # 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}) {
+- run_or_cry('git', 'push', $config{gitorigin_branch});
++ run_or_cry('git', 'push', $config{gitorigin_branch}, $config{gitmaster_branch});
+ }
+ }
+</pre>