1. 12 5月, 2005 3 次提交
    • P
      Stick a comment to update-cache.c:refresh_cache() that you can't · 62d046a0
      Petr Baudis 提交于
      just free(archive_cache[i]) when replacing it there.
      62d046a0
    • I
      [patch] git: fix overflow in update-cache.c · cb1da3a7
      Ingo Molnar 提交于
      this patch fixes a 1-byte overflow in update-cache.c (probably not
      exploitable). A specially crafted db object might trigger this overflow.
      
      the bug is that normally the 'type' field is parsed by read_sha1_file(),
      via:
      
      	if (sscanf(buffer, "%10s %lu", type, size) != 2)
      
      i.e. 0-10 long strings, which take 1-11 bytes of space. Normally the
      type strings are stored in char [20] arrays, but in update-cache.c that
      is char [10], so a 1 byte overflow might occur.
      
      This should not happen with a 'friendly' DB, as the longest type string
      ("commit") is 7 bytes long. The fix is to use the customary char [20].
      
      (someone might want to clean those open-coded constants up with a
      TYPE_LEN define, they do tend to cause problems like this. I'm not
      against open-coded constants (they make code much more readable), but
      for fields that get filled in from possibly hostile objects this is
      playing with fire.)
      
      hey, this might be the first true security fix for GIT? ;-)
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NPetr Baudis <pasky@ucw.cz>
      cb1da3a7
    • P
      Make update-cache be explicit about failed open() when doing · 071c41a0
      Petr Baudis 提交于
      add_file_to_cache().
      071c41a0
  2. 09 5月, 2005 1 次提交
  3. 08 5月, 2005 2 次提交
    • J
      Allow removal of "path" when "path/file" exists. · 4c5abf42
      Junio C Hamano 提交于
      When we used to have "path" as a file or a symlink, but now we
      have "path/file" (or in general, have "path" as a directory), we
      would want to remove "path" before adding "path/file".  The
      logic in add_file_to_cache() only runs lstat() and does not
      detect this case and fails to allow removing it in this case.
      In the opposite case of having "path/file" in the index and
      having "path" on the filesystem as a file or a symlink we do
      allow removal of "path/file", so to be symmetric we should allow
      it as well, without forcing the user to say --force-remove.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      4c5abf42
    • J
      Add git-update-cache --replace option. · 192268c1
      Junio C Hamano 提交于
      When "path" exists as a file or a symlink in the index, an
      attempt to add "path/file" is refused because it results in file
      vs directory conflict.  Similarly when "path/file1",
      "path/file2", etc. exist, an attempt to add "path" as a file or
      a symlink is refused.  With git-update-cache --replace, these
      existing entries that conflict with the entry being added are
      automatically removed from the cache, with warning messages.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      192268c1
  4. 07 5月, 2005 1 次提交
    • L
      Revert bogus optimization that avoids index file writes · ee267527
      Linus Torvalds 提交于
      It didn't properly mark all cache updates as being dirty, and
      causes merge errors due to that. In particular, it didn't notice
      when a file was force-removed.
      
      Besides, it was ugly as hell. I've put in place a slightly cleaner
      version, but I've not enabled the optimization because I don't
      want to be burned again.
      ee267527
  5. 06 5月, 2005 3 次提交
  6. 05 5月, 2005 1 次提交
  7. 02 5月, 2005 4 次提交
    • J
      Implement git-update-cache --force-remove <path> · 0ff5bf7c
      Junio C Hamano 提交于
      This new flag tells git-update-cache to remove the named path even
      when the work tree still happens to have the file.  It is used to
      update git-merge-one-file-script not to smudge the work tree.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      0ff5bf7c
    • J
      Add git-write-blob. · 74400e71
      Junio C Hamano 提交于
      A new command, git-write-blob, is introduced.  This registers
      the contents of any file on the filesystem as a blob in the
      object database and reports its SHA1 to the standard output.
      To implement it, the patch promotes index_fd() from a static
      function in update-cache.c to extern and moves it to a library
      source, sha1_file.c.
      
      This command is used to update git-merge-one-file-script so that
      it does not smudge the work tree.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      74400e71
    • J
      [PATCH] Make git-update-cache --refresh fail if update/merge needed. · 90535218
      Junio C Hamano 提交于
      Scripts may find it useful if they do not have to parse the
      output from the command but just can rely on its exit status.
      
      Earlier both Linus and myself thought this would be necessary to
      make git-prune-script safer but it turns out that the issue was
      somewhere else and not related to what this patch addresses.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      90535218
    • J
      [PATCH] Allow removing files in a subdirectory. · e2a669bb
      Junio C Hamano 提交于
      I found this during a conflict merge testing.  The original did
      not have either DF (a file) or DF/DF (a file DF/DF under a
      directory DF).  One side created DF, the other created DF/DF.  I
      first resolved DF as a new file by taking what the first side
      did.  After that, the entry DF/DF cannot be resolved by running
      git-update-cache --remove although it does not exist on the
      filesystem.
      
          $ /bin/ls -F
          AN  DF  MN  NM  NN  SS  Z/
          $ git-ls-files --stage | grep DF
          100644 71420ab81e254145d26d6fc0cddee64c1acd4787 0 DF
          100644 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 2 DF/DF
          $ git-update-cache --remove DF/DF
          fatal: Unable to add DF/DF to database
      
      It turns out that the errno from open() in this case was not
      ENOENT but ENOTDIR, which the code did not check.  Here is a
      fix.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      e2a669bb
  8. 27 4月, 2005 2 次提交
  9. 25 4月, 2005 1 次提交
  10. 22 4月, 2005 1 次提交
    • L
      Add support for a "GIT_INDEX_FILE" environment variable. · bb233d69
      Linus Torvalds 提交于
      We use that to specify alternative index files, which can be useful
      if you want to (for example) generate a temporary index file to do
      some specific operation that you don't want to mess with your main
      one with.
      
      It defaults to the regular ".git/index" if it hasn't been specified.
      bb233d69
  11. 20 4月, 2005 1 次提交
  12. 19 4月, 2005 1 次提交
  13. 18 4月, 2005 1 次提交
  14. 17 4月, 2005 1 次提交
  15. 16 4月, 2005 3 次提交
  16. 13 4月, 2005 3 次提交
  17. 12 4月, 2005 5 次提交
  18. 11 4月, 2005 1 次提交
  19. 10 4月, 2005 2 次提交
  20. 09 4月, 2005 1 次提交
  21. 08 4月, 2005 2 次提交