git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v7 00/33] refs backend
@ 2016-03-01  0:52 David Turner
  2016-03-01  0:52 ` [PATCH v7 01/33] setup: call setup_git_directory_gently before accessing refs David Turner
                   ` (32 more replies)
  0 siblings, 33 replies; 59+ messages in thread
From: David Turner @ 2016-03-01  0:52 UTC (permalink / raw)
  To: git, peff, mhagger, pclouds; +Cc: David Turner

This one has suggestions from Peff, SZEDER Gábor, Duy Nguyen, and
fixups from Junio.

The major changes are:

* The new patch "call setup_git_directory_gently before accessing
  refs" -- this is necessary in order to move "setup: configure ref
  storage config on startup" from config to setup.

* "setup: configure ref storage config on startup" is now much shorter.

In addition, there are some minor fixups to remove variable shadowing
in the lmdb code and to improve the design of the
set_ref_storage_backend family of functions.

David Turner (30):
  setup: call setup_git_directory_gently before accessing refs
  refs: move head_ref{,_submodule} to the common code
  refs: move for_each_*ref* functions into common code
  files-backend: break out ref reading
  refs: move resolve_ref_unsafe into common code
  refs: add method for do_for_each_ref
  refs: add do_for_each_per_worktree_ref
  refs: add methods for reflog
  refs: add method for initial ref transaction commit
  refs: add method for delete_refs
  refs: add methods to init refs db
  refs: add method to rename refs
  refs: handle non-normal ref renames
  refs: make lock generic
  refs: move duplicate check to common code
  refs: allow log-only updates
  refs: don't dereference on rename
  refs: on symref reflog expire, lock symref not referrent
  refs: resolve symbolic refs first
  refs: always handle non-normal refs in files backend
  init: allow alternate ref strorage to be set for new repos
  refs: check submodules' ref storage config
  clone: allow ref storage backend to be set for clone
  svn: learn ref-storage argument
  refs: register ref storage backends
  setup: configure ref storage config on startup
  refs: break out resolve_ref_unsafe_submodule
  refs: add LMDB refs storage backend
  refs: tests for lmdb backend
  tests: add ref-storage argument

Ramsay Jones (1):
  refs: reduce the visibility of do_for_each_ref()

