Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on May 11, 2015
  1. @gitster

    Merge branch 'nd/multiple-work-trees'

    gitster authored
    A replacement for contrib/workdir/git-new-workdir that does not
    rely on symbolic links and make sharing of objects and refs safer
    by making the borrowee and borrowers aware of each other.
    
    * nd/multiple-work-trees: (41 commits)
      prune --worktrees: fix expire vs worktree existence condition
      t1501: fix test with split index
      t2026: fix broken &&-chain
      t2026 needs procondition SANITY
      git-checkout.txt: a note about multiple checkout support for submodules
      checkout: add --ignore-other-wortrees
      checkout: pass whole struct to parse_branchname_arg instead of individual flags
      git-common-dir: make "modules/" per-working-directory directory
      checkout: do not fail if target is an empty directory
      t2025: add a test to make sure grafts is working from a linked checkout
      checkout: don't require a work tree when checking out into a new one
      git_path(): keep "info/sparse-checkout" per work-tree
      count-objects: report unused files in $GIT_DIR/worktrees/...
      gc: support prune --worktrees
      gc: factor out gc.pruneexpire parsing code
      gc: style change -- no SP before closing parenthesis
      checkout: clean up half-prepared directories in --to mode
      checkout: reject if the branch is already checked out elsewhere
      prune: strategies for linked checkouts
      checkout: support checking out into a new working directory
      ...
Commits on Feb 17, 2015
  1. @mhagger @gitster

    refs.h: remove duplication in function docstrings

    mhagger authored gitster committed
    Add more information to the comment introducing the four reference
    transaction update functions, so that each function's docstring
    doesn't have to repeat it. Add a pointer from the individual
    functions' docstrings to the introductory comment.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @mhagger @gitster

    update_ref(): improve documentation

    mhagger authored gitster committed
    Add a docstring for update_ref(), emphasizing its similarity to
    ref_transaction_update(). Rename its parameters to match those of
    ref_transaction_update().
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Reviewed-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @mhagger @gitster

    ref_transaction_verify(): new function to check a reference's value

    mhagger authored gitster committed
    If NULL is passed to ref_transaction_update()'s new_sha1 parameter,
    then just verify old_sha1 (under lock) without trying to change the
    new value of the reference.
    
    Use this functionality to add a new function ref_transaction_verify(),
    which checks the current value of the reference under lock but doesn't
    change it.
    
    Use ref_transaction_verify() in the implementation of "git update-ref
    --stdin"'s "verify" command to avoid the awkward need to "update" the
    reference to its existing value.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Reviewed-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. @mhagger @gitster

    ref_transaction_delete(): remove "have_old" parameter

    mhagger authored gitster committed
    Instead, verify the reference's old value if and only if old_sha1 is
    non-NULL.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Reviewed-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. @mhagger @gitster

    ref_transaction_update(): remove "have_old" parameter

    mhagger authored gitster committed
    Instead, verify the reference's old value if and only if old_sha1 is
    non-NULL.
    
    ref_transaction_delete() will get the same treatment in a moment.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Reviewed-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  6. @mhagger @gitster

    refs.c: change some "flags" to "unsigned int"

    mhagger authored gitster committed
    Change the following functions' "flags" arguments from "int" to
    "unsigned int":
    
     * ref_transaction_update()
     * ref_transaction_create()
     * ref_transaction_delete()
     * update_ref()
     * delete_ref()
     * lock_ref_sha1_basic()
    
    Also change the "flags" member in "struct ref_update" to unsigned.
    
    Suggested-by: Junio C Hamano <gitster@pobox.com>
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 12, 2015
  1. @mhagger @gitster

    refs: move REF_DELETING to refs.c

    mhagger authored gitster committed
    It is only used internally now. Document it a little bit better, too.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Reviewed-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 11, 2015
  1. @gitster

    Merge branch 'mh/reflog-expire'

    gitster authored
    Restructure "reflog expire" to fit the reflogs better with the
    recently updated ref API.
    
    Looked reasonable (except that some shortlog entries stood out like
    a sore thumb).
    
    * mh/reflog-expire: (24 commits)
      refs.c: let fprintf handle the formatting
      refs.c: don't expose the internal struct ref_lock in the header file
      lock_any_ref_for_update(): inline function
      refs.c: remove unlock_ref/close_ref/commit_ref from the refs api
      reflog_expire(): new function in the reference API
      expire_reflog(): treat the policy callback data as opaque
      Move newlog and last_kept_sha1 to "struct expire_reflog_cb"
      expire_reflog(): move rewrite to flags argument
      expire_reflog(): move verbose to flags argument
      expire_reflog(): pass flags through to expire_reflog_ent()
      struct expire_reflog_cb: a new callback data type
      Rename expire_reflog_cb to expire_reflog_policy_cb
      expire_reflog(): move updateref to flags argument
      expire_reflog(): move dry_run to flags argument
      expire_reflog(): add a "flags" argument
      expire_reflog(): extract two policy-related functions
      Extract function should_expire_reflog_ent()
      expire_reflog(): use a lock_file for rewriting the reflog file
      expire_reflog(): return early if the reference has no reflog
      expire_reflog(): rename "ref" parameter to "refname"
      ...
