1. 13 3月, 2010 1 次提交
  2. 21 1月, 2010 2 次提交
  3. 10 11月, 2009 1 次提交
  4. 29 9月, 2009 1 次提交
  5. 30 7月, 2009 1 次提交
  6. 23 7月, 2009 1 次提交
    • J
      do_one_ref(): null_sha1 check is not about broken ref · eafb4526
      Junio C Hamano 提交于
      f8948e2f (remote prune: warn dangling symrefs, 2009-02-08) introduced a
      more dangerous variant of for_each_ref() family that skips the check for
      dangling refs, but it also made another unrelated check optional by
      mistake.
      
      The check to see if a ref points at 0{40} is not about brokenness, but is
      about a possible future plan to represent a deleted ref by writing 40 "0"
      in a loose ref when there is a stale version of the same ref already in
      .git/packed-refs, so that we can implement deletion of a ref without
      having to rewrite the packed refs file excluding the ref being deleted.
      
      This check has to live outside of the conditional.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      eafb4526
  7. 17 7月, 2009 1 次提交
  8. 28 6月, 2009 1 次提交
  9. 01 6月, 2009 1 次提交
  10. 26 5月, 2009 1 次提交
    • J
      lock_ref: inform callers of unavailable ref · f475e08e
      Jeff King 提交于
      One of the ways that locking might fail is that there is a
      DF conflict between two refs (e.g., you want to lock
      "foo/bar" but "foo" already exists). In this case, we return
      an error, but there is no way for the caller to know the
      specific problem.
      
      This patch sets errno to ENOTDIR, which is the most sensible
      code. It's what we would see if the refs were stored purely
      in the filesystem (but these days we must check the
      namespace manually due to packed refs).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f475e08e
  11. 14 5月, 2009 1 次提交
  12. 09 5月, 2009 1 次提交
  13. 30 4月, 2009 1 次提交
    • A
      replace direct calls to unlink(2) with unlink_or_warn · 691f1a28
      Alex Riesen 提交于
      This helps to notice when something's going wrong, especially on
      systems which lock open files.
      
      I used the following criteria when selecting the code for replacement:
      - it was already printing a warning for the unlink failures
      - it is in a function which already printing something or is
        called from such a function
      - it is in a static function, returning void and the function is only
        called from a builtin main function (cmd_)
      - it is in a function which handles emergency exit (signal handlers)
      - it is in a function which is obvously cleaning up the lockfiles
      Signed-off-by: NAlex Riesen <raa.lkml@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      691f1a28
  14. 14 4月, 2009 1 次提交
  15. 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
  16. 30 3月, 2009 1 次提交
  17. 25 3月, 2009 1 次提交
    • S
      Don't permit ref/branch names to end with ".lock" · 3e262b95
      Shawn O. Pearce 提交于
      We already skip over loose refs under $GIT_DIR/refs if the name
      ends with ".lock", so creating a branch named "foo.lock" will not
      appear in the output of "git branch", "git for-each-ref", nor will
      its commit be considered reachable by "git rev-list --all".
      
      In the latter case this is especially evil, as it may cause
      repository corruption when objects reachable only through such a
      ref are deleted by "git prune".
      
      It should be reasonably safe to deny use of ".lock" as a ref suffix.
      In prior versions of Git such branches would be "phantom branches";
      you can create it, but you can't see it in "git branch" output.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3e262b95
  18. 24 3月, 2009 2 次提交
    • J
      check_ref_format(): tighten refname rules · cbdffe40
      Junio C Hamano 提交于
      This changes the rules for refnames to forbid:
      
       (1) a refname that contains "@{" in it.
      
           Some people and foreign SCM converter may have named their branches
           as frotz@24 and we still want to keep supporting it.
      
           However, "git branch frotz@{24}" is a disaster.  It cannot even
           checked out because "git checkout frotz@{24}" will interpret it as
           "detach the HEAD at twenty-fourth reflog entry of the frotz branch".
      
       (2) a refname that ends with a dot.
      
           We already reject a path component that begins with a dot, primarily
           to avoid ambiguous range interpretation.  If we allowed ".B" as a
           valid ref, it is unclear if "A...B" means "in dot-B but not in A" or
           "either in A or B but not in both".
      
           But for this to be complete, we need also to forbid "A." to avoid "in
           B but not in A-dot".  This was not a problem in the original range
           notation, but we should have added this restriction when three-dot
           notation was introduced.
      
           Unlike "no dot at the beginning of any path component" rule, this
           rule does not have to be "no dot at the end of any path component",
           because you cannot abbreviate the tail end away, similar to you can
           say "dot-B" to mean "refs/heads/dot-B".
      
      For these reasons, it is not likely people created branches with these
      names on purpose, but we have allowed such names to be used for quite some
      time, and it is possible that people created such branches by mistake or
      by accident.
      
      To help people with branches with such unfortunate names to recover,
      we still allow "branch -d 'bad.'" to delete such branches, and also allow
      "branch -m bad. good" to rename them.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cbdffe40
    • M
  19. 10 3月, 2009 1 次提交
  20. 08 3月, 2009 2 次提交
  21. 26 2月, 2009 1 次提交
    • J
      refactor find_ref_by_name() to accept const list · 5483f799
      Jeff King 提交于
      Since it doesn't actually touch its argument, this makes
      sense.
      
      However, we still want to return a non-const version (which
      requires a cast) so that this:
      
        struct ref *a, *b;
        a = find_ref_by_name(b);
      
      works. Unfortunately, you can also silently strip the const
      from a variable:
      
        struct ref *a;
        const struct ref *b;
        a = find_ref_by_name(b);
      
      This is a classic C const problem because there is no way to
      say "return the type with the same constness that was passed
      to us"; we provide the same semantics as standard library
      functions like strchr.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJay Soffian <jaysoffian@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5483f799
  22. 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
  23. 20 1月, 2009 1 次提交
  24. 12 11月, 2008 1 次提交
  25. 06 11月, 2008 1 次提交
  26. 01 11月, 2008 1 次提交
  27. 31 10月, 2008 3 次提交
  28. 27 10月, 2008 2 次提交
  29. 20 10月, 2008 1 次提交
  30. 09 9月, 2008 1 次提交
  31. 09 7月, 2008 2 次提交
    • J
      avoid null SHA1 in oldest reflog · d1a4489a
      Jeff King 提交于
      When the user specifies a ref by a reflog entry older than
      one we have (e.g., "HEAD@{20 years ago"}), we issue a
      warning and give them the "from" value of the oldest reflog
      entry. That is, we say "we don't know what happened before
      this entry, but before this we know we had some particular
      SHA1".
      
      However, the oldest reflog entry is often a creation event
      such as clone or branch creation. In this case, the entry
      claims that the ref went from "00000..." (the null sha1) to
      the new value, and the reflog lookup returns the null sha1.
      
      While this is technically correct (the entry tells us that
      the ref didn't exist at the specified time) it is not
      terribly useful to the end user. What they probably want
      instead is "the oldest useful sha1 that this ref ever had".
      This patch changes the behavior such that if the oldest ref
      would return the null sha1, it instead returns the first
      value the ref ever had.
      
      We never discovered this problem in the test scripts because
      we created "fake" reflogs that had only a specified segment
      of history. This patch updates the tests with a creation
      event at the beginning of history.
      Signed-off-by: NJeff King <peff@peff.net>
      Acked-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d1a4489a
    • J
      make deleting a missing ref more quiet · 0b294c0a
      Jeff King 提交于
      If git attempts to delete a ref, but the unlink of the ref
      file fails, we print a message to stderr. This is usually a
      good thing, but if the error is ENOENT, then it indicates
      that the ref has _already_ been deleted. And since that's
      our goal, it doesn't make sense to complain to the user.
      
      This harmonizes the error reporting behavior for the
      unpacked and packed cases; the packed case already printed
      nothing on ENOENT, but the unpacked printed unconditionally.
      
      Additionally, send-pack would, when deleting the tracking
      ref corresponding to a remote delete, print "Failed to
      delete" on any failure. This can be a misleading
      message, since we actually _did_ delete at the remote side,
      but we failed to delete locally. Rather than make the
      message more precise, let's just eliminate it entirely; the
      delete_ref routine already takes care of printing out a much
      more specific message about what went wrong.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0b294c0a
  32. 05 5月, 2008 1 次提交
  33. 30 4月, 2008 1 次提交