1. 09 3月, 2013 1 次提交
    • J
      reflog: add for_each_reflog_ent_reverse() API · 98f85ff4
      Junio C Hamano 提交于
      "git checkout -" is a short-hand for "git checkout @{-1}" and the
      "@{nth}" notation for a negative number is to find nth previous
      checkout in the reflog of the HEAD to determine the name of the
      branch the user was on.  We would want to find the nth most recent
      reflog entry that matches "checkout: moving from X to Y" for this.
      
      Unfortunately, reflog is implemented as an append-only file, and the
      API to iterate over its entries, for_each_reflog_ent(), reads the
      file in order, giving the entries from the oldest to newer.  For the
      purpose of finding nth most recent one, this API forces us to record
      the last n entries in a rotating buffer and give the result out only
      after we read everything.  To optimize for a common case of finding
      the nth most recent one for a small value of n, we also have a side
      API for_each_recent_reflog_ent() that starts reading near the end of
      the file, but it still has to read the entries in the "wrong" order.
      The implementation of understanding @{-1} uses this interface.
      
      This all becomes unnecessary if we add an API to let us iterate over
      reflog entries in the reverse order, from the newest to older.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      98f85ff4
  2. 11 4月, 2012 1 次提交
    • M
      refs: store references hierarchically · 432ad41e
      Michael Haggerty 提交于
      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: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      432ad41e
  3. 13 2月, 2012 1 次提交
  4. 18 1月, 2012 1 次提交
  5. 13 12月, 2011 3 次提交
  6. 20 10月, 2011 1 次提交
  7. 17 10月, 2011 1 次提交
  8. 06 10月, 2011 3 次提交
  9. 01 10月, 2011 1 次提交
    • P
      receive-pack: don't pass non-existent refs to post-{receive,update} hooks · 160b81ed
      Pang Yan Han 提交于
      When a push specifies deletion of non-existent refs, the post post-receive and
      post-update hooks receive them as input/arguments.
      
      For instance, for the following push, where refs/heads/nonexistent is a ref
      which does not exist on the remote side:
      
      	git push origin :refs/heads/nonexistent
      
      the post-receive hook receives from standard input:
      
      	<null-sha1> SP <null-sha1> SP refs/heads/nonexistent
      
      and the post-update hook receives as arguments:
      
      	refs/heads/nonexistent
      
      which does not make sense since it is a no-op.
      
      Teach receive-pack not to pass non-existent refs to the post-receive and
      post-update hooks. If the push only attempts to delete non-existent refs,
      these hooks are not even called.
      
      The update and pre-receive hooks are still notified about attempted
      deletion of non-existent refs to give them a chance to inspect the
      situation and act on it.
      
      [jc: mild fix-ups to avoid introducing an extra list; also added fixes to
      some tests]
      Signed-off-by: NPang Yan Han <pangyanhan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      160b81ed
  10. 07 7月, 2011 1 次提交
    • J
      ref namespaces: infrastructure · a1bea2c1
      Josh Triplett 提交于
      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: NJosh Triplett <josh@joshtriplett.org>
      Signed-off-by: NJamey Sharp <jamey@minilop.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a1bea2c1
  11. 06 6月, 2011 1 次提交
    • J
      checkout -b <name>: correctly detect existing branch · c17b2294
      Junio C Hamano 提交于
      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-g02ac9837", and we should
      be able to use that name to refer to the object whose name is 02ac9837.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c17b2294
  12. 08 7月, 2010 1 次提交
  13. 13 6月, 2010 1 次提交
  14. 03 6月, 2010 1 次提交
  15. 13 3月, 2010 1 次提交
  16. 21 1月, 2010 2 次提交
  17. 10 11月, 2009 1 次提交
  18. 01 6月, 2009 1 次提交
  19. 14 5月, 2009 1 次提交
  20. 14 4月, 2009 1 次提交
  21. 08 4月, 2009 1 次提交
    • J
      make get_short_ref a public function · 7c2b3029
      Jeff King 提交于
      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: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7c2b3029
  22. 30 3月, 2009 1 次提交
  23. 10 3月, 2009 1 次提交
  24. 11 2月, 2009 1 次提交
    • J
      remote prune: warn dangling symrefs · f8948e2f
      Junio C Hamano 提交于
      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: NJunio C Hamano <gitster@pobox.com>
      f8948e2f
  25. 20 1月, 2009 1 次提交
  26. 05 5月, 2008 1 次提交
  27. 23 2月, 2008 1 次提交
  28. 02 1月, 2008 1 次提交
    • J
      lock_any_ref_for_update(): reject wildcard return from check_ref_format · 5f7b202a
      Junio C Hamano 提交于
      Recent check_ref_format() returns -3 as well as -1 (general
      error) and -2 (less than two levels).  The caller was explicitly
      checking for -1, to allow "HEAD" but still needed to disallow
      bogus refs.
      
      This introduces symbolic constants for the return values from
      check_ref_format() to make them read better and more
      meaningful.  Normal ref creation codepath can still treat
      non-zero return values as errors.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5f7b202a
  29. 16 11月, 2007 1 次提交
  30. 06 9月, 2007 1 次提交
  31. 11 5月, 2007 1 次提交
  32. 11 4月, 2007 1 次提交
  33. 04 2月, 2007 1 次提交
  34. 28 1月, 2007 2 次提交