Ronnie Sahlberg (2):
  refs: add a backend method structure with transaction functions
  refs: add methods for misc ref operations

 .gitignore                                     |    1 +
 Documentation/config.txt                       |    9 +
 Documentation/git-clone.txt                    |    6 +
 Documentation/git-init-db.txt                  |    2 +-
 Documentation/git-init.txt                     |    8 +-
 Documentation/technical/refs-lmdb-backend.txt  |   61 +
 Documentation/technical/repository-version.txt |    7 +
 Makefile                                       |   12 +
 builtin/clone.c                                |    5 +
 builtin/grep.c                                 |    1 +
 builtin/init-db.c                              |   55 +-
 builtin/log.c                                  |    2 +-
 builtin/shortlog.c                             |    7 +-
 builtin/submodule--helper.c                    |    2 +-
 cache.h                                        |    2 +
 config.c                                       |    1 +
 configure.ac                                   |   33 +
 contrib/completion/git-completion.bash         |    6 +-
 contrib/workdir/git-new-workdir                |    3 +
 git-submodule.sh                               |   13 +
 git-svn.perl                                   |    6 +-
 git.c                                          |    2 +-
 path.c                                         |   30 +-
 refs.c                                         |  631 +++++++-
 refs.h                                         |   16 +
 refs/files-backend.c                           |  686 ++++-----
 refs/lmdb-backend.c                            | 1886 ++++++++++++++++++++++++
 refs/refs-internal.h                           |  123 +-
 setup.c                                        |   29 +
 shortlog.h                                     |    2 +-
 t/README                                       |    6 +
 t/lib-submodule-update.sh                      |   15 +-
 t/lib-t6000.sh                                 |    7 +-
 t/t0001-init.sh                                |   25 +
 t/t0008-ignores.sh                             |    2 +-
 t/t0062-revision-walking.sh                    |    6 +
 t/t1021-rerere-in-workdir.sh                   |    6 +
 t/t1200-tutorial.sh                            |    8 +-
 t/t1302-repo-version.sh                        |    6 +
 t/t1305-config-include.sh                      |   17 +-
 t/t1400-update-ref.sh                          |    6 +
 t/t1401-symbolic-ref.sh                        |   17 +-
 t/t1404-update-ref-df-conflicts.sh             |    8 +-
 t/t1410-reflog.sh                              |   16 +
 t/t1430-bad-ref-name.sh                        |    6 +
 t/t1450-fsck.sh                                |   12 +-
 t/t1460-refs-lmdb-backend.sh                   | 1109 ++++++++++++++
 t/t1470-refs-lmdb-backend-reflog.sh            |  359 +++++
 t/t1480-refs-lmdb-submodule.sh                 |   85 ++
 t/t1506-rev-parse-diagnosis.sh                 |    4 +-
 t/t2013-checkout-submodule.sh                  |    2 +-
 t/t2105-update-index-gitfile.sh                |    4 +-
 t/t2107-update-index-basic.sh                  |    6 +-
 t/t2201-add-update-typechange.sh               |    4 +-
 t/t3001-ls-files-others-exclude.sh             |    2 +-
 t/t3010-ls-files-killed-modified.sh            |    4 +-
 t/t3040-subprojects-basic.sh                   |    4 +-
 t/t3050-subprojects-fetch.sh                   |    2 +-
 t/t3200-branch.sh                              |   84 +-
 t/t3210-pack-refs.sh                           |    7 +
 t/t3211-peel-ref.sh                            |    6 +
 t/t3308-notes-merge.sh                         |    2 +-
 t/t3404-rebase-interactive.sh                  |    2 +-
 t/t3600-rm.sh                                  |    2 +-
 t/t3800-mktag.sh                               |    4 +-
 t/t3903-stash.sh                               |    2 +-
 t/t4010-diff-pathspec.sh                       |    2 +-
 t/t4020-diff-external.sh                       |    2 +-
 t/t4027-diff-submodule.sh                      |    2 +-
 t/t4035-diff-quiet.sh                          |    2 +-
 t/t4255-am-submodule.sh                        |    2 +-
 t/t5000-tar-tree.sh                            |    3 +-
 t/t5304-prune.sh                               |    2 +-
 t/t5312-prune-corruption.sh                    |   11 +-
 t/t5500-fetch-pack.sh                          |   10 +-
 t/t5510-fetch.sh                               |   30 +-
 t/t5526-fetch-submodules.sh                    |    4 +-
 t/t5527-fetch-odd-refs.sh                      |    7 +
 t/t5537-fetch-shallow.sh                       |    7 +
 t/t5700-clone-reference.sh                     |   42 +-
 t/t6001-rev-list-graft.sh                      |    3 +-
 t/t6010-merge-base.sh                          |    2 +-
 t/t6050-replace.sh                             |    4 +-
 t/t6120-describe.sh                            |    6 +-
 t/t6301-for-each-ref-errors.sh                 |   12 +-
 t/t7201-co.sh                                  |    2 +-
 t/t7300-clean.sh                               |   25 +-
 t/t7400-submodule-basic.sh                     |   22 +-
 t/t7402-submodule-rebase.sh                    |    2 +-
 t/t7405-submodule-merge.sh                     |   10 +-
 t/t9104-git-svn-follow-parent.sh               |    3 +-
 t/t9115-git-svn-dcommit-funky-renames.sh       |    2 +-
 t/t9350-fast-export.sh                         |    6 +-
 t/t9902-completion.sh                          |    4 +-
 t/t9903-bash-prompt.sh                         |    2 +-
 t/test-lib-functions.sh                        |   53 +-
 t/test-lib.sh                                  |   12 +
 test-match-trees.c                             |    2 +
 test-refs-lmdb-backend.c                       |   66 +
 test-revision-walking.c                        |    2 +
 100 files changed, 5265 insertions(+), 605 deletions(-)
 create mode 100644 Documentation/technical/refs-lmdb-backend.txt
 create mode 100644 refs/lmdb-backend.c
 create mode 100755 t/t1460-refs-lmdb-backend.sh
 create mode 100755 t/t1470-refs-lmdb-backend-reflog.sh
 create mode 100755 t/t1480-refs-lmdb-submodule.sh
 create mode 100644 test-refs-lmdb-backend.c

