1. 17 7月, 2009 1 次提交
    • B
      sha1_name.c: avoid unnecessary strbuf_release · b45a09c4
      Brandon Casey 提交于
      When we fall back to a standard for_each_reflog_ent() after failing to find
      the nth branch switch (or if we had a short reflog) with the call to
      for_each_recent_reflog_ent(), we do not need to free the memory allocated
      for our strbuf's since a strbuf_reset() will be performed in
      grab_nth_branch_switch() before assigning to the entry.
      
      Plus, the strbuf_release() negates the non-zero hint we initially gave to
      strbuf_init() just above these lines.
      Signed-off-by: NBrandon Casey <drafnel@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b45a09c4
  2. 23 3月, 2009 1 次提交
    • J
      Rename interpret/substitute nth_last_branch functions · 431b1969
      Junio C Hamano 提交于
      These allow you to say "git checkout @{-2}" to switch to the branch two
      "branch switching" ago by pretending as if you typed the name of that
      branch.  As it is likely that we will be introducing more short-hands to
      write the name of a branch without writing it explicitly, rename the
      functions from "nth_last_branch" to more generic "branch_name", to prepare
      for different semantics.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      431b1969
  3. 12 2月, 2009 1 次提交
  4. 11 2月, 2009 1 次提交
  5. 28 1月, 2009 1 次提交
  6. 21 1月, 2009 1 次提交
  7. 20 1月, 2009 5 次提交
  8. 18 1月, 2009 3 次提交
  9. 27 10月, 2008 1 次提交
  10. 22 8月, 2008 1 次提交
    • S
      Make reflog query '@{1219188291}' act as '@{2008.8.19.16:24:51.-0700}' · ea360dd0
      Shawn O. Pearce 提交于
      As we support seconds-since-epoch in $GIT_COMMITTER_TIME we should
      also support it in a reflog @{...} style notation.  We can easily
      tell this part from @{nth} style notation by looking to see if the
      value is unreasonably large for an @{nth} style notation.
      
      The value 100000000 was chosen as it is already used by date.c to
      disambiguate yyyymmdd format from a seconds-since-epoch time value.
      
      A reflog with 100,000,000 record entries is also simply not valid.
      Such a reflog would require at least 7.7 GB to store just the old
      and new SHA-1 values.  So our randomly chosen upper limit for @{nth}
      notation is "big enough".
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ea360dd0
  11. 24 7月, 2008 1 次提交
    • J
      ignore non-existent refs in dwim_log() · 0c4cd7f4
      Junio C Hamano 提交于
      f2eba66d (Enable HEAD@{...} and make it independent from the current
      branch, 2007-02-03) introduced dwim_log() to handle <refname>@{...}
      syntax, and as part of its processing, it checks if the ref exists by
      calling refsolve_ref().  It should call it as a reader to make sure the
      call returns NULL for a nonexistent ref (not as a potential writer in
      which case it does not return NULL).
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0c4cd7f4
  12. 30 4月, 2008 1 次提交
    • J
      fix reflog approxidate parsing bug · 861f00e3
      Jeff King 提交于
      In get_sha1_basic, we parse a string like
      
        HEAD@{10 seconds ago}:path/to/file
      
      into its constituent ref, reflog date, and path components.
      We never actually munge the string itself, but instead keep
      offsets into the string with their associated lengths.
      
      When we call approxidate on the contents inside braces,
      however, we pass just a string without a length. This means
      that approxidate could sometimes look past the closing brace
      and (erroneously) interpret the rest of the string as part
      of the date.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      861f00e3
  13. 15 3月, 2008 1 次提交
    • L
      rev-parse: fix meaning of rev~ vs rev~0. · 621ff675
      Linus Torvalds 提交于
      I think it would make more sense for rev~ to have the same guarantees that
      rev^ has, namely to always return a commit. I would also suggest that not
      giving a number would have the same effect of defaulting to 1, not 0.
      
      Right now it's a bit illogical, but at least it's an _undocumented_
      illogical behaviour.
      
      This patch makes '^' and '~' act the same for the default count (i.e. both
      default to 1), and also have the same behaviour for a count of zero.
      
      Before (no discernible pattern):
      
      	[torvalds@woody git]$ git rev-parse v1.5.1 v1.5.1^0 v1.5.1~0 v1.5.1^ v1.5.1~
      	45354a57ee7e3e42c7137db6c94fa968c6babe8d
      	89815cab
      	45354a57ee7e3e42c7137db6c94fa968c6babe8d
      	045f5759
      	45354a57ee7e3e42c7137db6c94fa968c6babe8d
      
      After (fairly logical):
      
      	[torvalds@woody git]$ git rev-parse v1.5.1 v1.5.1^0 v1.5.1~0 v1.5.1^ v1.5.1~
      	45354a57ee7e3e42c7137db6c94fa968c6babe8d
      	89815cab
      	89815cab
      	045f5759
      	045f5759Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      621ff675
  14. 02 3月, 2008 1 次提交
    • J
      find_unique_abbrev(): redefine semantics · b66fde9a
      Junio C Hamano 提交于
      The function returned NULL when no object that matches the name
      was found, but that made the callers more complicated, as nobody
      used that NULL return as an indication that no object with such
      a name exists.  They (at least the careful ones) instead took
      the full 40-hexdigit and used in such a case, and the careless
      ones segfaulted.
      
      With this "git rev-parse --short 5555555555555555555555555555555555555555"
      would stop segfaulting.
      
      This is based on Jeff King's rewrite to my RFC patch, but "missing"
      logic swapped to "exists".  The final logic reads:
      
          For existing objects, make sure the abbreviated string uniquely
          identifies it.  Otherwise, make sure the abbreviated string is
          long enough so that it would not name any existing object.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b66fde9a
  15. 23 2月, 2008 1 次提交
    • J
      Avoid unnecessary "if-before-free" tests. · 8e0f7003
      Jim Meyering 提交于
      This change removes all obvious useless if-before-free tests.
      E.g., it replaces code like this:
      
              if (some_expression)
                      free (some_expression);
      
      with the now-equivalent:
      
              free (some_expression);
      
      It is equivalent not just because POSIX has required free(NULL)
      to work for a long time, but simply because it has worked for
      so long that no reasonable porting target fails the test.
      Here's some evidence from nearly 1.5 years ago:
      
          http://www.winehq.org/pipermail/wine-patches/2006-October/031544.html
      
      FYI, the change below was prepared by running the following:
      
        git ls-files -z | xargs -0 \
        perl -0x3b -pi -e \
          's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+(free\s*\(\s*\1\s*\))/$2/s'
      
      Note however, that it doesn't handle brace-enclosed blocks like
      "if (x) { free (x); }".  But that's ok, since there were none like
      that in git sources.
      
      Beware: if you do use the above snippet, note that it can
      produce syntactically invalid C code.  That happens when the
      affected "if"-statement has a matching "else".
      E.g., it would transform this
      
        if (x)
          free (x);
        else
          foo ();
      
      into this:
      
        free (x);
        else
          foo ();
      
      There were none of those here, either.
      
      If you're interested in automating detection of the useless
      tests, you might like the useless-if-before-free script in gnulib:
      [it *does* detect brace-enclosed free statements, and has a --name=S
       option to make it detect free-like functions with different names]
      
        http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=build-aux/useless-if-before-free
      
      Addendum:
        Remove one more (in imap-send.c), spotted by Jean-Luc Herren <jlh@gmx.ch>.
      Signed-off-by: NJim Meyering <meyering@redhat.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8e0f7003
  16. 19 2月, 2008 2 次提交
  17. 18 2月, 2008 2 次提交
  18. 22 1月, 2008 1 次提交
    • L
      Make on-disk index representation separate from in-core one · 7a51ed66
      Linus Torvalds 提交于
      This converts the index explicitly on read and write to its on-disk
      format, allowing the in-core format to contain more flags, and be
      simpler.
      
      In particular, the in-core format is now host-endian (as opposed to the
      on-disk one that is network endian in order to be able to be shared
      across machines) and as a result we can dispense with all the
      htonl/ntohl on accesses to the cache_entry fields.
      
      This will make it easier to make use of various temporary flags that do
      not exist in the on-disk format.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7a51ed66
  19. 04 12月, 2007 1 次提交
  20. 19 11月, 2007 1 次提交
    • S
      add refname_match() · 79803322
      Steffen Prohaska 提交于
      We use at least two rulesets for matching abbreviated refnames with
      full refnames (starting with 'refs/').  git-rev-parse and git-fetch
      use slightly different rules.
      
      This commit introduces a new function refname_match
      (const char *abbrev_name, const char *full_name, const char **rules).
      
      abbrev_name is expanded using the rules and matched against full_name.
      If a match is found the function returns true.  rules is a NULL-terminate
      list of format patterns with "%.*s", for example:
      
          const char *ref_rev_parse_rules[] = {
                     "%.*s",
                     "refs/%.*s",
                     "refs/tags/%.*s",
                     "refs/heads/%.*s",
                     "refs/remotes/%.*s",
                     "refs/remotes/%.*s/HEAD",
                     NULL
          };
      
      Asterisks are included in the format strings because this is the form
      required in sha1_name.c.  Sharing the list with the functions there is
      a good idea to avoid duplicating the rules.  Hopefully this
      facilitates unified matching rules in the future.
      
      This commit makes the rules used by rev-parse for resolving refs to
      sha1s available for string comparison.  Before this change, the rules
      were buried in get_sha1*() and dwim_ref().
      
      A follow-up commit will refactor the rules used by fetch.
      
      refname_match() will be used for matching refspecs in git-send-pack.
      
      Thanks to Daniel Barkalow <barkalow@iabervon.org> for pointing
      out that ref_matches_abbrev in remote.c solves a similar problem
      and care should be taken to avoid confusion.
      Signed-off-by: NSteffen Prohaska <prohaska@zib.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      79803322
  21. 14 7月, 2007 1 次提交
  22. 08 6月, 2007 1 次提交
  23. 30 5月, 2007 1 次提交
  24. 27 5月, 2007 1 次提交
    • S
      Attempt to delay prepare_alt_odb during get_sha1 · 693d2bc6
      Shawn O. Pearce 提交于
      Not every input value passed to get_sha1 is an abbreviated SHA-1.
      Its actually quite common for refs to be passed and for those
      refs to resolve to full SHA-1s, in which case we may not need to
      initialize the alternate object database list in this process.
      
      I'm relocating the call to prepare_alt_odb closer to the code
      that actually needs it to maintain the fix first introduced by
      Junio in 99a19b43 (to avoid ambiguous SHA-1 abbreviations from
      being accepted).  This allows us to avoid the alt_odb list setup
      if we won't actually need it.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      693d2bc6
  25. 24 4月, 2007 1 次提交
  26. 11 4月, 2007 1 次提交
    • N
      get rid of num_packed_objects() · 57059091
      Nicolas Pitre 提交于
      The coming index format change doesn't allow for the number of objects
      to be determined from the size of the index file directly.  Instead, Let's
      initialize a field in the packed_git structure with the object count when
      the index is validated since the count is always known at that point.
      
      While at it let's reorder some struct packed_git fields to avoid padding
      due to needed 64-bit alignment for some of them.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      57059091
  27. 06 4月, 2007 1 次提交
  28. 13 3月, 2007 1 次提交
  29. 12 3月, 2007 1 次提交
  30. 08 3月, 2007 1 次提交
  31. 24 2月, 2007 1 次提交
  32. 09 2月, 2007 1 次提交