1. 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
  2. 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
  3. 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
  4. 08 7月, 2010 1 次提交
  5. 13 6月, 2010 1 次提交
  6. 03 6月, 2010 1 次提交
  7. 13 3月, 2010 1 次提交
  8. 21 1月, 2010 2 次提交
  9. 10 11月, 2009 1 次提交
  10. 01 6月, 2009 1 次提交
  11. 14 5月, 2009 1 次提交
  12. 14 4月, 2009 1 次提交
  13. 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
  14. 30 3月, 2009 1 次提交
  15. 10 3月, 2009 1 次提交
  16. 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
  17. 20 1月, 2009 1 次提交
  18. 05 5月, 2008 1 次提交
  19. 23 2月, 2008 1 次提交
  20. 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
  21. 16 11月, 2007 1 次提交
  22. 06 9月, 2007 1 次提交
  23. 11 5月, 2007 1 次提交
  24. 11 4月, 2007 1 次提交
  25. 04 2月, 2007 1 次提交
  26. 28 1月, 2007 2 次提交
  27. 20 1月, 2007 1 次提交
    • J
      Extend read_ref_at() to be usable from places other than sha1_name. · 16d7cc90
      Junio C Hamano 提交于
      You can pass an extra argument to the function to receive the
      reflog message information.  Also when the log does not go back
      beyond the point the user asked, the cut-off time and count are
      given back to the caller for emitting the error messages as
      appropriately.
      
      We could later add configuration for get_sha1_basic() to make it
      an error instead of it being just a warning.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      16d7cc90
  28. 09 1月, 2007 1 次提交
    • J
      Sanitize for_each_reflog_ent() · 883d60fa
      Johannes Schindelin 提交于
      It used to ignore the return value of the helper function; now, it
      expects it to return 0, and stops iteration upon non-zero return
      values; this value is then passed on as the return value of
      for_each_reflog_ent().
      
      Further, it makes no sense to force the parsing upon the helper
      functions; for_each_reflog_ent() now calls the helper function with
      old and new sha1, the email, the timestamp & timezone, and the message.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      883d60fa
  29. 21 12月, 2006 1 次提交
  30. 06 12月, 2006 2 次提交
  31. 22 11月, 2006 1 次提交
    • J
      Store peeled refs in packed-refs (take 2). · f4204ab9
      Junio C Hamano 提交于
      This fixes the previous implementation which failed to optimize
      repositories with tons of lightweight tags.  The updated
      packed-refs format begins with "# packed-refs with:" line that
      lists the kind of extended data the file records.  Currently,
      there is only one such extension defined, "peeled".  This stores
      the "peeled tag" on a line that immediately follows a line for a
      tag object itself in the format "^<sha-1>".
      
      The header line itself and any extended data are ignored by
      older implementation, so packed-refs file generated with this
      version can still be used by older git.  packed-refs made by
      older git can of course be used with this version.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      f4204ab9
  32. 20 11月, 2006 1 次提交
  33. 06 10月, 2006 1 次提交
  34. 27 9月, 2006 1 次提交
  35. 21 9月, 2006 2 次提交
    • J
      Tell between packed, unpacked and symbolic refs. · 8da19775
      Junio C Hamano 提交于
      This adds a "int *flag" parameter to resolve_ref() and makes
      for_each_ref() family to call callback function with an extra
      "int flag" parameter.  They are used to give two bits of
      information (REF_ISSYMREF and REF_ISPACKED) about the ref.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      8da19775
    • J
      Add callback data to for_each_ref() family. · cb5d709f
      Junio C Hamano 提交于
      This is a long overdue fix to the API for for_each_ref() family
      of functions.  It allows the callers to specify a callback data
      pointer, so that the caller does not have to use static
      variables to communicate with the callback funciton.
      
      The updated for_each_ref() family takes a function of type
      
      	int (*fn)(const char *, const unsigned char *, void *)
      
      and a void pointer as parameters, and calls the function with
      the name of the ref and its SHA-1 with the caller-supplied void
      pointer as parameters.
      
      The commit updates two callers, builtin-name-rev.c and
      builtin-pack-refs.c as an example.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      cb5d709f
  36. 18 9月, 2006 1 次提交
    • L
      Enable the packed refs file format · 434cd0cd
      Linus Torvalds 提交于
      This actually "turns on" the packed ref file format, now that the
      infrastructure to do so sanely exists (ie notably the change to make the
      reference reading logic take refnames rather than pathnames to the loose
      objects that no longer necessarily even exist).
      
      In particular, when the ref lookup hits a refname that has no loose file
      associated with it, it falls back on the packed-ref information. Also, the
      ref-locking code, while still using a loose file for the locking itself
      (and _creating_ a loose file for the new ref) no longer requires that the
      old ref be in such an unpacked state.
      
      Finally, this does a minimal hack to git-checkout.sh to rather than check
      the ref-file directly, do a "git-rev-parse" on the "heads/$refname".
      That's not really wonderful - we should rather really have a special
      routine to verify the names as proper branch head names, but it is a
      workable solution for now.
      
      With this, I can literally do something like
      
      	git pack-refs
      	find .git/refs -type f -print0 | xargs -0 rm -f --
      
      and the end result is a largely working repository (ie I've done two
      commits - which creates _one_ unpacked ref file - done things like run
      "gitk" and "git log" etc, and it all looks ok).
      
      There are probably things missing, but I'm hoping that the missing things
      are now of the "small and obvious" kind, and that somebody else might want
      to start looking at this too. Hint hint ;)
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      434cd0cd