1. 18 9月, 2006 1 次提交
    • L
      Start handling references internally as a sorted in-memory list · e1e22e37
      Linus Torvalds 提交于
      This also adds some very rudimentary support for the notion of packed
      refs.  HOWEVER! At this point it isn't used to actually look up a ref
      yet, only for listing them (ie "for_each_ref()" and friends see the
      packed refs, but none of the other single-ref lookup routines).
      
      Note how we keep two separate lists: one for the loose refs, and one for
      the packed refs we read. That's so that we can easily keep the two apart,
      and read only one set or the other (and still always make sure that the
      loose refs take precedence).
      
      [ From this, it's not actually obvious why we'd keep the two separate
        lists, but it's important to have the packed refs on their own list
        later on, when I add support for looking up a single loose one.
      
        For that case, we will want to read _just_ the packed refs in case the
        single-ref lookup fails, yet we may end up needing the other list at
        some point in the future, so keeping them separated is important ]
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      e1e22e37
  2. 02 9月, 2006 1 次提交
    • S
      Replace uses of strdup with xstrdup. · 9befac47
      Shawn Pearce 提交于
      Like xmalloc and xrealloc xstrdup dies with a useful message if
      the native strdup() implementation returns NULL rather than a
      valid pointer.
      
      I just tried to use xstrdup in new code and found it to be missing.
      However I expected it to be present as xmalloc and xrealloc are
      already commonly used throughout the code.
      
      [jc: removed the part that deals with last_XXX, which I am
       finding more and more dubious these days.]
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      9befac47
  3. 28 8月, 2006 1 次提交
  4. 24 8月, 2006 1 次提交
    • S
      Convert memcpy(a,b,20) to hashcpy(a,b). · e702496e
      Shawn Pearce 提交于
      This abstracts away the size of the hash values when copying them
      from memory location to memory location, much as the introduction
      of hashcmp abstracted away hash value comparsion.
      
      A few call sites were using char* rather than unsigned char* so
      I added the cast rather than open hashcpy to be void*.  This is a
      reasonable tradeoff as most call sites already use unsigned char*
      and the existing hashcmp is also declared to be unsigned char*.
      
      [jc: Splitted the patch to "master" part, to be followed by a
       patch for merge-recursive.c which is not in "master" yet.
      
       Fixed the cast in the latter hunk to combine-diff.c which was
       wrong in the original.
      
       Also converted ones left-over in combine-diff.c, diff-lib.c and
       upload-pack.c ]
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      e702496e
  5. 18 8月, 2006 1 次提交
  6. 13 8月, 2006 1 次提交
    • J
      Better error message when we are unable to lock the index file · 40aaae88
      Junio C Hamano 提交于
      Most of the callers except the one in refs.c use the function to
      update the index file.  Among the index writers, everybody
      except write-tree dies if they cannot open it for writing.
      
      This gives the function an extra argument, to tell it to die
      when it cannot create a new file as the lockfile.
      
      The only caller that does not have to die is write-tree, because
      updating the index for the cache-tree part is optional and not
      being able to do so does not affect the correctness.  I think we
      do not have to be so careful and make the failure into die() the
      same way as other callers, but that would be a different patch.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      40aaae88
  7. 12 8月, 2006 1 次提交
    • R
      drop length argument of has_extension · 5bb1cda5
      Rene Scharfe 提交于
      As Fredrik points out the current interface of has_extension() is
      potentially confusing.  Its parameters include both a nul-terminated
      string and a length-limited string.
      
      This patch drops the length argument, requiring two nul-terminated
      strings; all callsites are updated.  I checked that all of them indeed
      provide nul-terminated strings.  Filenames need to be nul-terminated
      anyway if they are to be passed to open() etc.  The performance penalty
      of the additional strlen() is negligible compared to the system calls
      which inevitably surround has_extension() calls.
      
      Additionally, change has_extension() to use size_t inside instead of
      int, as that is the exact type strlen() returns and memcmp() expects.
      Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5bb1cda5
  8. 11 8月, 2006 1 次提交
  9. 29 7月, 2006 1 次提交
    • S
      Display an error from update-ref if target ref name is invalid. · 818f477c
      Shawn Pearce 提交于
      Alex Riesen (raa.lkml@gmail.com) recently observed that git branch
      would fail with no error message due to unexpected situations with
      regards to refs.  For example, if .git/refs/heads/gu is a file but
      "git branch -b refs/heads/gu/fixa HEAD" was invoked by the user
      it would fail silently due to refs/heads/gu being a file and not
      a directory.
      
      This change adds a test for trying to create a ref within a directory
      that is actually currently a file, and adds error printing within
      the ref locking routine should the resolve operation fail.
      
      The error printing code probably belongs at this level of the library
      as other failures within the ref locking, writing and logging code
      are also currently at this level of the code.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      818f477c
  10. 11 7月, 2006 1 次提交
  11. 09 7月, 2006 1 次提交
  12. 10 6月, 2006 1 次提交
    • J
      shared repository - add a few missing calls to adjust_shared_perm(). · 138086a7
      Junio C Hamano 提交于
      There were a few calls to adjust_shared_perm() that were
      missing:
      
       - init-db creates refs, refs/heads, and refs/tags before
         reading from templates that could specify sharedrepository in
         the config file;
      
       - updating config file created it under user's umask without
         adjusting;
      
       - updating refs created it under user's umask without
         adjusting;
      
       - switching branches created .git/HEAD under user's umask
         without adjusting.
      
      This moves adjust_shared_perm() from sha1_file.c to path.c,
      since a few SIMPLE_PROGRAM need to call repository configuration
      functions which in turn need to call adjust_shared_perm().
      sha1_file.c needs to link with SHA1 computation library which
      is usually not linked to SIMPLE_PROGRAM.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      138086a7
  13. 07 6月, 2006 2 次提交
    • J
      ref-log: style fixes. · e5f38ec3
      Junio C Hamano 提交于
      A few style fixes to get the code in line with the rest.
      
       - asterisk to make a type a pointer to something goes in front
         of the variable, not at the end of the base type.
         E.g. a pointer to an integer is "int *ip", not "int* ip".
      
       - open parenthesis for function parameter list, unlike
         syntactic constructs, comes immediately after the function
         name.  E.g. "if (foo) bar();" not "if(foo) bar ();".
      
       - "else" does not come on the same line as the closing brace of
         corresponding "if".
      
      The style is mostly a matter of personal taste, and people may
      disagree, but consistency is important.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      e5f38ec3
    • J
      refs.c: convert it to use lockfile interface. · c33d5174
      Junio C Hamano 提交于
      This updates the ref locking code to use creat-rename locking
      code we use for the index file, so that it can borrow the code
      to clean things up upon signals and program termination.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      c33d5174
  14. 20 5月, 2006 4 次提交
    • S
      Correct force_write bug in refs.c · 8fe92775
      Shawn Pearce 提交于
      My earlier attempt at forcing a write for non-existant refs worked;
      it forced a write for pretty much all refs.  This corrects the
      condition to only force a write for refs which don't exist yet.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      8fe92775
    • S
      Log ref updates made by fetch. · d0740d92
      Shawn Pearce 提交于
      If a ref is changed by http-fetch, local-fetch or ssh-fetch
      record the change and the remote URL/name in the log for the ref.
      This requires loading the config file to check logAllRefUpdates.
      
      Also fixed a bug in the ref lock generation; the log file name was
      not being produced right due to a bad prefix length.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      d0740d92
    • S
      Force writing ref if it doesn't exist. · 732232a1
      Shawn Pearce 提交于
      Normally we try to skip writing a ref if its value hasn't changed
      but in the special case that the ref doesn't exist but the new
      value is going to be 0{40} then force writing the ref anyway.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      732232a1
    • S
      General ref log reading improvements. · e5229042
      Shawn Pearce 提交于
      Corrected the log starting time displayed in the error message
      (as it was always showing the epoch due to a bad input to strtoul).
      
      Improved the log parser so we only scan backwards towards the
      '\n' from the end of the prior log; during this scan the last '>'
      is remembered to improve performance (rather than scanning forward
      to it).
      
      If the log record matched is the last log record in the file only
      use its new sha1 value if the date matches exactly; otherwise we
      leave the passed in sha1 alone as it already contains the current
      value of the ref.  This way lookups of dates later than the log
      end to stick with the current ref value in case the ref was updated
      without logging.
      
      If it looks like someone changed the ref without logging it and we
      are going to return the sha1 which should have been valid during
      the missing period then warn the user that there might be log data
      missing and thus their query result may not be accurate.  The check
      isn't perfect as its just based on comparing the old and new sha1
      values between the two log records but its better than not checking
      at all.
      
      Implemented test cases based on git-rev-parse for most of the
      boundary conditions.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      e5229042
  15. 18 5月, 2006 5 次提交
  16. 15 5月, 2006 1 次提交
  17. 06 5月, 2006 1 次提交
  18. 03 5月, 2006 1 次提交
  19. 10 3月, 2006 1 次提交
  20. 01 3月, 2006 1 次提交
  21. 23 2月, 2006 1 次提交
  22. 20 1月, 2006 1 次提交
  23. 18 12月, 2005 2 次提交
  24. 17 12月, 2005 1 次提交
  25. 16 12月, 2005 2 次提交
  26. 08 12月, 2005 1 次提交
  27. 20 11月, 2005 1 次提交
    • J
      Do not DWIM in userpath library under strict mode. · 0870ca7f
      Junio C Hamano 提交于
      This should force git-daemon administrator's job a bit harder
      because the exact paths need to be given in the whitelist, but
      at the same time makes the auditing easier.
      
      This moves validate_symref() from refs.c to path.c, because we
      need to link path.c with git-daemon for its "enter_repo()", but
      we do not want to link the daemon with the rest of git libraries
      and its requirements.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      0870ca7f
  28. 17 11月, 2005 1 次提交
  29. 16 11月, 2005 1 次提交
  30. 26 10月, 2005 1 次提交