From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id B42CC431FBD for ; Sat, 8 Mar 2014 04:43:40 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gv0-hjyu7YvC for ; Sat, 8 Mar 2014 04:43:33 -0800 (PST) Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 61152431FB6 for ; Sat, 8 Mar 2014 04:43:33 -0800 (PST) Received: from remotemail by yantan.tethera.net with local (Exim 4.80) (envelope-from ) id 1WMGbC-0003DJ-Kt; Sat, 08 Mar 2014 08:43:30 -0400 Received: (nullmailer pid 20837 invoked by uid 1000); Sat, 08 Mar 2014 12:43:26 -0000 From: David Bremner To: "W. Trevor King" , notmuch@notmuchmail.org Subject: Re: [PATCH] nmbug: Add 'clone' and replace FETCH_HEAD with @{upstream} In-Reply-To: <80db13662a0313711ca3a91e338a63d35e64a83c.1391898002.git.wking@tremily.us> References: <80db13662a0313711ca3a91e338a63d35e64a83c.1391898002.git.wking@tremily.us> User-Agent: Notmuch/0.17+106~g0421995 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Sat, 08 Mar 2014 08:43:26 -0400 Message-ID: <87siqsrhch.fsf@zancas.localnet> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Mar 2014 12:43:40 -0000 "W. Trevor King" writes: > +sub do_clone { > + my $repository = shift; > + system ('git', 'clone', '--bare', $repository, $NMBGIT) == 0 > + or die "'git clone' exited with nonzero value\n"; > + my $branch = git ('symbolic-ref', 'HEAD'); > + $branch =~ s|^refs/heads/||; > + git ('config', 'remote.origin.fetch', '+refs/heads/*:refs/remotes/origin/*'); > + git ('config', "branch.$branch.remote", 'origin'); > + git ('config', "branch.$branch.merge", 'refs/heads/$branch'); > + do_fetch(); > +} I think doing a fetch immediately after a clone deserves a comment. > > @@ -473,7 +487,7 @@ sub diff_index { > sub diff_refs { > my $filter = shift; > my $ref1 = shift || 'HEAD'; > - my $ref2 = shift || 'FETCH_HEAD'; > + my $ref2 = shift || '@{upstream}'; I wonder about hard-coding '@{upstream}' in several places. What do you think about a global "constant"? OF course it was hard-coded FETCH_HEAD before, but I think not in quite as many places.