Commits on Dec 22, 2014
  1. @stefanbeller @gitster

    refs.c: don't expose the internal struct ref_lock in the header file

    stefanbeller authored gitster committed
    Now the struct ref_lock is used completely internally, so let's
    remove it from the header file.
    
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @mhagger @gitster

    lock_any_ref_for_update(): inline function

    mhagger authored gitster committed
    Inline the function at its one remaining caller (which is within
    refs.c) and remove it.
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @rsahlberg @gitster

    refs.c: remove unlock_ref/close_ref/commit_ref from the refs api

    rsahlberg authored gitster committed
    unlock|close|commit_ref can be made static since there are no more external
    callers.
    
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. @mhagger @gitster

    reflog_expire(): new function in the reference API

    mhagger authored gitster committed
    Move expire_reflog() into refs.c and rename it to reflog_expire().
    Turn the three policy functions into function pointers that are passed
    into reflog_expire(). Add function prototypes and documentation to
    refs.h.
    
    [jc: squashed in $gmane/261582, drop "extern" in function definition]
    
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Reviewed-by: Stefan Beller <sbeller@google.com>
    Tweaked-by: Ramsay Jones
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 4, 2014
  1. @rsahlberg @gitster

    refs.c: make ref_transaction_delete a wrapper for ref_transaction_update

    rsahlberg authored gitster committed
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 1, 2014
  1. @pclouds @gitster

    git_snpath(): retire and replace with strbuf_git_path()

    pclouds authored gitster committed
    In the previous patch, git_snpath() is modified to allocate a new
    strbuf buffer because vsnpath() needs that. But that makes it
    awkward because git_snpath() receives a pre-allocated buffer from
    outside and has to copy data back. Rename it to strbuf_git_path()
    and make it receive strbuf directly.
    
    Using git_path() in update_refs_for_switch() which used to call
    git_snpath() is safe because that function and all of its callers do
    not keep any pointer to the round-robin buffer pool allocated by
    get_pathname().
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 25, 2014
  1. @mhagger @gitster

    repack_without_refs(): make the refnames argument a string_list

    mhagger authored gitster committed
    Most of the callers have string_lists available already, whereas two
    of them had to read data out of a string_list into an array of strings
    just to call this function. So change repack_without_refs() to take
    the list of refnames to omit as a string_list, and change the callers
    accordingly.
    
    Suggested-by: Ronnie Sahlberg <sahlberg@google.com>
    Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 15, 2014
  1. @rsahlberg @gitster

    refs.c: allow listing and deleting badly named refs

    rsahlberg authored gitster committed
    We currently do not handle badly named refs well:
    
      $ cp .git/refs/heads/master .git/refs/heads/master.....@\*@\\.
      $ git branch
        fatal: Reference has invalid format: 'refs/heads/master.....@*@\.'
      $ git branch -D master.....@\*@\\.
        error: branch 'master.....@*@\.' not found.
    
    Users cannot recover from a badly named ref without manually finding
    and deleting the loose ref file or appropriate line in packed-refs.
    Making that easier will make it easier to tweak the ref naming rules
    in the future, for example to forbid shell metacharacters like '`'
    and '"', without putting people in a state that is hard to get out of.
    
    So allow "branch --list" to show these refs and allow "branch -d/-D"
    and "update-ref -d" to delete them.  Other commands (for example to
    rename refs) will continue to not handle these refs but can be changed
    in later patches.
    
    Details:
    
    In resolving functions, refuse to resolve refs that don't pass the
    git-check-ref-format(1) check unless the new RESOLVE_REF_ALLOW_BAD_NAME
    flag is passed.  Even with RESOLVE_REF_ALLOW_BAD_NAME, refuse to
    resolve refs that escape the refs/ directory and do not match the
    pattern [A-Z_]* (think "HEAD" and "MERGE_HEAD").
    
    In locking functions, refuse to act on badly named refs unless they
    are being deleted and either are in the refs/ directory or match [A-Z_]*.
    
    Just like other invalid refs, flag resolved, badly named refs with the
    REF_ISBROKEN flag, treat them as resolving to null_sha1, and skip them
    in all iteration functions except for for_each_rawref.
    
    Flag badly named refs (but not symrefs pointing to badly named refs)
    with a REF_BAD_NAME flag to make it easier for future callers to
    notice and handle them specially.  For example, in a later patch
    for-each-ref will use this flag to detect refs whose names can confuse
    callers parsing for-each-ref output.
    
    In the transaction API, refuse to create or update badly named refs,
    but allow deleting them (unless they try to escape refs/ and don't match
    [A-Z_]*).
    
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @jrn @gitster

    packed-ref cache: forbid dot-components in refnames

    jrn authored gitster committed
    Since v1.7.9-rc1~10^2 (write_head_info(): handle "extra refs" locally,
    2012-01-06), this trick to keep track of ".have" refs that are only
    valid on the wire and not on the filesystem is not needed any more.
    
    Simplify by removing support for the REFNAME_DOT_COMPONENT flag.
    
    This means we'll be slightly stricter with invalid refs found in a
    packed-refs file or during clone.  read_loose_refs() already checks
    for and skips refnames with .components so it is not affected.
    
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Reviewed-by: Ronnie Sahlberg <sahlberg@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @jrn @gitster

    branch -d: avoid repeated symref resolution

    jrn authored gitster committed
    If a repository gets in a broken state with too much symref nesting,
    it cannot be repaired with "git branch -d":
    
     $ git symbolic-ref refs/heads/nonsense refs/heads/nonsense
     $ git branch -d nonsense
     error: branch 'nonsense' not found.
    
    Worse, "git update-ref --no-deref -d" doesn't work for such repairs
    either:
    
     $ git update-ref -d refs/heads/nonsense
     error: unable to resolve reference refs/heads/nonsense: Too many levels of symbolic links
    
    Fix both by teaching resolve_ref_unsafe a new RESOLVE_REF_NO_RECURSE
    flag and passing it when appropriate.
    
    Callers can still read the value of a symref (for example to print a
    message about it) with that flag set --- resolve_ref_unsafe will
    resolve one level of symrefs and stop there.
    
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Reviewed-by: Ronnie Sahlberg <sahlberg@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. @rsahlberg @gitster

    refs.c: make write_ref_sha1 static

    rsahlberg authored gitster committed
    No external users call write_ref_sha1 any more so let's declare it static.
    
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. @rsahlberg @gitster

    refs.c: ref_transaction_commit: distinguish name conflicts from other…

    rsahlberg authored gitster committed
    … errors
    
    In _commit, ENOTDIR can happen in the call to lock_ref_sha1_basic, either
    when we lstat the new refname or if the name checking function reports that
    the same type of conflict happened.  In both cases, it means that we can not
    create the new ref due to a name conflict.
    
    Start defining specific return codes for _commit.  TRANSACTION_NAME_CONFLICT
    refers to a failure to create a ref due to a name conflict with another ref.
    TRANSACTION_GENERIC_ERROR is for all other errors.
    
    When "git fetch" is creating refs, name conflicts differ from other errors in
    that they are likely to be resolved by running "git remote prune <remote>".
    "git fetch" currently inspects errno to decide whether to give that advice.
    Once it switches to the transaction API, it can check for
    TRANSACTION_NAME_CONFLICT instead.
    
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  6. @rsahlberg @gitster

    refs.c: pass the ref log message to _create/delete/update instead of …

    rsahlberg authored gitster committed
    …_commit
    
    Change the ref transaction API so that we pass the reflog message to the
    create/delete/update functions instead of to ref_transaction_commit.
    This allows different reflog messages for each ref update in a multi-ref
    transaction.
    
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 29, 2014
  1. @gitster

    Merge branch 'da/rev-parse-verify-quiet'

    gitster authored
    "rev-parse --verify --quiet $name" is meant to quietly exit with a
    non-zero status when $name is not a valid object name, but still
    gave error messages in some cases.
    
    * da/rev-parse-verify-quiet:
      stash: prefer --quiet over shell redirection of the standard error stream
      refs: make rev-parse --quiet actually quiet
      t1503: use test_must_be_empty
      Documentation: a note about stdout for git rev-parse --verify --quiet
