Skip to content
Permalink
Branch: check-ignore
Commits on Jan 16, 2013
  1. [SQUASH] t0008: avoid brace expansion

    René Scharfe authored and aspiers committed Jan 10, 2013
    Brace expansion is a shell feature that's not required by POSIX and not
    supported by dash nor NetBSD's sh.  Explicitly list all combinations
    instead.  Also avoid calling touch by creating the test files with a
    redirection instead, as suggested by Junio.
    
    Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    Signed-off-by: Adam Spiers <git@adamspiers.org>
Commits on Jan 6, 2013
  1. add git-check-ignore sub-command

    aspiers committed Dec 29, 2012
    This works in a similar manner to git-check-attr.
    
    Thanks to Jeff King and Junio C Hamano for the idea:
    http://thread.gmane.org/gmane.comp.version-control.git/108671/focus=108815
  2. setup.c: document get_pathspec()

    aspiers committed Dec 21, 2012
    Since we have just created a new pathspec-handling library, now is a
    good time to add some comments explaining get_pathspec().
  3. add.c: extract new die_if_path_beyond_symlink() for reuse

    aspiers committed Dec 29, 2012
    This will be reused by a new git check-ignore command.
    
    Also document validate_pathspec().
  4. add.c: extract check_path_for_gitlink() from treat_gitlinks() for reuse

    aspiers committed Dec 29, 2012
    Extract the body of the for loop in treat_gitlinks() into a separate
    check_path_for_gitlink() function so that it can be reused elsewhere.
    This paves the way for a new check-ignore sub-command.
    
    Also document treat_gitlinks().
  5. pathspec.c: rename newly public functions for clarity

    aspiers committed Dec 29, 2012
    Perform the following function renames to make it explicit that these
    pathspec handling functions are for matching against the index, rather
    than against a tree or the working directory.
    
    - fill_pathspec_matches() -> add_pathspec_matches_against_index()
    - find_used_pathspec() -> find_pathspecs_matching_against_index()
  6. add.c: move pathspec matchers into new pathspec.c for reuse

    aspiers committed Dec 29, 2012
    Extract the following functions from builtin/add.c to pathspec.c, in
    preparation for reuse by a new git check-ignore command:
    
      - fill_pathspec_matches()
      - find_used_pathspec()
    
    The functions being extracted are not changed in any way, except
    removal of the 'static' qualifier.
    
    Also add comments documenting these newly public functions,
    including clarifications that they operate on the index.
  7. add.c: remove unused argument from validate_pathspec()

    aspiers committed Dec 20, 2012
    The 'argc' argument passed to validate_pathspec() was never used.
  8. dir.c: improve docs for match_pathspec() and match_pathspec_depth()

    aspiers committed Dec 29, 2012
    Fix a grammatical issue in the description of these functions, and
    make it more obvious how and why seen[] can be reused across multiple
    invocations.
  9. dir.c: provide clear_directory() for reclaiming dir_struct memory

    aspiers committed Oct 15, 2012
    By the end of a directory traversal, a dir_struct instance will
    typically contains pointers to various data structures on the heap.
    clear_directory() provides a convenient way to reclaim that memory.
  10. dir.c: keep track of where patterns came from

    aspiers committed Dec 26, 2012
    For exclude patterns read in from files, the filename is stored in the
    exclude list, and the originating line number is stored in the
    individual exclude (counting starting at 1).
    
    For exclude patterns provided on the command line, a string describing
    the source of the patterns is stored in the exclude list, and the
    sequence number assigned to each exclude pattern is negative, with
    counting starting at -1.  So for example the 2nd pattern provided via
    --exclude would be numbered -2.  This allows any future consumers of
    that data to easily distinguish between exclude patterns from files
    vs. from the CLI.
  11. [SQUASH] avoid assuming knowledge of the internal implementation of e…

    aspiers committed Jan 6, 2013
    …xclude_list_groups
    
    On Sun, Jan 06, 2013 at 12:25:48PM -0800, Junio C Hamano wrote:
    > Adam Spiers <git@adamspiers.org> writes:
    >
    > > On Fri, Jan 04, 2013 at 01:03:59PM -0800, Junio C Hamano wrote:
    > >> Adam Spiers <git@adamspiers.org> writes:
    > >>
    > >> > diff --git a/builtin/clean.c b/builtin/clean.c
    > >> > index 0c7b3d0..bd18b88 100644
    > >> > --- a/builtin/clean.c
    > >> > +++ b/builtin/clean.c
    > >> > @@ -97,9 +97,10 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
    > >> >  	if (!ignored)
    > >> >  		setup_standard_excludes(&dir);
    > >> >
    > >> > +	add_exclude_list(&dir, EXC_CMDL);
    > >> >  	for (i = 0; i < exclude_list.nr; i++)
    > >> >  		add_exclude(exclude_list.items[i].string, "", 0,
    > >> > -			    &dir.exclude_list[EXC_CMDL]);
    > >> > +			    &dir.exclude_list_groups[EXC_CMDL].ary[0]);
    > >>
    > >> This looks somewhat ugly for two reasons.
    > >>
    > >>  * The abstraction add_exclude() offers to its callers is just to
    > >>    let them add one pattern to the list of patterns for the kind
    > >>    (here, EXC_CMDL); why should they care about .ary[0] part?
    > >
    > > Because the caller has to decide which exclude list the new exclude
    > > should be added to; that is how it has been for a long time, and I am
    > > not proposing we change that.
    >
    > Unless I was mistaken, I never objected to the EXC_CMDL, etc
    > appearing in the text of the calling site of add_exclude().
    >
    > The objection was about the .ary[0] bit.  From the point of view of
    > a caller of the API, it:
    >
    >     - calls add_exclude_list() to declare "I now start adding new
    >       patterns that come from a new source of patterns"; then
    >
    >     - calls add_exclude() repeatedly to add the patterns that come
    >       from that source.
    >
    > no?
    
    Correct.
    
    > Why does the latter has to keep repeating "Here is the new
    > pattern for the EXC_CMDL group; it comes from the latest source I
    > earlier declared, by the way", instead of just "Here is the new
    > pattern for the EXC_CMDL group"?
    
    Mainly because there is no guarantee that such a group exists.
    
    unpack_trees() has:
    
    	if (add_excludes_from_file_to_list(git_path("info/sparse-checkout"), "", 0, &el, 0) < 0)
    
    so if you change the signature of add_exclude() to require an
    exclude_list_group, then there is no way to implement
    add_excludes_from_file_to_list().
    
    Even if you could, you still haven't reduced the number of parameters
    add_exclude() requires, so I'm dubious of the benefits of this
    "simplification".
    
    > >>    Are
    > >>    there cases any sane caller (not the implementation of the
    > >>    exclude_list_group machinery e.g. add_excludes_from_... function)
    > >>    may want to call it with .ary[1]?
    > >
    > > Effectively yes, although it is not written like ".ary[1]".  For
    > > example prep_exclude() calls add_excludes_from_file_to_list() for each
    > > new .gitignore file
    >
    > That is part of the "implementation of the machinery".  If the API
    > for the outside callers are to call add_exclude_list() to declare
    > that patterns added by subsequent calls to add_exclude() are from
    > one new source of the patterns (e.g. .gitignore file in a new
    > directory level), and then call add_exclude() to add each pattern,
    > then the callers to add_exclude() shouldn't have to care about the
    > implementation detail that individual sources in exclude_list_group
    > is implemented as an array in that sructure, and the latest ones
    > should go to its ->array[0].
    
    That's a valid point.  However, the ary[0] part which assumes external
    knowledge of the internal implementation can trivially be avoided by
    squashing this patch onto the commit we are discussing:
  12. dir.c: use a single struct exclude_list per source of excludes

    aspiers committed Dec 26, 2012
    Previously each exclude_list could potentially contain patterns
    from multiple sources.  For example dir->exclude_list[EXC_FILE]
    would typically contain patterns from .git/info/exclude and
    core.excludesfile, and dir->exclude_list[EXC_DIRS] could contain
    patterns from multiple per-directory .gitignore files during
    directory traversal (i.e. when dir->exclude_stack was more than
    one item deep).
    
    We split these composite exclude_lists up into three groups of
    exclude_lists (EXC_CMDL / EXC_DIRS / EXC_FILE as before), so that each
    exclude_list now contains patterns from a single source.  This will
    allow us to cleanly track the origin of each pattern simply by adding
    a src field to struct exclude_list, rather than to struct exclude,
    which would make memory management of the source string tricky in the
    EXC_DIRS case where its contents are dynamically generated.
    
    Similarly, by moving the filebuf member from struct exclude_stack to
    struct exclude_list, it allows us to track and subsequently free
    memory buffers allocated during the parsing of all exclude files,
    rather than only tracking buffers allocated for files in the EXC_DIRS
    group.
