From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id YMDJM8EBZGKBQAEAbAwnHQ (envelope-from ) for ; Sat, 23 Apr 2022 15:40:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id uGWzM8EBZGJizwAA9RJhRA (envelope-from ) for ; Sat, 23 Apr 2022 15:40:17 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7BE951500A for ; Sat, 23 Apr 2022 15:40:17 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 015CF5F79D; Sat, 23 Apr 2022 13:39:22 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 8D5785F782 for ; Sat, 23 Apr 2022 13:39:18 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 0AEDE5FC3F; Sat, 23 Apr 2022 09:39:17 -0400 (EDT) Received: (nullmailer pid 3856542 invoked by uid 1000); Sat, 23 Apr 2022 13:38:57 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 02/16] notmuch-git: add --git-dir argument Date: Sat, 23 Apr 2022 10:38:34 -0300 Message-Id: <20220423133848.3852688-3-david@tethera.net> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220423133848.3852688-1-david@tethera.net> References: <20220423133848.3852688-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: G2VB4YVHFEVBUDWY6BKVTVETL6D44EHL X-Message-ID-Hash: G2VB4YVHFEVBUDWY6BKVTVETL6D44EHL X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650721217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=KfMtCAorAitmsbdvsXFGfZ7KEVoHYi2283AAiEdRFGU=; b=dw2ZscqJ7RR51SI25TwkZ1J/DZURminv+ykTiOZzTeXZIAK1ug9xtf/JzzVxpwXxu33sj2 Mt8GC31yqBAp2cSAIzia7ET9B4wUbWqJfq303iyicIsdseuHIig/qMQy4WAMIptDCVfLLG 02a9G9F/p663Cxx3f4DWs7gb+Ugogtt5Yri+2aMJBVRcuPr650eGaAyfhD2J8nVeCx5c9r 04pNJBS9zwaY20/2fWYhEr2K/kvX9tN4OyyR6XeQzbQJbgDMwZTBYeV07jGRI3gm7GksSv 2x4sIfqEfsBf4YYeRdRtKpY/VQL6Kggy+YOXxYNopPUYlc1ul6wjlQUkTHb30g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650721217; a=rsa-sha256; cv=none; b=n4LNqPUkSwfp5fHxgvcAiRmoGmepir6k7A4m0ETWIv0IOafC9GyPiJAPCZw1gWJgS1dVZ1 CagK/LRVkuVIkPcCgiSmRGKRUtCKp0D460vatnMFAqcnWTvgUayvzpoY3JmOd7j07IDptq OUXZDF332BXDshjRY0gMOn5nA0RahqcrQNlDGcs73dFJ4w7COojlZe5EtkouyyBpMBCa/8 zlHrZP2EH8wfot7G+w4qsgWUQKaa8chpYGzmoavO3dtvTw3KKnChbDrSewFOckZAcQmhwl j0F3qF9Hul6tnkHj9rdxBcG9PVr+8MEx9w4V51H+3LrYqfn4aZfM7lEHPjzhig== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.77 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 7BE951500A X-Spam-Score: -0.77 X-Migadu-Scanner: scn1.migadu.com X-TUID: 4dKgSXrXQ7pS The intent is to change the names of the environment variables before releasing this code, so avoid relying on environment variables in the test framework. --- notmuch-git.in | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/notmuch-git.in b/notmuch-git.in index dd30b5be..62889303 100755 --- a/notmuch-git.in +++ b/notmuch-git.in @@ -57,11 +57,7 @@ _LOG = _logging.getLogger('nmbug') _LOG.setLevel(_logging.WARNING) _LOG.addHandler(_logging.StreamHandler()) -NMBGIT = _os.path.expanduser( - _os.getenv('NMBGIT', _os.path.join('~', '.nmbug'))) -_NMBGIT = _os.path.join(NMBGIT, '.git') -if _os.path.isdir(_NMBGIT): - NMBGIT = _NMBGIT +NMBGIT = None TAG_PREFIX = _os.getenv('NMBPREFIX', 'notmuch::') _HEX_ESCAPE_REGEX = _re.compile('%[0-9A-F]{2}') @@ -718,6 +714,9 @@ if __name__ == '__main__': parser = argparse.ArgumentParser( description=__doc__.strip(), formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument( + '-C', '--git-dir', metavar='REPO', + help='Git repository to operate on.') parser.add_argument( '-v', '--version', action='version', version='%(prog)s {}'.format(__version__)) @@ -830,6 +829,15 @@ if __name__ == '__main__': args = parser.parse_args() + if args.git_dir: + NMBGIT = args.git_dir + else: + NMBGIT = _os.path.expanduser( + _os.getenv('NMBGIT', _os.path.join('~', '.nmbug'))) + _NMBGIT = _os.path.join(NMBGIT, '.git') + if _os.path.isdir(_NMBGIT): + NMBGIT = _NMBGIT + if args.log_level: level = getattr(_logging, args.log_level.upper()) _LOG.setLevel(level) -- 2.35.2