Commits on Sep 19, 2014
  1. @gitster

    Merge branch 'da/styles'

    gitster authored
    * da/styles:
      stylefix: asterisks stick to the variable, not the type
  2. @davvid @gitster

    refs: make rev-parse --quiet actually quiet

    davvid authored gitster committed
    When a reflog is deleted, e.g. when "git stash" clears its stashes,
    "git rev-parse --verify --quiet" dies:
    
    	fatal: Log for refs/stash is empty.
    
    The reason is that the get_sha1() code path does not allow us
    to suppress this message.
    
    Pass the flags bitfield through get_sha1_with_context() so that
    read_ref_at() can suppress the message.
    
    Use get_sha1_with_context1() instead of get_sha1() in rev-parse
    so that the --quiet flag is honored.
    
    Signed-off-by: David Aguilar <davvid@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 11, 2014
  1. @gitster

    Merge branch 'rs/ref-transaction-1'

    gitster authored
    The second batch of the transactional ref update series.
    
    * rs/ref-transaction-1: (22 commits)
      update-ref --stdin: pass transaction around explicitly
      update-ref --stdin: narrow scope of err strbuf
      refs.c: make delete_ref use a transaction
      refs.c: make prune_ref use a transaction to delete the ref
      refs.c: remove lock_ref_sha1
      refs.c: remove the update_ref_write function
      refs.c: remove the update_ref_lock function
      refs.c: make lock_ref_sha1 static
      walker.c: use ref transaction for ref updates
      fast-import.c: use a ref transaction when dumping tags
      receive-pack.c: use a reference transaction for updating the refs
      refs.c: change update_ref to use a transaction
      branch.c: use ref transaction for all ref updates
      fast-import.c: change update_branch to use ref transactions
      sequencer.c: use ref transactions for all ref updates
      commit.c: use ref transactions for updates
      replace.c: use the ref transaction functions for updates
      tag.c: use ref transactions when doing updates
      refs.c: add transaction.status and track OPEN/CLOSED
      refs.c: make ref_transaction_begin take an err argument
      ...
