1. 18 8月, 2006 1 次提交
  2. 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
  3. 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
  4. 11 8月, 2006 1 次提交
  5. 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
  6. 11 7月, 2006 1 次提交
  7. 09 7月, 2006 1 次提交
  8. 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
  9. 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
  10. 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
  11. 18 5月, 2006 5 次提交
  12. 15 5月, 2006 1 次提交
  13. 06 5月, 2006 1 次提交
  14. 03 5月, 2006 1 次提交
  15. 10 3月, 2006 1 次提交
  16. 01 3月, 2006 1 次提交
  17. 23 2月, 2006 1 次提交
  18. 20 1月, 2006 1 次提交
  19. 18 12月, 2005 2 次提交
  20. 17 12月, 2005 1 次提交
  21. 16 12月, 2005 2 次提交
  22. 08 12月, 2005 1 次提交
  23. 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
  24. 17 11月, 2005 1 次提交
  25. 16 11月, 2005 1 次提交
  26. 26 10月, 2005 1 次提交
  27. 16 10月, 2005 2 次提交
    • J
      git-check-ref-format: reject funny ref names. · 652d5dc6
      Junio C Hamano 提交于
      Update check_ref_format() function to reject ref names that:
      
       * has a path component that begins with a ".", or
       * has a double dots "..", or
       * has ASCII control character, "~", "^", ":" or SP, anywhere, or
       * ends with a "/".
      
      Use it in 'git-checkout -b', 'git-branch', and 'git-tag' to make sure
      that newly created refs are well-formed.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      652d5dc6
    • J
      git-check-ref-format: reject funny ref names. · 03feddd6
      Junio C Hamano 提交于
      Update check_ref_format() function to reject ref names that:
      
       * has a path component that begins with a ".", or
       * has a double dots "..", or
       * has ASCII control character, "~", "^", ":" or SP, anywhere, or
       * ends with a "/".
      
      Use it in 'git-checkout -b', 'git-branch', and 'git-tag' to make sure
      that newly created refs are well-formed.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      03feddd6
  28. 15 10月, 2005 1 次提交
  29. 06 10月, 2005 1 次提交