-- 
2.4.2.767.g62658d5-twtrsrc

^ permalink raw reply	[flat|nested] 59+ messages in thread
* Re: [PATCH v7 01/33] setup: call setup_git_directory_gently before accessing refs
@ 2016-03-01  9:53 Duy Nguyen
  2016-03-01  9:55 ` Jeff King
  0 siblings, 1 reply; 59+ messages in thread
From: Duy Nguyen @ 2016-03-01  9:53 UTC (permalink / raw)
  To: Jeff King; +Cc: David Turner, Git Mailing List, Michael Haggerty

On Tue, Mar 1, 2016 at 3:35 PM, Jeff King <peff@peff.net> wrote:
> On Mon, Feb 29, 2016 at 07:52:34PM -0500, David Turner wrote:
>
>> Usually, git calls some form of setup_git_directory at startup.  But
>> sometimes, it doesn't.  Usually, that's OK because it's not really
>> using the repository.  But in some cases, it is using the repo.  In
>> those cases, either setup_git_directory_gently must be called, or the
>> repository (e.g. the refs) must not be accessed.
>
> It's actually not just setup_git_directory(). We can also use
> check_repository_format(), which is used by enter_repo() (and hence by
> things like upload-pack). I think the rule really ought to be: if we
> didn't have check_repository_format_gently() tell us we have a valid
> repo, we should not access any repo elements (refs, objects, etc).

Agreed.

There's also a lighter version of check_repo.. which is
is_git_directory(). Most of the time we just want to answer the
question "is it a valid repository? support or not does not matter".
We probably need more eyes on submodule case when this functino is
used. For example in 25/33 [1] we check if a repo is non-bare (a
variant of is_git_directory) then we peek the config file inside.
Should check_repository_format() be done in this case?

You know what, forget my question. The answer is yes. After writing
all that, I remember that part of the config file may be moved away in
the next version of multiple worktrees [2]. We need proper repo
validation before reading anything inside.

[1] http://article.gmane.org/gmane.comp.version-control.git/287959
[2] http://article.gmane.org/gmane.comp.version-control.git/284803

> I started earlier today on a patch series to identify and fix these
> cases independent of your series.

Yes this sounds like a separate problem, even though it's raised by lmdb topic.

> The basic strategy was to adapt the
> existing "struct startup_info" to be available everywhere, and have
> relevant bits of code assert() on it, or even behave differently (e.g.,
> if some library code should do different things in a repo versus not).

startup_info is NULL for external programs if I remember correctly, or
do you make it available to all of them too?
-- 
Duy

^ permalink raw reply	[flat|nested] 59+ messages in thread

end of thread, other threads:[~2016-04-25 16:47 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-01  0:52 [PATCH v7 00/33] refs backend David Turner
2016-03-01  0:52 ` [PATCH v7 01/33] setup: call setup_git_directory_gently before accessing refs David Turner
2016-03-01  8:35   ` Jeff King
2016-03-01 23:47     ` David Turner
2016-03-02  0:33       ` David Turner
2016-03-02  2:45       ` Jeff King
2016-03-01  0:52 ` [PATCH v7 02/33] refs: move head_ref{,_submodule} to the common code David Turner
2016-03-01  0:52 ` [PATCH v7 03/33] refs: move for_each_*ref* functions into " David Turner
2016-03-01  0:52 ` [PATCH v7 04/33] files-backend: break out ref reading David Turner
2016-03-20  5:03   ` Michael Haggerty
2016-03-22  8:33     ` Michael Haggerty
2016-03-23 10:19   ` Michael Haggerty
2016-03-01  0:52 ` [PATCH v7 05/33] refs: move resolve_ref_unsafe into common code David Turner
2016-03-01  0:52 ` [PATCH v7 06/33] refs: add a backend method structure with transaction functions David Turner
2016-03-01  0:52 ` [PATCH v7 07/33] refs: add methods for misc ref operations David Turner
2016-03-01  0:52 ` [PATCH v7 08/33] refs: add method for do_for_each_ref David Turner
2016-03-01  0:52 ` [PATCH v7 09/33] refs: reduce the visibility of do_for_each_ref() David Turner
2016-03-24  7:07   ` Michael Haggerty
2016-03-24 18:56     ` David Turner
2016-03-01  0:52 ` [PATCH v7 10/33] refs: add do_for_each_per_worktree_ref David Turner
2016-03-01  0:52 ` [PATCH v7 11/33] refs: add methods for reflog David Turner
2016-03-01  0:52 ` [PATCH v7 12/33] refs: add method for initial ref transaction commit David Turner
2016-03-01  0:52 ` [PATCH v7 13/33] refs: add method for delete_refs David Turner
2016-03-01  0:52 ` [PATCH v7 14/33] refs: add methods to init refs db David Turner
2016-03-24  7:28   ` Michael Haggerty
2016-03-24 18:04     ` David Turner
2016-03-01  0:52 ` [PATCH v7 15/33] refs: add method to rename refs David Turner
2016-03-01  0:52 ` [PATCH v7 16/33] refs: handle non-normal ref renames David Turner
2016-03-01  0:52 ` [PATCH v7 17/33] refs: make lock generic David Turner
2016-03-24 19:45   ` Michael Haggerty
2016-03-01  0:52 ` [PATCH v7 18/33] refs: move duplicate check to common code David Turner
2016-03-01  0:52 ` [PATCH v7 19/33] refs: allow log-only updates David Turner
2016-04-21 14:17   ` Michael Haggerty
2016-04-25 16:46     ` David Turner
2016-03-01  0:52 ` [PATCH v7 20/33] refs: don't dereference on rename David Turner
2016-03-01  0:52 ` [PATCH v7 21/33] refs: on symref reflog expire, lock symref not referrent David Turner
2016-03-01  0:52 ` [PATCH v7 22/33] refs: resolve symbolic refs first David Turner
2016-03-01  0:52 ` [PATCH v7 23/33] refs: always handle non-normal refs in files backend David Turner
2016-03-01  0:52 ` [PATCH v7 24/33] init: allow alternate ref strorage to be set for new repos David Turner
2016-03-01  0:52 ` [PATCH v7 25/33] refs: check submodules' ref storage config David Turner
2016-03-01  0:52 ` [PATCH v7 26/33] clone: allow ref storage backend to be set for clone David Turner
2016-03-01  0:53 ` [PATCH v7 27/33] svn: learn ref-storage argument David Turner
2016-03-01  0:53 ` [PATCH v7 28/33] refs: register ref storage backends David Turner
2016-03-01  0:53 ` [PATCH v7 29/33] setup: configure ref storage on setup David Turner
2016-03-01  8:48   ` Jeff King
2016-03-01 14:50     ` Jeff King
2016-03-01 17:18   ` Ramsay Jones
2016-03-01 19:16     ` David Turner
2016-03-01  0:53 ` [PATCH v7 30/33] refs: break out resolve_ref_unsafe_submodule David Turner
2016-03-01 17:21   ` Ramsay Jones
2016-03-01 19:17     ` David Turner
2016-03-01  0:53 ` [PATCH v7 31/33] refs: add LMDB refs storage backend David Turner
2016-03-01  1:31   ` Duy Nguyen
2016-03-01  1:35     ` David Turner
2016-03-01  1:45       ` Duy Nguyen
2016-03-01  0:53 ` [PATCH v7 32/33] refs: tests for lmdb backend David Turner
2016-03-01  0:53 ` [PATCH v7 33/33] tests: add ref-storage argument David Turner
  -- strict thread matches above, loose matches on Subject: below --
2016-03-01  9:53 [PATCH v7 01/33] setup: call setup_git_directory_gently before accessing refs Duy Nguyen
2016-03-01  9:55 ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).