Commits on Sep 3, 2014
  1. @rsahlberg @gitster

    refs.c: make prune_ref use a transaction to delete the ref

    rsahlberg authored gitster committed
    Change prune_ref to delete the ref using a ref transaction. To do this we also
    need to add a new flag REF_ISPRUNING that will tell the transaction that we
    do not want to delete this ref from the packed refs. This flag is private to
    refs.c and not exposed to external callers.
    
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @rsahlberg @gitster

    refs.c: make lock_ref_sha1 static

    rsahlberg authored gitster committed
    No external callers reference lock_ref_sha1 any more so let's declare it
    static.
    
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @rsahlberg @gitster

    refs.c: make ref_transaction_begin take an err argument

    rsahlberg authored gitster committed
    Add an err argument to _begin so that on non-fatal failures in future ref
    backends we can report a nice error back to the caller.
    While _begin can currently never fail for other reasons than OOM, in which
    case we die() anyway, we may add other types of backends in the future.
    For example, a hypothetical MySQL backend could fail in _begin with
    "Can not connect to MySQL server. No route to host".
    
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. @rsahlberg @gitster

    refs.c: update ref_transaction_delete to check for error and return s…

    rsahlberg authored gitster committed
    …tatus
    
    Change ref_transaction_delete() to do basic error checking and return
    non-zero on error. Update all callers to check the return for
    ref_transaction_delete(). There are currently no conditions in _delete that
    will return error but there will be in the future. Add an err argument that
    will be updated on failure.
    
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. @rsahlberg @gitster

    refs.c: change ref_transaction_create to do error checking and return…

    rsahlberg authored gitster committed
    … status
    
    Do basic error checking in ref_transaction_create() and make it return
    non-zero on error. Update all callers to check the result of
    ref_transaction_create(). There are currently no conditions in _create that
    will return error but there will be in the future. Add an err argument that
    will be updated on failure.
    
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 2, 2014
  1. @davvid @gitster

    stylefix: asterisks stick to the variable, not the type

    davvid authored gitster committed
    Signed-off-by: David Aguilar <davvid@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 21, 2014
  1. @gitster

    Merge branch 'rs/unify-is-branch'

    gitster authored
    * rs/unify-is-branch:
      refs.c: add a public is_branch function
Commits on Jul 16, 2014
  1. @rsahlberg @gitster

    refs.c: add a public is_branch function

    rsahlberg authored gitster committed
    Both refs.c and fsck.c have their own private copies of the is_branch function.
    Delete the is_branch function from fsck.c and make the version in refs.c
    public.
    
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 14, 2014
  1. @rsahlberg @gitster

    refs.c: change ref_transaction_update() to do error checking and retu…

    rsahlberg authored gitster committed
    …rn status
    
    Update ref_transaction_update() do some basic error checking and return
    non-zero on error. Update all callers to check ref_transaction_update() for
    error. There are currently no conditions in _update that will return error but
    there will be in the future. Add an err argument that will be updated on
    failure. In future patches we will start doing both locking and checking
    for name conflicts in _update instead of _commit at which time this function
    will start returning errors for these conditions.
    
    Also check for BUGs during update and die(BUG:...) if we are calling
    _update with have_old but the old_sha1 pointer is NULL.
    
    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Something went wrong with that request. Please try again.