1. 07 12月, 2005 1 次提交
    • J
      update-index: allow --index-info to add higher stages. · d23748a6
      Junio C Hamano 提交于
      The new merge world order tells the merge strategies to leave
      the cache unmerged and store the automerge result in the working
      tree if automerge is not clean.  This was done for the resolve
      strategy and recursive strategy when no rename is involved, but
      recording a conflicting merge in the rename case could not
      easily be done by the recursive strategy.
      
      This commit adds a new input format, in addition to the exsting
      two, to "update-index --index-info".
      
          (1) mode         SP sha1          TAB path
          The first format is what "git-apply --index-info"
          reports, and used to reconstruct a partial tree
          that is used for phony merge base tree when falling
          back on 3-way merge.
      
          (2) mode SP type SP sha1          TAB path
          The second format is to stuff git-ls-tree output
          into the index file.
      
          (3) mode         SP sha1 SP stage TAB path
          This format is to put higher order stages into the
          index file and matches git-ls-files --stage output.
      
      To place a higher stage entry to the index, the path should
      first be removed by feeding a mode=0 entry for the path, and
      then feeding necessary input lines in the (3) format.
      
      For example, starting with this index:
      
      $ git ls-files -s
      100644 8a1218a1024a212bb3db30becd860315f9f3ac52 0       frotz
      
      $ git update-index --index-info ;# interactive session -- input follows...
      
      0 0000000000000000000000000000000000000000	frotz
      100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1	frotz
      100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2	frotz
      
      The first line of the input feeds 0 as the mode to remove the
      path; the SHA1 does not matter as long as it is well formatted.
      Then the second and third line feeds stage 1 and stage 2 entries
      for that path.  After the above, we would end up with this:
      
      $ git ls-files -s
      100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1	frotz
      100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2	frotz
      
      This completes the groundwork for the new merge world order.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      d23748a6
  2. 24 11月, 2005 1 次提交
    • J
      Teach update-index to read from ls-tree. · 9c20a470
      Junio C Hamano 提交于
      git-update-index --index-info can almost be usable to read from ls-tree
      output to update the index (and not the working tree file) to HEAD commit,
      but not quite.  It was designed to read from git-apply --index-info
      output, and does not want " blob " in ls-tree output.  Accept that as well.
      
      This lets us update "git-checkout <ent> <path>" that used to filter the
      extra " blob " string out.  Noted by Luben.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      9c20a470
  3. 31 10月, 2005 1 次提交
  4. 26 10月, 2005 1 次提交
  5. 18 10月, 2005 2 次提交
  6. 12 10月, 2005 1 次提交
    • J
      Use core.filemode. · 3e09cdfd
      Junio C Hamano 提交于
      With "[core] filemode = false", you can tell git to ignore
      differences in the working tree file only in executable bit.
      
       * "git-update-index --refresh" does not say "needs update" if index
         entry and working tree file differs only in executable bit.
      
       * "git-update-index" on an existing path takes executable bit
         from the existing index entry, if the path and index entry are
         both regular files.
      
       * "git-diff-files" and "git-diff-index" without --cached flag
         pretend the path on the filesystem has the same executable
         bit as the existing index entry, if the path and index entry
         are both regular files.
      
      If you are on a filesystem with unreliable mode bits, you may need to
      force the executable bit after registering the path in the index.
      
       * "git-update-index --chmod=+x foo" flips the executable bit of the
         index file entry for path "foo" on.  Use "--chmod=-x" to flip it
         off.
      
      Note that --chmod only works in index file and does not look at nor
      update the working tree.
      
      So if you are on a filesystem and do not have working executable bit,
      you would do:
      
       1. set the appropriate .git/config option;
      
       2. "git-update-index --add new-file.c"
      
       3. "git-ls-files --stage new-file.c" to see if it has the desired
         mode bits.  If not, e.g. to drop executable bit picked up from the
         filesystem, say "git-update-index --chmod=-x new-file.c".
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      3e09cdfd
  7. 07 10月, 2005 2 次提交
    • J
      d4dbf36d
    • J
      Show original and resulting blob object info in diff output. · ec1fcc16
      Junio C Hamano 提交于
      This adds more cruft to diff --git header to record the blob SHA1 and
      the mode the patch/diff is intended to be applied against, to help the
      receiving end fall back on a three-way merge.  The new header looks
      like this:
      
          diff --git a/apply.c b/apply.c
          index 7be5041..8366082 100644
          --- a/apply.c
          +++ b/apply.c
          @@ -14,6 +14,7 @@
           //    files that are being modified, but doesn't apply the patch
           //  --stat does just a diffstat, and doesn't actually apply
          +//  --show-index-info shows the old and new index info for...
          ...
      
      Upon receiving such a patch, if the patch did not apply cleanly to the
      target tree, the recipient can try to find the matching old objects in
      her object database and create a temporary tree, apply the patch to
      that temporary tree, and attempt a 3-way merge between the patched
      temporary tree and the target tree using the original temporary tree
      as the common ancestor.
      
      The patch lifts the code to compute the hash for an on-filesystem
      object from update-index.c and makes it available to the diff output
      routine.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      ec1fcc16
  8. 02 10月, 2005 2 次提交
    • L
      [PATCH] Re-instate index file write optimization · 5cd5ace7
      Linus Torvalds 提交于
      This makes "git-update-index" avoid the new index file write if it didn't
      make any changes to the index.
      
      It still doesn't make things like "git status" be read-only operations in
      general, but if the index file doesn't need refreshing, it now will at
      least avoid making unnecessary changes.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5cd5ace7
    • L
      [PATCH] Better error reporting for "git status" · 5d1a5c02
      Linus Torvalds 提交于
      Instead of "git status" ignoring (and hiding) potential errors from the
      "git-update-index" call, make it exit if it fails, and show the error.
      
      In order to do this, use the "-q" flag (to ignore not-up-to-date files)
      and add a new "--unmerged" flag that allows unmerged entries in the index
      without any errors.
      
      This also avoids marking the index "changed" if an entry isn't actually
      modified, and makes sure that we exit with an understandable error message
      if the index is corrupt or unreadable. "read_cache()" no longer returns an
      error for the caller to check.
      
      Finally, make die() and usage() exit with recognizable error codes, if we
      ever want to check the failure reason in scripts.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5d1a5c02
  9. 28 9月, 2005 1 次提交
    • J
      update-index: --stdin and -z · ee1bec3d
      Junio C Hamano 提交于
      The new option --stdin reads list of paths to be updated from the
      standard input.  As usual, -z means the paths are terminated with NUL
      characters, as opposed to LF without that option.
      
      This is useful to use git-diff-files -z and git-ls-files -z when the
      platform xargs does not support -0 option, and obviously saves one
      process even when xargs can take -0.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      ee1bec3d
  10. 25 9月, 2005 1 次提交
  11. 21 9月, 2005 2 次提交
    • J
      Show modified files in git-ls-files · b0391890
      Junio C Hamano 提交于
      Add -m/--modified to show files that have been modified wrt. the index.
      
      [jc: The original came from Brian Gerst on Sep 1st but it only checked
      if the paths were cache dirty without actually checking the files were
      modified.  I also added the usage string and a new test.]
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      b0391890
    • J
      Fast-path 'update-index --refresh' a bit. · 1991b223
      Junio C Hamano 提交于
      If the length in the stat information does not match what is recorded
      in the index, there is no point rehashing the contents to see if the
      index entry can be refreshed.
      
      We need to be a bit careful.  Immediately after read-tree or
      checkout-index without -u, ce_size is set to zero and does not match
      the length of the blob that is recorded, and we need to actually look
      at the contents to see if it has been changed.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      1991b223
  12. 19 9月, 2005 1 次提交
  13. 08 9月, 2005 1 次提交
    • J
      Big tool rename. · 215a7ad1
      Junio C Hamano 提交于
      As promised, this is the "big tool rename" patch.  The primary differences
      since 0.99.6 are:
      
        (1) git-*-script are no more.  The commands installed do not
            have any such suffix so users do not have to remember if
            something is implemented as a shell script or not.
      
        (2) Many command names with 'cache' in them are renamed with
            'index' if that is what they mean.
      
      There are backward compatibility symblic links so that you and
      Porcelains can keep using the old names, but the backward
      compatibility support  is expected to be removed in the near
      future.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      215a7ad1
  14. 02 9月, 2005 1 次提交
    • A
      [PATCH] Explain what went wrong on update-cache of new file · 89bc8c78
      Amos Waterland 提交于
      If somebody tries to run `git update-cache foo', where foo is a new
      file, git dies with a rather cryptic error message:
      
       fatal: Unable to add foo to database
      
      This trivial patch makes git explain what probably went wrong.  It is
      not a perfect diagnosis of all error paths, but for 90% of the cases it
      should provide the user with the clue they need.
      
      [jc: I ended up wording slightly differently, and fixed another
       confusing error message I noticed while reviewing the code.]
      Signed-off-by: NAmos Waterland <apw@rossby.metr.ou.edu>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      89bc8c78
  15. 18 8月, 2005 1 次提交
  16. 09 7月, 2005 3 次提交
  17. 21 6月, 2005 1 次提交
    • L
      Add "-q" flag to git-update-cache · 0ed3715f
      Linus Torvalds 提交于
      It suppresses the "needs update" message for subsequent "--refresh"
      cases (but not other errors).
      
      Will be useful for "git commit". Stay tuned.
      0ed3715f
  18. 06 6月, 2005 1 次提交
  19. 25 5月, 2005 1 次提交
    • L
      git-update-cache: allow dot-files · 320d3a1b
      Linus Torvalds 提交于
      We still refuse to add ".", ".." and ".git".
      
      In theory, you could track another git-repository by allowing ".git",
      but the potential for confusion is just too high.
      320d3a1b
  20. 21 5月, 2005 1 次提交
    • L
      sparse cleanup · e99d59ff
      Linus Torvalds 提交于
      Fix various things that sparse complains about:
       - use NULL instead of 0
       - make sure we declare everything properly, or mark it static
       - use proper function declarations ("fn(void)" instead of "fn()")
      
      Sparse is always right.
      e99d59ff
  21. 20 5月, 2005 2 次提交
  22. 15 5月, 2005 1 次提交
  23. 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
  24. 09 5月, 2005 1 次提交
  25. 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
  26. 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
  27. 06 5月, 2005 3 次提交
  28. 05 5月, 2005 1 次提交