1. 26 11月, 2014 1 次提交
  2. 13 11月, 2014 1 次提交
  3. 28 5月, 2014 1 次提交
  4. 06 12月, 2013 1 次提交
    • C
      replace {pre,suf}fixcmp() with {starts,ends}_with() · 59556548
      Christian Couder 提交于
      Leaving only the function definitions and declarations so that any
      new topic in flight can still make use of the old functions, replace
      existing uses of the prefixcmp() and suffixcmp() with new API
      functions.
      
      The change can be recreated by mechanically applying this:
      
          $ git grep -l -e prefixcmp -e suffixcmp -- \*.c |
            grep -v strbuf\\.c |
            xargs perl -pi -e '
              s|!prefixcmp\(|starts_with\(|g;
              s|prefixcmp\(|!starts_with\(|g;
              s|!suffixcmp\(|ends_with\(|g;
              s|suffixcmp\(|!ends_with\(|g;
            '
      
      on the result of preparatory changes in this series.
      Signed-off-by: NChristian Couder <chriscool@tuxfamily.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      59556548
  5. 03 6月, 2013 2 次提交
  6. 09 11月, 2012 4 次提交
  7. 04 11月, 2012 1 次提交
    • J
      reencode_string(): introduce and use same_encoding() · 0e18bcd5
      Junio C Hamano 提交于
      Callers of reencode_string() that re-encodes a string from one
      encoding to another all used ad-hoc way to bypass the case where the
      input and the output encodings are the same.  Some did strcmp(),
      some did strcasecmp(), yet some others when converting to UTF-8 used
      is_encoding_utf8().
      
      Introduce same_encoding() helper function to make these callers use
      the same logic.  Notably, is_encoding_utf8() has a work-around for
      common misconfiguration to use "utf8" to name UTF-8 encoding, which
      does not match "UTF-8" hence strcasecmp() would not consider the
      same.  Make use of it in this helper function.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0e18bcd5
  8. 18 10月, 2012 1 次提交
  9. 16 9月, 2012 1 次提交
  10. 23 8月, 2011 1 次提交
  11. 30 3月, 2011 3 次提交
  12. 18 11月, 2010 3 次提交
    • J
      git notes merge: Add another auto-resolving strategy: "cat_sort_uniq" · a6a09095
      Johan Herland 提交于
      This new strategy is similar to "concatenate", but in addition to
      concatenating the two note candidates, this strategy sorts the resulting
      lines, and removes duplicate lines from the result. This is equivalent to
      applying the "cat | sort | uniq" shell pipeline to the two note candidates.
      
      This strategy is useful if the notes follow a line-based format where one
      wants to avoid duplicate lines in the merge result.
      
      Note that if either of the note candidates contain duplicate lines _prior_
      to the merge, these will also be removed by this merge strategy.
      
      The patch also contains tests and documentation for the new strategy.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a6a09095
    • J
      notes.c: Use two newlines (instead of one) when concatenating notes · d4990c4b
      Johan Herland 提交于
      When using combine_notes_concatenate() to concatenate notes, it currently
      ensures exactly one newline character between the given notes. However,
      when using builtin/notes.c:create_note() to concatenate notes (e.g. by
      'git notes append'), it adds a newline character to the trailing newline
      of the preceding notes object, thus resulting in _two_ newlines (aka. a
      blank line) separating contents of the two notes.
      
      This patch brings combine_notes_concatenate() into consistency with
      builtin/notes.c:create_note(), by ensuring exactly _two_ newline characters
      between concatenated notes.
      
      The patch also changes a few notes-related selftests accordingly.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d4990c4b
    • J
      notes.h/c: Propagate combine_notes_fn return value to add_note() and beyond · 180619a5
      Johan Herland 提交于
      The combine_notes_fn functions uses a non-zero return value to indicate
      failure. However, this return value was converted to a call to die()
      in note_tree_insert().
      
      Instead, propagate this return value out to add_note(), and return it
      from there to enable the caller to handle errors appropriately.
      
      Existing add_note() callers are updated to die() upon failure, thus
      preserving the current behaviour. The only exceptions are copy_note()
      and notes_cache_put() where we are able to propagate the add_note()
      return value instead.
      
      This patch has been improved by the following contributions:
      - Jonathan Nieder: Future-proof by always checking add_note() return value
      - Jonathan Nieder: Improve clarity of final if-condition in note_tree_insert()
      
      Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      180619a5
  13. 11 11月, 2010 4 次提交
  14. 01 9月, 2010 1 次提交
  15. 06 7月, 2010 1 次提交
  16. 29 6月, 2010 1 次提交
  17. 28 6月, 2010 2 次提交
  18. 20 5月, 2010 1 次提交
  19. 20 3月, 2010 1 次提交
  20. 13 3月, 2010 3 次提交
  21. 25 2月, 2010 1 次提交
  22. 14 2月, 2010 5 次提交
    • J
      Notes API: prune_notes(): Prune notes that belong to non-existing objects · 00fbe636
      Johan Herland 提交于
      When an object is made unreachable by Git, any notes that annotate that object
      are not automagically made unreachable, since all notes are always trivially
      reachable from a notes ref. In order to remove notes for non-existing objects,
      we therefore need to add functionality for traversing the notes tree and
      explicitly removing references to notes that annotate non-reachable objects.
      Thus the notes objects themselves also become unreachable, and are removed
      by a later garbage collect.
      
      prune_notes() performs this traversal (by using for_each_note() internally),
      and removes the notes in question from the notes tree.
      
      Note that the effect of prune_notes() is not persistent unless a subsequent
      call to write_notes_tree() is made.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      00fbe636
    • J
      Teach notes code to properly preserve non-notes in the notes tree · 851c2b37
      Johan Herland 提交于
      The note tree structure allows for non-note entries to coexist with note
      entries in a notes tree. Although we certainly expect there to be very
      few non-notes in a notes tree, we should still support them to a certain
      degree.
      
      This patch teaches the notes code to preserve non-notes when updating the
      notes tree with write_notes_tree(). Non-notes are not affected by fanout
      restructuring.
      
      For non-notes to be handled correctly, we can no longer allow subtree
      entries that do not match the fanout structure produced by the notes code
      itself. This means that fanouts like 4/36, 6/34, 8/32, 4/4/32, etc. are
      no longer recognized as note subtrees; only 2-based fanouts are allowed
      (2/38, 2/2/36, 2/2/2/34, etc.). Since the notes code has never at any point
      _produced_ non-2-based fanouts, it is highly unlikely that this change will
      cause problems for anyone.
      
      The patch also adds some tests verifying the correct handling of non-notes
      in a notes tree.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      851c2b37
    • J
      Refactor notes concatenation into a flexible interface for combining notes · 73f464b5
      Johan Herland 提交于
      When adding a note to an object that already has an existing note, the
      current solution is to concatenate the contents of the two notes. However,
      the caller may instead wish to _overwrite_ the existing note with the new
      note, or maybe even _ignore_ the new note, and keep the existing one. There
      might also be other ways of combining notes that are only known to the
      caller.
      
      Therefore, instead of unconditionally concatenating notes, we let the caller
      specify how to combine notes, by passing in a pointer to a function for
      combining notes. The caller may choose to implement its own function for
      notes combining, but normally one of the following three conveniently
      supplied notes combination functions will be sufficient:
      
      - combine_notes_concatenate() combines the two notes by appending the
        contents of the new note to the contents of the existing note.
      
      - combine_notes_overwrite() replaces the existing note with the new note.
      
      - combine_notes_ignore() keeps the existing note, and ignores the new note.
      
      A combine_notes function can be passed to init_notes() to choose a default
      combine_notes function for that notes tree. If NULL is given, the notes tree
      falls back to combine_notes_concatenate() as the ultimate default.
      
      A combine_notes function can also be passed directly to add_note(), to
      control the notes combining behaviour for a note addition in particular.
      If NULL is passed, the combine_notes function registered for the given
      notes tree is used.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      73f464b5
    • J
      Notes API: Allow multiple concurrent notes trees with new struct notes_tree · cd305392
      Johan Herland 提交于
      The new struct notes_tree encapsulates access to a specific notes tree.
      It is provided to allow callers to make use of several different notes trees
      simultaneously.
      
      A struct notes_tree * parameter is added to every function in the notes API.
      In all cases, NULL can be passed, in which case the fallback "default" notes
      tree (default_notes_tree) is used.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cd305392
    • J
      Notes API: write_notes_tree(): Store the notes tree in the database · 61a7cca0
      Johan Herland 提交于
      Uses for_each_note() to traverse the notes tree, and produces tree
      objects on the fly representing the "on-disk" version of the notes
      tree with appropriate fanout.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      61a7cca0