Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Feb 7, 2013
  1. @gitster

    upload/receive-pack: allow hiding ref hierarchies

    gitster authored
    A repository may have refs that are only used for its internal
    bookkeeping purposes that should not be exposed to the others that
    come over the network.
    
    Teach upload-pack to omit some refs from its initial advertisement
    by paying attention to the uploadpack.hiderefs multi-valued
    configuration variable.  Do the same to receive-pack via the
    receive.hiderefs variable.  As a convenient short-hand, allow using
    transfer.hiderefs to set the value to both of these variables.
    
    Any ref that is under the hierarchies listed on the value of these
    variable is excluded from responses to requests made by "ls-remote",
    "fetch", etc. (for upload-pack) and "push" (for receive-pack).
    
    Because these hidden refs do not count as OUR_REF, an attempt to
    fetch objects at the tip of them will be rejected, and because these
    refs do not get advertised, "git push :" will not see local branches
    that have the same name as them as "matching" ones to be sent.
    
    An attempt to update/delete these hidden refs with an explicit
    refspec, e.g. "git push origin :refs/hidden/22", is rejected.  This
    is not a new restriction.  To the pusher, it would appear that there
    is no such ref, so its push request will conclude with "Now that I
    sent you all the data, it is time for you to update the refs.  I saw
    that the ref did not exist when I started pushing, and I want the
    result to point at this commit".  The receiving end will apply the
    compare-and-swap rule to this request and rejects the push with
    "Well, your update request conflicts with somebody else; I see there
    is such a ref.", which is the right thing to do. Otherwise a push to
    a hidden ref will always be "the last one wins", which is not a good
    default.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 10, 2012
  1. @mhagger @gitster

    refs: store references hierarchically

    mhagger authored gitster committed
    Store references hierarchically in a tree that matches the
    pseudo-directory structure of the reference names.  Add a new kind of
    ref_entry (with flag REF_DIR) to represent a whole subdirectory of
    references.  Sort ref_dirs one subdirectory at a time.
    
    NOTE: the dirs can now be sorted as a side-effect of other function
    calls.  Therefore, it would be problematic to do something from a
    each_ref_fn callback that could provoke the sorting of a directory
    that is currently being iterated over (i.e., the directory containing
    the entry that is being processed or any of its parents).
    
    This is a bit far-fetched, because a directory is always sorted just
    before being iterated over.  Therefore, read-only accesses cannot
    trigger the sorting of a directory whose iteration has already
    started.  But if a callback function would add a reference to a parent
    directory of the reference in the iteration, then try to resolve a
    reference under that directory, a re-sort could be triggered and cause
    the iteration to work incorrectly.
    
    Nevertheless...add a comment in refs.h warning against modifications
    during iteration.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 13, 2012
  1. @mhagger @gitster

    refs: remove the extra_refs API

    mhagger authored gitster committed
    The extra_refs provided a kludgy way to create fake references at a
    global level in the hope that they would only affect some particular
    code path.  The last user of this API been rewritten, so strip this
    stuff out before somebody else gets the bad idea of using it.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 17, 2012
  1. @mhagger @gitster

    add_packed_ref(): new function in the refs API.

    mhagger authored gitster committed
    Add a new function add_packed_ref() that adds a reference directly to
    the in-memory packed reference cache.  This will be useful for
    creating local references while cloning.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 12, 2011
  1. @mhagger @gitster

    resolve_gitlink_ref(): improve docstring

    mhagger authored gitster committed
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @mhagger @gitster

    refs: rename parameters result -> sha1

    mhagger authored gitster committed
    Try consistently to use the name "sha1" for parameters to which a SHA1
    will be stored.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @mhagger @gitster

    refs: rename "refname" variables

    mhagger authored gitster committed
    Try to consistently use the variable name "refname" when referring to
    a string that names a reference.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 21, 2011
  1. @gitster

    Merge branch 'jc/broken-ref-dwim-fix'

    gitster authored
    * jc/broken-ref-dwim-fix:
      resolve_ref(): report breakage to the caller without warning
      resolve_ref(): expose REF_ISBROKEN flag
      refs.c: move dwim_ref()/dwim_log() from sha1_name.c
