All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: gitster@pobox.com
Cc: pclouds@gmail.com, git@vger.kernel.org, jrnieder@gmail.com,
	Jens.Lehmann@web.de, Stefan Beller <sbeller@google.com>
Subject: [RFC PATCH 0/4] pathspec labels [WAS: submodule groups]
Date: Thu, 12 May 2016 17:19:32 -0700	[thread overview]
Message-ID: <20160513001936.7623-1-sbeller@google.com> (raw)

After some fruitful discussion[1] in which Junio suggested trying a very
different route[2] that is more general and not submodule related, I considered
doing a mock for this.

This lets you label arbitrary pathspecs, e.g. in git.git we may want to have:

    t/t[0-9]*.sh label=tests
    
such that

    $ git log --author=Beller ":(label=tests)"
    
would show all commits in which I touched tests.

This has suprisingly few lines of code, as the first 3 patches are refactoring.
The actual new feature is in the last patch.

This would solve the submodule issues I want to solve, as I can produce a
.gitattributes like:

    ./submodule1 label=default
    ./submodule2 label=default
    ./submodule3 label=optional-feature1
    
and then I'd instruct the users to clone like this:

    git clone .. superproject
    cd superproject
    git submodule update --init :(label:default)
    
The second part of the submodule series to collapse these three commands
will come as an extra series later, then.

What annoys me here:
Attributes can only be set once at the moment, there is no way to collect all
attributes. If we'd have such a collection feature we would be able to
configure this:

    *.[ch] label=C,code
    contrib/** label=oldstuff
    
and run this:

    git status ":(label:C oldstuff)"
    
which would be the equivalent to

    contrib/**.[ch]
    
as in this proposed implementation the labels which are given within one
pathspec item are logical AND. To get the logical OR, you'd have to give multiple
pathspec items, i.e. ":(label:C)" ":(label:oldstuff)"

Feedback welcome!

Thanks,
Stefan

[1] http://thread.gmane.org/gmane.comp.version-control.git/294212
[2] http://thread.gmane.org/gmane.comp.version-control.git/294212/focus=294391

Stefan Beller (4):
  Documentation: correct typo in example for querying attributes
  pathspec: move long magic parsing out of prefix_pathspec
  pathspec: move prefix check out of the inner loop
  pathspec: record labels

 Documentation/glossary-content.txt            |   5 ++
 Documentation/technical/api-gitattributes.txt |   2 +-
 attr.h                                        |   1 +
 dir.c                                         |  31 ++++++++
 pathspec.c                                    | 109 +++++++++++++++++---------
 pathspec.h                                    |   1 +
 t/t6134-pathspec-with-labels.sh               |  91 +++++++++++++++++++++
 7 files changed, 201 insertions(+), 39 deletions(-)
 create mode 100755 t/t6134-pathspec-with-labels.sh

-- 
2.8.2.400.g66c4903.dirty

             reply	other threads:[~2016-05-13  0:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-13  0:19 Stefan Beller [this message]
2016-05-13  0:19 ` [PATCH 1/4] Documentation: correct typo in example for querying attributes Stefan Beller
2016-05-13  0:19 ` [PATCH 2/4] pathspec: move long magic parsing out of prefix_pathspec Stefan Beller
2016-05-13  0:19 ` [PATCH 3/4] pathspec: move prefix check out of the inner loop Stefan Beller
2016-05-13  4:43   ` Junio C Hamano
2016-05-13  0:19 ` [PATCH 4/4] pathspec: record labels Stefan Beller
2016-05-13  4:32   ` Junio C Hamano
2016-05-13  5:26     ` Stefan Beller
2016-05-13  5:26   ` Junio C Hamano
2016-05-13  5:41     ` Stefan Beller
2016-05-13  6:28       ` Junio C Hamano
2016-05-15 10:06 ` [RFC PATCH 0/4] pathspec labels [WAS: submodule groups] Duy Nguyen
2016-05-15 18:19   ` Junio C Hamano
2016-05-15 19:33     ` Junio C Hamano
2016-05-16  0:03       ` Duy Nguyen
2016-05-16 17:20   ` Stefan Beller
2016-05-16 17:39     ` Junio C Hamano
2016-05-16 17:48       ` Stefan Beller
2016-05-16 21:18         ` Junio C Hamano
2016-05-16 21:36           ` Stefan Beller
2016-05-16 21:50             ` Junio C Hamano
2016-05-16 22:00               ` Stefan Beller
2016-05-16 22:02                 ` Junio C Hamano
2016-05-16 22:09                   ` Stefan Beller
2016-05-16 22:19                     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160513001936.7623-1-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.