From: David Edmondson Date: Mon, 15 Sep 2014 16:13:50 +0000 (+0100) Subject: Re: [PATCH 4/4] nmbug: Add an 'init' command X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=94f3641336146c0078abb29feac9ee2cd7303d45;p=notmuch-archives.git Re: [PATCH 4/4] nmbug: Add an 'init' command --- diff --git a/4f/ba542c17076e8fe4733e07aa2657b1f09149a0 b/4f/ba542c17076e8fe4733e07aa2657b1f09149a0 new file mode 100644 index 000000000..62aeac150 --- /dev/null +++ b/4f/ba542c17076e8fe4733e07aa2657b1f09149a0 @@ -0,0 +1,135 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 09A90431FBC + for ; Mon, 15 Sep 2014 09:14:05 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 93NJNUrzEy-7 for ; + Mon, 15 Sep 2014 09:14:00 -0700 (PDT) +Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com + [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 17B6E431FAE + for ; Mon, 15 Sep 2014 09:13:59 -0700 (PDT) +Received: by mail-wi0-f173.google.com with SMTP id em10so4562877wid.6 + for ; Mon, 15 Sep 2014 09:13:56 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:to:cc:subject:in-reply-to:references:user-agent + :from:date:message-id:mime-version:content-type; + bh=lrKsq60AuHwUP2nf8KsYyzBZPIbtAmEx1MyZZxr4YCo=; + b=H9te+FLeOSJ2ovGFd3r1/oRwzl1gurjHuE+doxJt0oNkb3O51IVYbPIcJyrBPUg0WR + VyP8jdazdgfsSrSLZib8ynVRNeZKRxfD8sy65vvX3wp0MmizWAnkq+cr997fPzFQdKVP + fa7shlHnaIW3gmMKY3GnJpZ66Yik4rQ5XOSoLEqRTERwxHHYjJ86vXTkCcxirEZ/IdTh + NkIko0J7JWMWUXdXQSQ32ZdAXYkfkKBEXVuvAbAhqvDitiQa2nREReebs0QHgePV+Vap + PtgCLl50gFKQln4ZrKt/D+roHaps8UbRwq2jIAzF0zFjMRIuRRpCs40MRODet7P8NM3Z + Rdww== +X-Gm-Message-State: + ALoCoQnv0r4VNagy5ulr3La7ZiYlmMU5akXT5TPWKnUkiqXG/6vJiuqFV/JxcHygQI8C6ui0iHVY +X-Received: by 10.194.186.178 with SMTP id fl18mr34632411wjc.8.1410797634993; + Mon, 15 Sep 2014 09:13:54 -0700 (PDT) +Received: from localhost ([2a01:348:1a2:1:f00a:9c2f:b998:3319]) + by mx.google.com with ESMTPSA id + hi4sm15253016wjb.46.2014.09.15.09.13.54 for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 15 Sep 2014 09:13:54 -0700 (PDT) +To: "W. Trevor King" , notmuch@notmuchmail.org +Subject: Re: [PATCH 4/4] nmbug: Add an 'init' command +In-Reply-To: + <05ccd672f55444f74da62250e2305fb84fdc6c42.1404678709.git.wking@tremily.us> +References: + <05ccd672f55444f74da62250e2305fb84fdc6c42.1404678709.git.wking@tremily.us> +User-Agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-apple-darwin) +From: David Edmondson +Date: Mon, 15 Sep 2014 17:13:50 +0100 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain +Cc: David Bremner +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: Mon, 15 Sep 2014 16:14:05 -0000 + +On Sun, Jul 06 2014, W. Trevor King wrote: +> For folks that want to start versioning a new tag-space, instead of +> cloning one that someone else has already started. + +I tried this patch, and it (appeared) to work for me. Given that the +procedure for creating a new tag repository is arcane, could this patch +(or a version of it) be pushed? + +> The empty-blob hash-object call avoids errors like: +> +> $ nmbug commit +> error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for 'tags/...' +> fatal: git-write-tree: error building trees +> 'git HASH(0x9ef3eb8) write-tree' exited with nonzero value +> --- +> devel/nmbug/nmbug | 19 +++++++++++++++++++ +> 1 file changed, 19 insertions(+) +> +> diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug +> index c9ac046..b64dab9 100755 +> --- a/devel/nmbug/nmbug +> +++ b/devel/nmbug/nmbug +> @@ -30,6 +30,7 @@ my %command = ( +> commit => \&do_commit, +> fetch => \&do_fetch, +> help => \&do_help, +> + init => \&do_init, +> log => \&do_log, +> merge => \&do_merge, +> pull => \&do_pull, +> @@ -152,6 +153,18 @@ sub do_clone { +> git ('config', 'core.bare', 'true'); +> } +> +> +sub do_init { +> + my $tempwork = tempdir ('/tmp/nmbug-init.XXXXXX', CLEANUP => 1); +> + system ('git', 'init', '--separate-git-dir', $NMBGIT, $tempwork) == 0 +> + or die "'git init' exited with nonzero value\n"; +> + git ('config', '--unset', 'core.worktree'); +> + git ('config', 'core.bare', 'true'); +> + # create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391) +> + git ('hash-object', '-w', '--stdin'); +> + git ( { GIT_WORK_TREE => $tempwork }, 'commit', '--allow-empty', +> + '-m', 'Start a new nmbug repository' ); +> +} +> + +> sub is_committed { +> my $status = shift; +> return scalar (@{$status->{added}} ) + scalar (@{$status->{deleted}} ) == 0; +> @@ -610,6 +623,12 @@ Create a local nmbug repository from a remote source. This wraps +> C, adding some options to avoid creating a working tree +> while preserving remote-tracking branches and upstreams. +> +> +=item B +> + +> +Create a local nmbug repository from scratch. This wraps C +> +and performs other setup to support subsequent status and commit +> +commands. +> + +> =item B +> +> Update the notmuch database from git. This is mainly useful to discard +> -- +> 1.9.1.353.gc66d89d