Commits on Oct 19, 2011
  1. @gitster

    resolve_ref(): expose REF_ISBROKEN flag

    gitster authored
    Instead of keeping this as an internal API, let the callers find
    out the reason why resolve_ref() returned NULL is not because there
    was no such file in $GIT_DIR but because a file was corrupt.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 17, 2011
  1. @mhagger @gitster

    invalidate_ref_cache(): expose this function in the refs API

    mhagger authored gitster committed
    Make invalidate_ref_cache() an official part of the refs API.  It is
    currently a fact of life that code outside of refs.c mucks about with
    references.  This change gives such code a way of informing the refs
    module that it should no longer trust its cache.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 10, 2011
  1. @gitster

    Merge branch 'jp/get-ref-dir-unsorted'

    gitster authored
    * jp/get-ref-dir-unsorted:
      refs.c: free duplicate entries in the ref array instead of leaking them
      refs.c: abort ref search if ref array is empty
      refs.c: ensure struct whose member may be passed to realloc is initialized
      refs: Use binary search to lookup refs faster
      Don't sort ref_list too early
    
    Conflicts:
    	refs.c
Commits on Oct 5, 2011
  1. @mhagger @gitster

    add_ref(): verify that the refname is formatted correctly

    mhagger authored gitster committed
    In add_ref(), verify that the refname is formatted correctly before
    adding it to the ref_list.  Here we have to allow refname components
    that start with ".", since (for example) the remote protocol uses
    synthetic reference name ".have".  So add a new REFNAME_DOT_COMPONENT
    flag that can be passed to check_refname_format() to allow leading
    dots.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @mhagger @gitster

    Change check_refname_format() to reject unnormalized refnames

    mhagger authored gitster committed
    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>
  3. @mhagger @gitster

    Change check_ref_format() to take a flags argument

    mhagger authored gitster committed
    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>
Commits on Aug 18, 2011
  1. @gitster

    Merge branch 'js/ref-namespaces'

    gitster authored
    * js/ref-namespaces:
      ref namespaces: tests
      ref namespaces: documentation
      ref namespaces: Support remote repositories via upload-pack and receive-pack
      ref namespaces: infrastructure
      Fix prefix handling in ref iteration functions
Commits on Jul 6, 2011
  1. @joshtriplett @gitster

    ref namespaces: infrastructure

    joshtriplett authored gitster committed
    Add support for dividing the refs of a single repository into multiple
    namespaces, each of which can have its own branches, tags, and HEAD.
    Git can expose each namespace as an independent repository to pull from
    and push to, while sharing the object store, and exposing all the refs
    to operations such as git-gc.
    
    Storing multiple repositories as namespaces of a single repository
    avoids storing duplicate copies of the same objects, such as when
    storing multiple branches of the same source.  The alternates mechanism
    provides similar support for avoiding duplicates, but alternates do not
    prevent duplication between new objects added to the repositories
    without ongoing maintenance, while namespaces do.
    
    To specify a namespace, set the GIT_NAMESPACE environment variable to
    the namespace.  For each ref namespace, git stores the corresponding
    refs in a directory under refs/namespaces/.  For example,
    GIT_NAMESPACE=foo will store refs under refs/namespaces/foo/.  You can
    also specify namespaces via the --namespace option to git.
    
    Note that namespaces which include a / will expand to a hierarchy of
    namespaces; for example, GIT_NAMESPACE=foo/bar will store refs under
    refs/namespaces/foo/refs/namespaces/bar/.  This makes paths in
    GIT_NAMESPACE behave hierarchically, so that cloning with
    GIT_NAMESPACE=foo/bar produces the same result as cloning with
    GIT_NAMESPACE=foo and cloning from that repo with GIT_NAMESPACE=bar.  It
    also avoids ambiguity with strange namespace paths such as
    foo/refs/heads/, which could otherwise generate directory/file conflicts
    within the refs directory.
    
    Add the infrastructure for ref namespaces: handle the GIT_NAMESPACE
    environment variable and --namespace option, and support iterating over
    refs in a namespace.
    
    Signed-off-by: Josh Triplett <josh@joshtriplett.org>
    Signed-off-by: Jamey Sharp <jamey@minilop.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 30, 2011
  1. @gitster

    Merge branch 'jc/maint-1.7.3-checkout-describe'

    gitster authored
    * jc/maint-1.7.3-checkout-describe:
      checkout -b <name>: correctly detect existing branch