Commits on Dec 28, 2012
  1. dir.c: rename free_excludes() to clear_exclude_list()

    aspiers authored and gitster committed Dec 27, 2012
    It is clearer to use a 'clear_' prefix for functions which empty
    and deallocate the contents of a data structure without freeing
    the structure itself, and a 'free_' prefix for functions which
    also free the structure itself.
    
    http://article.gmane.org/gmane.comp.version-control.git/206128
    
    Signed-off-by: Adam Spiers <git@adamspiers.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. dir.c: refactor is_path_excluded()

    aspiers authored and gitster committed Dec 27, 2012
    In a similar way to the previous commit, this extracts a new helper
    function last_exclude_matching_path() which return the last
    exclude_list element which matched, or NULL if no match was found.
    is_path_excluded() becomes a wrapper around this, and just returns 0
    or 1 depending on whether any matching exclude_list element was found.
    
    This allows callers to find out _why_ a given path was excluded,
    rather than just whether it was or not, paving the way for a new git
    sub-command which allows users to test their exclude lists from the
    command line.
    
    Signed-off-by: Adam Spiers <git@adamspiers.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. dir.c: refactor is_excluded()

    aspiers authored and gitster committed Dec 27, 2012
    In a similar way to the previous commit, this extracts a new helper
    function last_exclude_matching() which returns the last exclude_list
    element which matched, or NULL if no match was found.  is_excluded()
    becomes a wrapper around this, and just returns 0 or 1 depending on
    whether any matching exclude_list element was found.
    
    This allows callers to find out _why_ a given path was excluded,
    rather than just whether it was or not, paving the way for a new git
    sub-command which allows users to test their exclude lists from the
    command line.
    
    Signed-off-by: Adam Spiers <git@adamspiers.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. dir.c: refactor is_excluded_from_list()

    aspiers authored and gitster committed Dec 27, 2012
    The excluded function uses a new helper function called
    last_exclude_matching_from_list() to perform the inner loop over all of
    the exclude patterns.  The helper just tells us whether the path is
    included, excluded, or undecided.
    
    However, it may be useful to know _which_ pattern was triggered.  So
    let's pass out the entire exclude match, which contains the status
    information we were already passing out.
    
    Further patches can make use of this.
    
    This is a modified forward port of a patch from 2009 by Jeff King:
    http://article.gmane.org/gmane.comp.version-control.git/108815
    
    Signed-off-by: Adam Spiers <git@adamspiers.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. dir.c: rename excluded() to is_excluded()

    aspiers authored and gitster committed Dec 27, 2012
    Continue adopting clearer names for exclude functions.  This is_*
    naming pattern for functions returning booleans was discussed here:
    
    http://thread.gmane.org/gmane.comp.version-control.git/204661/focus=204924
    
    Signed-off-by: Adam Spiers <git@adamspiers.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  6. dir.c: rename excluded_from_list() to is_excluded_from_list()

    aspiers authored and gitster committed Dec 27, 2012
    Continue adopting clearer names for exclude functions.  This 'is_*'
    naming pattern for functions returning booleans was discussed here:
    
    http://thread.gmane.org/gmane.comp.version-control.git/204661/focus=204924
    
    Also adjust their callers as necessary.
    
    Signed-off-by: Adam Spiers <git@adamspiers.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  7. dir.c: rename path_excluded() to is_path_excluded()

    aspiers authored and gitster committed Dec 27, 2012
    Start adopting clearer names for exclude functions.  This 'is_*'
    naming pattern for functions returning booleans was agreed here:
    
    http://thread.gmane.org/gmane.comp.version-control.git/204661/focus=204924
    
    Signed-off-by: Adam Spiers <git@adamspiers.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  8. dir.c: rename cryptic 'which' variable to more consistent name

    aspiers authored and gitster committed Dec 27, 2012
    'el' is only *slightly* less cryptic, but is already used as the
    variable name for a struct exclude_list pointer in numerous other
    places, so this reduces the number of cryptic variable names in use by
    one :-)
    
    Signed-off-by: Adam Spiers <git@adamspiers.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  9. Improve documentation and comments regarding directory traversal API

    aspiers authored and gitster committed Dec 27, 2012
    traversal API has a few potentially confusing properties.  These
    comments clarify a few key aspects and will hopefully make it easier
    to understand for other newcomers in the future.
    
    Signed-off-by: Adam Spiers <git@adamspiers.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  10. api-directory-listing.txt: update to match code

    aspiers authored and gitster committed Dec 27, 2012
    7c4c97c turned the flags in struct dir_struct into a single bitfield
    variable, but forgot to update this document.
    
    Signed-off-by: Adam Spiers <git@adamspiers.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 15, 2012
  1. attr: more matching optimizations from .gitignore

    pclouds authored and gitster committed Oct 15, 2012
    .gitattributes and .gitignore share the same pattern syntax but has
    separate matching implementation. Over the years, ignore's
    implementation accumulates more optimizations while attr's stays the
    same.
    
    This patch reuses the core matching functions that are also used by
    excluded_from_list. excluded_from_list and path_matches can't be
    merged due to differences in exclude and attr, for example:
    
    * "!pattern" syntax is forbidden in .gitattributes.  As an attribute
      can be unset (i.e. set to a special value "false") or made back to
      unspecified (i.e. not even set to "false"), "!pattern attr" is unclear
      which one it means.
    
    * we support attaching attributes to directories, but git-core
      internally does not currently make use of attributes on
      directories.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. gitignore: make pattern parsing code a separate function

    pclouds authored and gitster committed Oct 15, 2012
    This function can later be reused by attr.c. Also turn to_exclude
    field into a flag.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. exclude: split pathname matching code into a separate function

    pclouds authored and gitster committed Oct 15, 2012
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. exclude: fix a bug in prefix compare optimization

    pclouds authored and gitster committed Oct 15, 2012
    When "namelen" becomes zero at this stage, we have matched the fixed
    part, but whether it actually matches the pattern still depends on the
    pattern in "exclude". As demonstrated in t3001, path "three/a.3"
    exists and it matches the "three/a.3" part in pattern "three/a.3[abc]",
    but that does not mean a true match.
    
    Don't be too optimistic and let fnmatch() do the job.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. exclude: split basename matching code into a separate function

    pclouds authored and gitster committed Oct 15, 2012
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  6. exclude: stricten a length check in EXC_FLAG_ENDSWITH case

    pclouds authored and gitster committed Oct 15, 2012
    This block of code deals with the "basename" part only, which has the
    length of "pathlen - (basename - pathname)". Stricten the length check
    and remove "pathname" from the main expression to avoid confusion.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 5, 2012
  1. Merge commit 'f9f6e2c' into nd/attr-match-optim-more

    gitster committed Oct 5, 2012
    * commit 'f9f6e2c':
      exclude: do strcmp as much as possible before fnmatch
      dir.c: get rid of the wildcard symbol set in no_wildcard()
      Unindent excluded_from_list()
  2. attr: avoid searching for basename on every match

    pclouds authored and gitster committed Oct 5, 2012
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. attr: avoid strlen() on every match

    pclouds authored and gitster committed Oct 5, 2012
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 15, 2012
  1. Git 1.7.11.7

    gitster committed Sep 15, 2012
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. Merge branch 'jk/maint-quiet-is-synonym-to-s-in-log' into maint-1.7.11

    gitster committed Sep 15, 2012
    * jk/maint-quiet-is-synonym-to-s-in-log:
      log: fix --quiet synonym for -s
  3. Merge branch 'jc/maint-ident-missing-human-name' into maint-1.7.11

    gitster committed Sep 15, 2012
    * jc/maint-ident-missing-human-name:
      split_ident_line(): make best effort when parsing author/committer line
Older
You can’t perform that action at this time.