From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org
Cc: felipe.contreras@gmail.com, Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [RFC/PATCH] git-remote-mediawiki: reset private ref after non-dumb push
Date: Tue, 13 Aug 2013 15:31:40 +0200 [thread overview]
Message-ID: <1376400700-8863-1-git-send-email-Matthieu.Moy@imag.fr> (raw)
Git-mediawiki's "dumb push" sends the local revisions to the remote wiki,
but does not update the local metadata to reflect the push (hence, the
next pull will have to re-import the exported revisions).
The previous implementation was simply omitting the update to the private
ref after a dumb push. This was broken by 664059fb62 (Felipe Contreras,
Apr 17 2013, transport-helper: update remote helper namespace), which
does an automatic update of the private ref (not just the
remote-tracking) on push.
This patch fixes git-remote-mediawiki to reset the private ref after the
push is completed, cancelling the automatic update triggered by
664059fb62.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
Felipe: Is this the right fix for git-remote-mediawiki? Any better idea?
Thanks,
contrib/mw-to-git/git-remote-mediawiki.perl | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index f8d7d2c..13919ad 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -53,6 +53,7 @@ if (@ARGV != 2) {
my $remotename = $ARGV[0];
my $url = $ARGV[1];
+my $reset_private_ref_to = undef;
# Accept both space-separated and multiple keys in config file.
# Spaces should be written as _ anyway because we'll use chomp.
@@ -161,6 +162,9 @@ sub parse_command {
my ($line) = @_;
my @cmd = split(/ /, $line);
if (!defined $cmd[0]) {
+ if ($reset_private_ref_to) {
+ run_git("update-ref -m \"Git-MediaWiki non-dumb push\" refs/mediawiki/$remotename/master $reset_private_ref_to");
+ }
return 0;
}
if ($cmd[0] eq 'capabilities') {
@@ -1209,9 +1213,10 @@ sub mw_push_revision {
die("Unknown error from mw_push_file()\n");
}
}
- if (!$dumb_push) {
+ if ($dumb_push) {
+ $reset_private_ref_to = $remoteorigin_sha1;
+ } else {
run_git(qq(notes --ref=${remotename}/mediawiki add -f -m "mediawiki_revision: ${mw_revision}" ${sha1_commit}));
- run_git(qq(update-ref -m "Git-MediaWiki push" refs/mediawiki/${remotename}/master ${sha1_commit} ${sha1_child}));
}
}
--
1.8.2.1.349.ge888d28.dirty
next reply other threads:[~2013-08-13 13:31 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-13 13:31 Matthieu Moy [this message]
2013-08-21 19:48 ` [RFC/PATCH] git-remote-mediawiki: reset private ref after non-dumb push Felipe Contreras
2013-08-21 21:36 ` Matthieu Moy
2013-08-22 17:20 ` Felipe Contreras
2013-08-23 8:25 ` Matthieu Moy
2013-08-23 19:52 ` Felipe Contreras
2013-08-24 7:46 ` Matthieu Moy
2013-08-25 3:50 ` Junio C Hamano
2013-08-26 8:48 ` Matthieu Moy
2013-08-26 9:16 ` Matthieu Moy
2013-08-26 16:28 ` Felipe Contreras
2013-08-27 7:25 ` Matthieu Moy
2013-08-29 18:58 ` [PATCH 1/4] git-remote-mediawiki: add test and check Makefile targets Matthieu Moy
2013-08-29 18:58 ` [PATCH 2/4] transport-helper: add dont-update-private capability Matthieu Moy
2013-08-29 19:14 ` Felipe Contreras
2013-09-02 7:19 ` [PATCH v2 1/4] git-remote-mediawiki: add test and check Makefile targets Matthieu Moy
2013-09-02 7:19 ` [PATCH v2 2/4] transport-helper: add no-private-update capability Matthieu Moy
2013-09-02 7:28 ` Felipe Contreras
2013-09-02 7:41 ` [PATCH v3 2/4] transport-helper: add dont-update-private capability Matthieu Moy
2013-09-03 15:45 ` [PATCH v4 2/4] transport-helper: add no-private-update capability Matthieu Moy
2013-09-02 7:19 ` [PATCH v2 3/4] git-remote-mediawiki: use no-private-update capability on dumb push Matthieu Moy
2013-09-02 7:19 ` [PATCH v2 4/4] git-remote-mediawiki: no need to update private ref in non-dumb push Matthieu Moy
2013-08-29 18:58 ` [PATCH 3/4] git-remote-mediawiki: use dont-update-private capability on dumb push Matthieu Moy
2013-08-29 19:08 ` Junio C Hamano
2013-08-29 18:58 ` [PATCH 4/4] git-remote-mediawiki: no need to update private ref in non-dumb push Matthieu Moy
2013-08-29 19:09 ` Junio C Hamano
2013-08-26 16:26 ` [RFC/PATCH] git-remote-mediawiki: reset private ref after " Junio C Hamano
2013-08-27 7:28 ` Matthieu Moy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1376400700-8863-1-git-send-email-Matthieu.Moy@imag.fr \
--to=matthieu.moy@imag.fr \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).