Commits on Jun 6, 2011
  1. @gitster

    checkout -b <name>: correctly detect existing branch

    gitster authored
    When create a new branch, we fed "refs/heads/<proposed name>" as a string
    to get_sha1() and expected it to fail when a branch already exists.
    
    The right way to check if a ref exists is to check with resolve_ref().
    
    A naïve solution that might appear attractive but does not work is to
    forbid slashes in get_describe_name() but that will not work. A describe
    name is is in the form of "ANYTHING-g<short sha1>", and that ANYTHING part
    comes from a original tag name used in the repository the user ran the
    describe command. A sick user could have a confusing hierarchical tag
    whose name is "refs/heads/foobar" (stored as refs/tags/refs/heads/foobar")
    to generate a describe name "refs/heads/foobar-6-g02ac983", and we should
    be able to use that name to refer to the object whose name is 02ac983.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 7, 2010
  1. @gitster

    setup_revisions(): Allow walking history in a submodule

    Heiko Voigt authored gitster committed
    By passing the path to a submodule in opt->submodule, the function can
    be used to walk history in the named submodule repository, instead of
    the toplevel repository.
    
    Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 12, 2010
  1. @trast @gitster

    log_ref_setup: don't return stack-allocated array

    trast authored gitster committed
    859c301 (refs: split log_ref_write logic into log_ref_setup,
    2010-05-21) refactors the stack allocation of the log_file array into
    the new log_ref_setup() function, but passes it back to the caller.
    
    Since the original intent seems to have been to split the work between
    log_ref_setup and log_ref_write, make it the caller's responsibility
    to allocate the buffer.
    
    Signed-off-by: Thomas Rast <trast@student.ethz.ch>
    Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 2, 2010
  1. @erickmattos @gitster

    refs: split log_ref_write logic into log_ref_setup

    erickmattos authored gitster committed
    Separation of the logic for testing and preparing the reflogs from
    function log_ref_write to a new non static new function: log_ref_setup.
    
    This allows to be performed from outside the first all reasonable checks
    and procedures for writing reflogs.
    
    Signed-off-by: Erick Mattos <erick.mattos@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 13, 2010
  1. @trast @gitster

    Support showing notes from more than one notes tree

    trast authored gitster committed
    With this patch, you can set notes.displayRef to a glob that points at
    your favourite notes refs, e.g.,
    
    [notes]
    	displayRef = refs/notes/*
    
    Then git-log and friends will show notes from all trees.
    
    Thanks to Junio C Hamano for lots of feedback, which greatly
    influenced the design of the entire series and this commit in
    particular.
    
    Signed-off-by: Thomas Rast <trast@student.ethz.ch>
    Acked-by: Johan Herland <johan@herland.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 20, 2010
  1. @gitster

    rev-parse --branches/--tags/--remotes=pattern

    Ilari Liusvaara authored gitster committed
    Since local branch, tags and remote tracking branch namespaces are
    most often used, add shortcut notations for globbing those in
    manner similar to --glob option.
    
    With this, one can express the "what I have but origin doesn't?"
    as:
    
    'git log --branches --not --remotes=origin'
    
    Original-idea-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    rev-parse --glob

    Ilari Liusvaara authored gitster committed
    Add --glob=<glob-pattern> option to rev-parse and everything that
    accepts its options. This option matches all refs that match given
    shell glob pattern (complete with some DWIM logic).
    
    Example:
    
    'git log --branches --not --glob=remotes/origin'
    
    To show what you have that origin doesn't.
    
    Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 10, 2009
  1. @jaysoffian @gitster

    teach warn_dangling_symref to take a FILE argument

    jaysoffian authored gitster committed
    Different callers of warn_dangling_symref() may want to control whether its
    output goes to stdout or stderr so let it take a FILE argument.
    
    Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 1, 2009
  1. @chriscool @gitster

    refs: add a "for_each_replace_ref" function

    chriscool authored gitster committed
    This is some preparation work for the following patches that are using
    the "refs/replace/" ref namespace.
    
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 14, 2009
  1. @felipec @gitster

    Change prettify_ref to prettify_refname

    felipec authored gitster committed
    In preparation to be used when the ref object is not available
    
    Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
    Acked-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 13, 2009
  1. @bertwesarg @gitster

    shorten_unambiguous_ref(): add strict mode

    bertwesarg authored gitster committed
    Add the strict mode of abbreviation to shorten_unambiguous_ref(), i.e. the
    resulting ref won't trigger the ambiguous ref warning.
    
    All users of shorten_unambiguous_ref() still use the loose mode.
    
    Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 12, 2009
  1. @gitster

    Merge branch 'jk/show-upstream'

    gitster authored
    * jk/show-upstream:
      branch: show upstream branch when double verbose
      make get_short_ref a public function
      for-each-ref: add "upstream" format field
      for-each-ref: refactor refname handling
      for-each-ref: refactor get_short_ref function
Commits on Apr 8, 2009
  1. @peff @gitster

    make get_short_ref a public function

    peff authored gitster committed
    Often we want to shorten a full ref name to something "prettier"
    to show a user. For example, "refs/heads/master" is often shown
    simply as "master", or "refs/remotes/origin/master" is shown as
    "origin/master".
    
    Many places in the code use a very simple formula: skip common
    prefixes like refs/heads, refs/remotes, etc. This is codified in
    the prettify_ref function.
    
    for-each-ref has a more correct (but more expensive) approach:
    consider the ref lookup rules, and try shortening as much as
    possible while remaining unambiguous.
    
    This patch makes the latter strategy globally available as
    shorten_unambiguous_ref.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 5, 2009
  1. @gitster

    Merge branch 'cc/sha1-bsearch' into HEAD

    gitster authored
    * cc/sha1-bsearch: (95 commits)
      patch-ids: use the new generic "sha1_pos" function to lookup sha1
      sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1
      Update draft release notes to 1.6.3
      GIT 1.6.2.2
      send-email: ensure quoted addresses are rfc2047 encoded
      send-email: correct two tests which were going interactive
      Documentation: git-svn: fix trunk/fetch svn-remote key typo
      Mailmap: Allow empty email addresses to be mapped
      Cleanup warning about known issues in cvsimport documentation
      Documentation: Remove an odd "instead"
      send-email: ask_default should apply to all emails, not just the first
      send-email: don't attempt to prompt if tty is closed
      fix portability problem with IS_RUN_COMMAND_ERR
      Documentation: use "spurious .sp" XSLT if DOCBOOK_SUPPRESS_SP is set
      mailmap: resurrect lower-casing of email addresses
      builtin-clone.c: no need to strdup for setenv
      builtin-clone.c: make junk_pid static
      git-svn: add a double quiet option to hide git commits
      Update draft release notes to 1.6.2.2
      Documentation: push.default applies to all remotes
      ...
Commits on Mar 30, 2009
  1. @chriscool @gitster

    refs: add "for_each_ref_in" function to refactor "for_each_*_ref" fun…

    chriscool authored gitster committed
    …ctions
    
    The "for_each_{tag,branch,remote,replace,}_ref" functions are
    redefined in terms of "for_each_ref_in" so that we can lose the
    hardcoded length of prefix strings from the code.
    
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Commits on Mar 9, 2009
  1. @gitster

    Use a common function to get the pretty name of refs

    Daniel Barkalow authored gitster committed
    The result should be consistent between fetch and push, so we ought to
    use the same code in both cases, even though it's short.
    
    Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 11, 2009
  1. @gitster

    remote prune: warn dangling symrefs

    gitster authored
    If you prune from the remote "frotz" that deleted the ref your tracking
    branch remotes/frotz/HEAD points at, the symbolic ref will become
    dangling.  We used to detect this as an error condition and issued a
    message every time refs are enumerated.
    
    This stops the error message, but moves the warning to "remote prune".
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 20, 2009
  1. @gitster

    Introduce for_each_recent_reflog_ent().

    gitster authored
    This can be used to scan only the last few kilobytes of a reflog, as a
    cheap optimization when the data you are looking for is likely to be
    found near the end of it.  The caller is expected to fall back to the
    full scan if that is not the case.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.