mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
CLI/git: change defaults for repo and prefix
The previous defaults were not suitable for personal (i.e. not bugtracking for notmuch development) use. Provide two ways for the user to select nmbug compatible defaults; command line argument and checking the name of the script.
This commit is contained in:
parent
e50a413906
commit
8ed68c1bbe
5 changed files with 162 additions and 31 deletions
|
@ -1,7 +1,7 @@
|
||||||
# -*- makefile-gmake -*-
|
# -*- makefile-gmake -*-
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: notmuch notmuch-shared build-man build-info ruby-bindings python-cffi-bindings notmuch-git
|
all: notmuch notmuch-shared build-man build-info ruby-bindings python-cffi-bindings notmuch-git nmbug
|
||||||
ifeq ($(MAKECMDGOALS),)
|
ifeq ($(MAKECMDGOALS),)
|
||||||
ifeq ($(shell cat .first-build-message 2>/dev/null),)
|
ifeq ($(shell cat .first-build-message 2>/dev/null),)
|
||||||
@NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
|
@NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
|
||||||
|
@ -50,6 +50,10 @@ notmuch-git: notmuch-git.py
|
||||||
cp $< $@
|
cp $< $@
|
||||||
chmod ugo+x $@
|
chmod ugo+x $@
|
||||||
|
|
||||||
|
CLEAN := $(CLEAN) nmbug
|
||||||
|
nmbug: notmuch-git
|
||||||
|
ln -s $< $@
|
||||||
|
|
||||||
.PHONY: dist
|
.PHONY: dist
|
||||||
dist: $(TAR_FILE)
|
dist: $(TAR_FILE)
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,7 @@ install-man: ${MAN_GZIP_FILES}
|
||||||
install -m0644 $(filter %.5.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man5
|
install -m0644 $(filter %.5.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man5
|
||||||
install -m0644 $(filter %.7.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man7
|
install -m0644 $(filter %.7.gz,$(MAN_GZIP_FILES)) $(DESTDIR)/$(mandir)/man7
|
||||||
cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
|
cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
|
||||||
|
cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch-git.1.gz nmbug.1.gz
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(HAVE_SPHINX)$(HAVE_MAKEINFO),11)
|
ifneq ($(HAVE_SPHINX)$(HAVE_MAKEINFO),11)
|
||||||
|
|
|
@ -7,7 +7,9 @@ notmuch-git
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
========
|
========
|
||||||
|
|
||||||
**notmuch** **git** [-h] [-C *repo*] [-p *prefix*] [-v] [-l *log level*] *subcommand*
|
**notmuch** **git** [-h] [-N] [-C *repo*] [-p *prefix*] [-v] [-l *log level*] *subcommand*
|
||||||
|
|
||||||
|
**nmbug** [-h] [-C *repo*] [-p *prefix*] [-v] [-l *log level*] *subcommand*
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
===========
|
===========
|
||||||
|
@ -25,12 +27,17 @@ Supported options for `notmuch git` include
|
||||||
|
|
||||||
show help message and exit
|
show help message and exit
|
||||||
|
|
||||||
|
.. option:: -N, --nmbug
|
||||||
|
|
||||||
|
Set defaults for :option:`--tag-prefix` and :option:`--git-dir` suitable for the
|
||||||
|
:any:`notmuch` bug tracker
|
||||||
|
|
||||||
.. option:: -C <repo>, --git-dir <repo>
|
.. option:: -C <repo>, --git-dir <repo>
|
||||||
|
|
||||||
Operate on git repository *repo*. See :ref:`repo_location` for
|
Operate on git repository *repo*. See :ref:`repo_location` for
|
||||||
defaults.
|
defaults.
|
||||||
|
|
||||||
.. option:: -p <prefix>, --tag-prefix <prefix>
|
.. option:: -p <prefix>, --tag-prefix <prefix>
|
||||||
|
|
||||||
Operate only on tags with prefix *prefix*. See :ref:`prefix_val` for
|
Operate only on tags with prefix *prefix*. See :ref:`prefix_val` for
|
||||||
defaults.
|
defaults.
|
||||||
|
@ -239,6 +246,10 @@ value to locate the git repository.
|
||||||
|
|
||||||
- Environment variable :envvar:`NOTMUCH_GIT_DIR`.
|
- Environment variable :envvar:`NOTMUCH_GIT_DIR`.
|
||||||
|
|
||||||
|
- If invoked as `nmbug` or with the :option:`--nmbug` option,
|
||||||
|
:code:`$HOME/.nmbug`; otherwise
|
||||||
|
:code:`$XDG_DATA_HOME/notmuch/$NOTMUCH_PROFILE/git`.
|
||||||
|
|
||||||
.. _prefix_val:
|
.. _prefix_val:
|
||||||
|
|
||||||
PREFIX VALUE
|
PREFIX VALUE
|
||||||
|
@ -251,9 +262,15 @@ value to define the tag prefix.
|
||||||
|
|
||||||
- Environment variable :envvar:`NOTMUCH_GIT_PREFIX`.
|
- Environment variable :envvar:`NOTMUCH_GIT_PREFIX`.
|
||||||
|
|
||||||
|
- If invoked as `nmbug` or with the :option:`--nmbug` option,
|
||||||
|
:code:`notmuch::`, otherwise the empty string.
|
||||||
|
|
||||||
ENVIRONMENT
|
ENVIRONMENT
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
Variable :envvar:`NOTMUCH_PROFILE` influences :ref:`repo_location`.
|
||||||
|
If it is unset, 'default' is assumed.
|
||||||
|
|
||||||
.. envvar:: NOTMUCH_GIT_DIR
|
.. envvar:: NOTMUCH_GIT_DIR
|
||||||
|
|
||||||
Default location of git repository. Overriden by :option:`--git-dir`.
|
Default location of git repository. Overriden by :option:`--git-dir`.
|
||||||
|
|
|
@ -425,6 +425,13 @@ def init(remote=None):
|
||||||
This wraps 'git init' with a few extra steps to support subsequent
|
This wraps 'git init' with a few extra steps to support subsequent
|
||||||
status and commit commands.
|
status and commit commands.
|
||||||
"""
|
"""
|
||||||
|
from pathlib import Path
|
||||||
|
parent = Path(NOTMUCH_GIT_DIR).parent
|
||||||
|
try:
|
||||||
|
_os.makedirs(parent)
|
||||||
|
except FileExistsError:
|
||||||
|
pass
|
||||||
|
|
||||||
_spawn(args=['git', '--git-dir', NOTMUCH_GIT_DIR, 'init',
|
_spawn(args=['git', '--git-dir', NOTMUCH_GIT_DIR, 'init',
|
||||||
'--initial-branch=master', '--quiet', '--bare'], wait=True)
|
'--initial-branch=master', '--quiet', '--bare'], wait=True)
|
||||||
_git(args=['config', 'core.logallrefupdates', 'true'], wait=True)
|
_git(args=['config', 'core.logallrefupdates', 'true'], wait=True)
|
||||||
|
@ -861,9 +868,19 @@ def _notmuch_config_get(key):
|
||||||
stdout=_subprocess.PIPE, wait=True)
|
stdout=_subprocess.PIPE, wait=True)
|
||||||
if status != 0:
|
if status != 0:
|
||||||
_LOG.error("failed to run notmuch config")
|
_LOG.error("failed to run notmuch config")
|
||||||
sys.exit(1)
|
_sys.exit(1)
|
||||||
return stdout.rstrip()
|
return stdout.rstrip()
|
||||||
|
|
||||||
|
# based on BaseDirectory.save_data_path from pyxdg (LGPL2+)
|
||||||
|
def xdg_data_path(profile):
|
||||||
|
resource = _os.path.join('notmuch',profile,'git')
|
||||||
|
assert not resource.startswith('/')
|
||||||
|
_home = _os.path.expanduser('~')
|
||||||
|
xdg_data_home = _os.environ.get('XDG_DATA_HOME') or \
|
||||||
|
_os.path.join(_home, '.local', 'share')
|
||||||
|
path = _os.path.join(xdg_data_home, resource)
|
||||||
|
return path
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
@ -875,8 +892,11 @@ if __name__ == '__main__':
|
||||||
help='Git repository to operate on.')
|
help='Git repository to operate on.')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-p', '--tag-prefix', metavar='PREFIX',
|
'-p', '--tag-prefix', metavar='PREFIX',
|
||||||
default = _os.getenv('NOTMUCH_GIT_PREFIX', 'notmuch::'),
|
default = None,
|
||||||
help='Prefix of tags to operate on.')
|
help='Prefix of tags to operate on.')
|
||||||
|
parser.add_argument(
|
||||||
|
'-N', '--nmbug', action='store_true',
|
||||||
|
help='Set defaults for --tag-prefix and --git-dir for the notmuch bug tracker')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-l', '--log-level',
|
'-l', '--log-level',
|
||||||
choices=['critical', 'error', 'warning', 'info', 'debug'],
|
choices=['critical', 'error', 'warning', 'info', 'debug'],
|
||||||
|
@ -987,16 +1007,36 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
nmbug_mode = False
|
||||||
|
notmuch_profile = _os.getenv('NOTMUCH_PROFILE','default')
|
||||||
|
|
||||||
|
if args.nmbug or _os.path.basename(__file__) == 'nmbug':
|
||||||
|
nmbug_mode = True
|
||||||
|
|
||||||
if args.git_dir:
|
if args.git_dir:
|
||||||
NOTMUCH_GIT_DIR = args.git_dir
|
NOTMUCH_GIT_DIR = args.git_dir
|
||||||
else:
|
else:
|
||||||
NOTMUCH_GIT_DIR = _os.path.expanduser(
|
if nmbug_mode:
|
||||||
_os.getenv('NOTMUCH_GIT_DIR', _os.path.join('~', '.nmbug')))
|
default = _os.path.join('~', '.nmbug')
|
||||||
_NOTMUCH_GIT_DIR = _os.path.join(NOTMUCH_GIT_DIR, '.git')
|
else:
|
||||||
if _os.path.isdir(_NOTMUCH_GIT_DIR):
|
default = xdg_data_path(notmuch_profile)
|
||||||
NOTMUCH_GIT_DIR = _NOTMUCH_GIT_DIR
|
|
||||||
|
NOTMUCH_GIT_DIR = _os.path.expanduser(_os.getenv('NOTMUCH_GIT_DIR', default))
|
||||||
|
|
||||||
|
_NOTMUCH_GIT_DIR = _os.path.join(NOTMUCH_GIT_DIR, '.git')
|
||||||
|
if _os.path.isdir(_NOTMUCH_GIT_DIR):
|
||||||
|
NOTMUCH_GIT_DIR = _NOTMUCH_GIT_DIR
|
||||||
|
|
||||||
|
if args.tag_prefix:
|
||||||
|
TAG_PREFIX = args.tag_prefix
|
||||||
|
else:
|
||||||
|
if nmbug_mode:
|
||||||
|
prefix = 'notmuch::'
|
||||||
|
else:
|
||||||
|
prefix = ''
|
||||||
|
|
||||||
|
TAG_PREFIX = _os.getenv('NOTMUCH_GIT_PREFIX', prefix)
|
||||||
|
|
||||||
TAG_PREFIX = args.tag_prefix
|
|
||||||
_ENCODED_TAG_PREFIX = _hex_quote(TAG_PREFIX, safe='+@=,') # quote ':'
|
_ENCODED_TAG_PREFIX = _hex_quote(TAG_PREFIX, safe='+@=,') # quote ':'
|
||||||
|
|
||||||
if args.log_level:
|
if args.log_level:
|
||||||
|
@ -1009,12 +1049,16 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
if _notmuch_config_get('built_with.sexp_queries') != 'true':
|
if _notmuch_config_get('built_with.sexp_queries') != 'true':
|
||||||
_LOG.error("notmuch git needs sexp query support")
|
_LOG.error("notmuch git needs sexp query support")
|
||||||
sys.exit(1)
|
_sys.exit(1)
|
||||||
|
|
||||||
if not getattr(args, 'func', None):
|
if not getattr(args, 'func', None):
|
||||||
parser.print_usage()
|
parser.print_usage()
|
||||||
_sys.exit(1)
|
_sys.exit(1)
|
||||||
|
|
||||||
|
# The following two lines are used by the test suite.
|
||||||
|
_LOG.debug('prefix = {:s}'.format(TAG_PREFIX))
|
||||||
|
_LOG.debug('repository = {:s}'.format(NOTMUCH_GIT_DIR))
|
||||||
|
|
||||||
if args.func == help:
|
if args.func == help:
|
||||||
arg_names = ['command']
|
arg_names = ['command']
|
||||||
else:
|
else:
|
||||||
|
|
103
test/T850-git.sh
103
test/T850-git.sh
|
@ -19,28 +19,28 @@ test_begin_subtest "clone"
|
||||||
test_expect_success "notmuch git -p '' -C tags.git clone remote.git"
|
test_expect_success "notmuch git -p '' -C tags.git clone remote.git"
|
||||||
|
|
||||||
test_begin_subtest "commit"
|
test_begin_subtest "commit"
|
||||||
notmuch git -C tags.git -p '' commit
|
notmuch git -C tags.git commit
|
||||||
git -C tags.git ls-tree -r --name-only HEAD | xargs dirname | sort -u | sed s,tags/,id:, > OUTPUT
|
git -C tags.git ls-tree -r --name-only HEAD | xargs dirname | sort -u | sed s,tags/,id:, > OUTPUT
|
||||||
notmuch search --output=messages '*' | sort > EXPECTED
|
notmuch search --output=messages '*' | sort > EXPECTED
|
||||||
test_expect_equal_file_nonempty EXPECTED OUTPUT
|
test_expect_equal_file_nonempty EXPECTED OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "commit, with quoted tag"
|
test_begin_subtest "commit, with quoted tag"
|
||||||
notmuch git -C clone2.git -p '' clone tags.git
|
notmuch git -C clone2.git clone tags.git
|
||||||
git -C clone2.git ls-tree -r --name-only HEAD | grep /inbox > BEFORE
|
git -C clone2.git ls-tree -r --name-only HEAD | grep /inbox > BEFORE
|
||||||
notmuch tag '+"quoted tag"' '*'
|
notmuch tag '+"quoted tag"' '*'
|
||||||
notmuch git -C clone2.git -p '' commit
|
notmuch git -C clone2.git commit
|
||||||
notmuch tag '-"quoted tag"' '*'
|
notmuch tag '-"quoted tag"' '*'
|
||||||
git -C clone2.git ls-tree -r --name-only HEAD | grep /inbox > AFTER
|
git -C clone2.git ls-tree -r --name-only HEAD | grep /inbox > AFTER
|
||||||
test_expect_equal_file_nonempty BEFORE AFTER
|
test_expect_equal_file_nonempty BEFORE AFTER
|
||||||
|
|
||||||
test_begin_subtest "commit (incremental)"
|
test_begin_subtest "commit (incremental)"
|
||||||
notmuch tag +test id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
notmuch tag +test id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
||||||
notmuch git -C tags.git -p '' commit
|
notmuch git -C tags.git commit
|
||||||
git -C tags.git ls-tree -r --name-only HEAD |
|
git -C tags.git ls-tree -r --name-only HEAD |
|
||||||
grep 20091117190054 | sort > OUTPUT
|
grep 20091117190054 | sort > OUTPUT
|
||||||
echo "--------------------------------------------------" >> OUTPUT
|
echo "--------------------------------------------------" >> OUTPUT
|
||||||
notmuch tag -test id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
notmuch tag -test id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
||||||
notmuch git -C tags.git -p '' commit
|
notmuch git -C tags.git commit
|
||||||
git -C tags.git ls-tree -r --name-only HEAD |
|
git -C tags.git ls-tree -r --name-only HEAD |
|
||||||
grep 20091117190054 | sort >> OUTPUT
|
grep 20091117190054 | sort >> OUTPUT
|
||||||
cat <<EOF > EXPECTED
|
cat <<EOF > EXPECTED
|
||||||
|
@ -62,7 +62,7 @@ git -C tags.git ls-tree -r --name-only HEAD |
|
||||||
grep 20091117190054 | sort > OUTPUT
|
grep 20091117190054 | sort > OUTPUT
|
||||||
echo "--------------------------------------------------" >> OUTPUT
|
echo "--------------------------------------------------" >> OUTPUT
|
||||||
notmuch tag -test::one id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
notmuch tag -test::one id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
||||||
notmuch git -C tags.git -p '' commit
|
notmuch git -C tags.git commit
|
||||||
git -C tags.git ls-tree -r --name-only HEAD |
|
git -C tags.git ls-tree -r --name-only HEAD |
|
||||||
grep 20091117190054 | sort >> OUTPUT
|
grep 20091117190054 | sort >> OUTPUT
|
||||||
cat <<EOF > EXPECTED
|
cat <<EOF > EXPECTED
|
||||||
|
@ -77,12 +77,12 @@ test_expect_equal_file_nonempty EXPECTED OUTPUT
|
||||||
test_begin_subtest "checkout"
|
test_begin_subtest "checkout"
|
||||||
notmuch dump > BEFORE
|
notmuch dump > BEFORE
|
||||||
notmuch tag -inbox '*'
|
notmuch tag -inbox '*'
|
||||||
notmuch git -C tags.git -p '' checkout
|
notmuch git -C tags.git checkout
|
||||||
notmuch dump > AFTER
|
notmuch dump > AFTER
|
||||||
test_expect_equal_file_nonempty BEFORE AFTER
|
test_expect_equal_file_nonempty BEFORE AFTER
|
||||||
|
|
||||||
test_begin_subtest "archive"
|
test_begin_subtest "archive"
|
||||||
notmuch git -C tags.git -p '' archive | tar tf - | \
|
notmuch git -C tags.git archive | tar tf - | \
|
||||||
grep 20091117190054.GU3165@dottiness.seas.harvard.edu | sort > OUTPUT
|
grep 20091117190054.GU3165@dottiness.seas.harvard.edu | sort > OUTPUT
|
||||||
cat <<EOF > EXPECTED
|
cat <<EOF > EXPECTED
|
||||||
tags/20091117190054.GU3165@dottiness.seas.harvard.edu/
|
tags/20091117190054.GU3165@dottiness.seas.harvard.edu/
|
||||||
|
@ -90,32 +90,32 @@ tags/20091117190054.GU3165@dottiness.seas.harvard.edu/inbox
|
||||||
tags/20091117190054.GU3165@dottiness.seas.harvard.edu/signed
|
tags/20091117190054.GU3165@dottiness.seas.harvard.edu/signed
|
||||||
tags/20091117190054.GU3165@dottiness.seas.harvard.edu/unread
|
tags/20091117190054.GU3165@dottiness.seas.harvard.edu/unread
|
||||||
EOF
|
EOF
|
||||||
notmuch git -C tags.git -p '' checkout
|
notmuch git -C tags.git checkout
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "status"
|
test_begin_subtest "status"
|
||||||
notmuch tag +test id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
notmuch tag +test id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
||||||
notmuch git -C tags.git -p '' status > OUTPUT
|
notmuch git -C tags.git status > OUTPUT
|
||||||
cat <<EOF > EXPECTED
|
cat <<EOF > EXPECTED
|
||||||
A 20091117190054.GU3165@dottiness.seas.harvard.edu test
|
A 20091117190054.GU3165@dottiness.seas.harvard.edu test
|
||||||
EOF
|
EOF
|
||||||
notmuch git -C tags.git -p '' checkout
|
notmuch git -C tags.git checkout
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "fetch"
|
test_begin_subtest "fetch"
|
||||||
notmuch tag +test2 id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
notmuch tag +test2 id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
||||||
notmuch git -C remote.git -p '' commit
|
notmuch git -C remote.git commit
|
||||||
notmuch tag -test2 id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
notmuch tag -test2 id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
||||||
notmuch git -C tags.git -p '' fetch
|
notmuch git -C tags.git fetch
|
||||||
notmuch git -C tags.git -p '' status > OUTPUT
|
notmuch git -C tags.git status > OUTPUT
|
||||||
cat <<EOF > EXPECTED
|
cat <<EOF > EXPECTED
|
||||||
a 20091117190054.GU3165@dottiness.seas.harvard.edu test2
|
a 20091117190054.GU3165@dottiness.seas.harvard.edu test2
|
||||||
EOF
|
EOF
|
||||||
notmuch git -C tags.git -p '' checkout
|
notmuch git -C tags.git checkout
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "merge"
|
test_begin_subtest "merge"
|
||||||
notmuch git -C tags.git -p '' merge
|
notmuch git -C tags.git merge
|
||||||
notmuch dump id:20091117190054.GU3165@dottiness.seas.harvard.edu | grep -v '^#' > OUTPUT
|
notmuch dump id:20091117190054.GU3165@dottiness.seas.harvard.edu | grep -v '^#' > OUTPUT
|
||||||
cat <<EOF > EXPECTED
|
cat <<EOF > EXPECTED
|
||||||
+inbox +signed +test2 +unread -- id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
+inbox +signed +test2 +unread -- id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
||||||
|
@ -124,10 +124,10 @@ test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_begin_subtest "push"
|
test_begin_subtest "push"
|
||||||
notmuch tag +test3 id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
notmuch tag +test3 id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
||||||
notmuch git -C tags.git -p '' commit
|
notmuch git -C tags.git commit
|
||||||
notmuch tag -test3 id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
notmuch tag -test3 id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
||||||
notmuch git -C tags.git -p '' push
|
notmuch git -C tags.git push
|
||||||
notmuch git -C remote.git -p '' checkout
|
notmuch git -C remote.git checkout
|
||||||
notmuch dump id:20091117190054.GU3165@dottiness.seas.harvard.edu | grep -v '^#' > OUTPUT
|
notmuch dump id:20091117190054.GU3165@dottiness.seas.harvard.edu | grep -v '^#' > OUTPUT
|
||||||
cat <<EOF > EXPECTED
|
cat <<EOF > EXPECTED
|
||||||
+inbox +signed +test2 +test3 +unread -- id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
+inbox +signed +test2 +test3 +unread -- id:20091117190054.GU3165@dottiness.seas.harvard.edu
|
||||||
|
@ -145,4 +145,69 @@ env NOTMUCH_CONFIG = CWD/notmuch-config
|
||||||
EOF
|
EOF
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "--nmbug argument sets defaults"
|
||||||
|
notmuch git -ldebug --nmbug status |& grep '^\(prefix\|repository\)' | notmuch_dir_sanitize > OUTPUT
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
prefix = notmuch::
|
||||||
|
repository = CWD/home/.nmbug
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "invoke as nmbug sets defaults"
|
||||||
|
"$NOTMUCH_BUILDDIR"/nmbug -ldebug status |& grep '^\(prefix\|repository\)' | notmuch_dir_sanitize > OUTPUT
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
prefix = notmuch::
|
||||||
|
repository = CWD/home/.nmbug
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "env variable NOTMUCH_GIT_DIR works when invoked as nmbug"
|
||||||
|
NOTMUCH_GIT_DIR=`pwd`/foo "$NOTMUCH_BUILDDIR"/nmbug -ldebug status |& grep '^repository' | notmuch_dir_sanitize > OUTPUT
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
repository = CWD/foo
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "env variable NOTMUCH_GIT_DIR works when invoked as 'notmuch git'"
|
||||||
|
NOTMUCH_GIT_DIR=`pwd`/remote.git notmuch git -ldebug status |& grep '^repository' | notmuch_dir_sanitize > OUTPUT
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
repository = CWD/remote.git
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "env variable NOTMUCH_GIT_PREFIX works when invoked as nmbug"
|
||||||
|
NOTMUCH_GIT_PREFIX=foo:: "$NOTMUCH_BUILDDIR"/nmbug -ldebug status |& grep '^prefix' | notmuch_dir_sanitize > OUTPUT
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
prefix = foo::
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "env variable NOTMUCH_GIT_PREFIX works when invoked as 'notmuch git'"
|
||||||
|
NOTMUCH_GIT_PREFIX=env:: notmuch git -ldebug status |& grep '^prefix' | notmuch_dir_sanitize > OUTPUT
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
prefix = env::
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
|
|
||||||
|
test_begin_subtest "init, xdg default location"
|
||||||
|
repo=home/.local/share/notmuch/default/git
|
||||||
|
notmuch git -ldebug init |& grep '^repository' | notmuch_dir_sanitize > OUTPUT
|
||||||
|
git -C $repo rev-parse --absolute-git-dir | notmuch_dir_sanitize >> OUTPUT
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
repository = CWD/$repo
|
||||||
|
CWD/$repo
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "init, xdg default location, with profile"
|
||||||
|
repo=home/.local/share/notmuch/work/git
|
||||||
|
NOTMUCH_PROFILE=work notmuch git -ldebug init |& grep '^repository' | notmuch_dir_sanitize > OUTPUT
|
||||||
|
git -C $repo rev-parse --absolute-git-dir | notmuch_dir_sanitize >> OUTPUT
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
repository = CWD/$repo
|
||||||
|
CWD/$repo
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Reference in a new issue