Skip to content
Commits on Oct 13, 2011
  1. @j6t @gitster

    t1402-check-ref-format: skip tests of refs beginning with slash on Wi…

    j6t committed with gitster
    …ndows
    
    Bash on Windows converts program arguments that look like absolute POSIX
    paths to their Windows form, i.e., drive-letter-colon format. For this
    reason, those tests in t1402 that check refs that begin with a slash do not
    work as expected on Windows: valid_ref tests are doomed to fail, and
    invalid_ref tests fail for the wrong reason (that there is a colon rather
    than that they begin with a slash).
    
    Skip these tests.
    
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 5, 2011
  1. @mhagger @gitster

    Change check_refname_format() to reject unnormalized refnames

    mhagger committed with gitster
    Since much of the infrastructure does not work correctly with
    unnormalized refnames, change check_refname_format() to reject them.
    
    Similarly, change "git check-ref-format" to reject unnormalized
    refnames by default.  But add an option --normalize, which causes "git
    check-ref-format" to normalize the refname before checking its format,
    and print the normalized refname.  This is exactly the behavior of the
    old --print option, which is retained but deprecated.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @mhagger @gitster

    Do not allow ".lock" at the end of any refname component

    mhagger committed with gitster
    Allowing any refname component to end with ".lock" is looking for
    trouble; for example,
    
        $ git br foo.lock/bar
        $ git br foo
        fatal: Unable to create '[...]/.git/refs/heads/foo.lock': File exists.
    
    Therefore, do not allow any refname component to end with ".lock".
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @mhagger @gitster

    Change check_ref_format() to take a flags argument

    mhagger committed with gitster
    Change check_ref_format() to take a flags argument that indicates what
    is acceptable in the reference name (analogous to "git
    check-ref-format"'s "--allow-onelevel" and "--refspec-pattern").  This
    is more convenient for callers and also fixes a failure in the test
    suite (and likely elsewhere in the code) by enabling "onelevel" and
    "refspec-pattern" to be allowed independently of each other.
    
    Also rename check_ref_format() to check_refname_format() to make it
    obvious that it deals with refnames rather than references themselves.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. @mhagger @gitster

    git check-ref-format: add options --allow-onelevel and --refspec-pattern

    mhagger committed with gitster
    Also add tests of the new options.  (Actually, one big reason to add
    the new options is to make it easy to test check_ref_format(), though
    the options should also be useful to other scripts.)
    
    Interpret the result of check_ref_format() based on which types of
    refnames are allowed.  However, because check_ref_format() can only
    return a single value, one test case is still broken.  Specifically,
    the case "git check-ref-format --onelevel '*'" incorrectly succeeds
    because check_ref_format() returns CHECK_REF_FORMAT_ONELEVEL for this
    refname even though the refname is also CHECK_REF_FORMAT_WILDCARD.
    The type of check that leads to this failure is used elsewhere in
    "real" code and could lead to bugs; it will be fixed over the next few
    commits.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. @mhagger @gitster

    t1402: add some more tests

    mhagger committed with gitster
    The new tests reflect the status quo.  Soon the rule for "*.lock" in
    refname components will be tightened up.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 27, 2011
  1. @mhagger @gitster

    Forbid DEL characters in reference names

    mhagger committed with gitster
    DEL is an ASCII control character and therefore should not be
    permitted in reference names.  Add tests for this and other unusual
    characters.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 25, 2011
  1. @mhagger @gitster

    check-ref-format --print: Normalize refnames that start with slashes

    mhagger committed with gitster
    When asked if "refs///heads/master" is valid, check-ref-format says "Yes,
    it is well formed", and when asked to print canonical form, it shows
    "refs/heads/master". This is so that it can be tucked after "$GIT_DIR/"
    to form a valid pathname for a loose ref, and we normalize a pathname like
    "$GIT_DIR/refs///heads/master" to de-dup the slashes in it.
    
    Similarly, when asked if "/refs/heads/master" is valid, check-ref-format
    says "Yes, it is Ok", but the leading slash is not removed when printing,
    leading to "$GIT_DIR//refs/heads/master".
    
    Fix it to make sure such leading slashes are removed.  Add tests that such
    refnames are accepted and normalized correctly.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 9, 2010
  1. @jrn @gitster

    tests: add missing &&

    jrn committed with gitster
    Breaks in a test assertion's && chain can potentially hide
    failures from earlier commands in the chain.
    
    Commands intended to fail should be marked with !, test_must_fail, or
    test_might_fail.  The examples in this patch do not require that.
    
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 6, 2010
  1. @jrn @gitster

    Allow "check-ref-format --branch" from subdirectory

    jrn committed with gitster
    check-ref-format --branch requires access to the repository
    to resolve refs like @{-1}.
    
    Noticed by Nguyễn Thái Ngọc Duy.
    
    Cc: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 2, 2009
  1. @bebarino @gitster

    t1402: Make test executable

    bebarino committed with gitster
    Signed-off-by: Stephen Boyd <bebarino@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 12, 2009
  1. @gitster

    git check-ref-format --print

    gitster committed
    Tolerating empty path components in ref names means each ref does
    not have a unique name.  This creates difficulty for porcelains
    that want to see if two branches are equal.  Add a helper associating
    to each ref a canonical name.
    
    If a user asks a porcelain to create a ref "refs/heads//master",
    the porcelain can run "git check-ref-format --print refs/heads//master"
    and only deal with "refs/heads/master" from then on.
    
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @jrn @gitster

    Add tests for git check-ref-format

    jrn committed with gitster
    The "git check-ref-format" command is a basic command various
    porcelains rely on.  Test its functionality to make sure it does
    not unintentionally change.
    
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.