1. 01 7月, 2017 12 次提交
    • S
      diff.c: migrate emit_line_checked to use emit_diff_symbol · 091f8e28
      Stefan Beller 提交于
      Add a new flags field to emit_diff_symbol, that will be used by
      context lines for:
      * white space rules that are applicable (The first 12 bits)
        Take a note in cahe.c as well, when this ws rules are extended we have
        to fix the bits in the flags field.
      * how the rules are evaluated (actually this double encodes the sign
        of the line, but the code is easier to keep this way, bits 13,14,15)
      * if the line a blank line at EOF (bit 16)
      
      The check if new lines need to be marked up as extra lines at the end of
      file, is now done unconditionally. That should be ok, as
      'new_blank_line_at_eof' has a quick early return.
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      091f8e28
    • S
      b9cbfde6
    • S
    • S
      c64b420b
    • S
      diff.c: introduce emit_diff_symbol · 36a4cefd
      Stefan Beller 提交于
      In a later patch we want to buffer all output before emitting it as a
      new feature ("markup moved lines") conceptually cannot be implemented
      in a single pass over the output.
      
      There are different approaches to buffer all output such as:
      * Buffering on the char level, i.e. we'd have a char[] which would
        grow at approximately 80 characters a line. This would keep the
        output completely unstructured, but might be very easy to implement,
        such as redirecting all output to a temporary file and working off
        that. The later passes over the buffer are quite complicated though,
        because we have to parse back any output and then decide if it should
        be modified.
      
      * Buffer on a line level. As the output is mostly line oriented already,
        this would make sense, but it still is a bit awkward as we'd have to
        make sense of it again by looking at the first characters of a line
        to decide what part of a diff a line is.
      
      * Buffer semantically. Imagine there is a formal grammar for the diff
        output and we'd keep the symbols of this grammar around. This keeps
        the highest level of structure in the buffered data, such that the
        actual memory requirements are less than say the first option. Instead
        of buffering the characters of the line, we'll buffer what we intend
        to do plus additional information for the specifics. An output of
      
          diff --git a/new.txt b/new.txt
          index fa69b07..412428c 100644
          Binary files a/new.txt and b/new.txt differ
      
        could be buffered as
           DIFF_SYMBOL_DIFF_START + new.txt
           DIFF_SYMBOL_INDEX_MODE + fa69b07 412428c "non-executable" flag
           DIFF_SYMBOL_BINARY_FILES + new.txt
      
      This and the following patches introduce the third option of buffering
      by first moving any output to emit_diff_symbol, and then introducing the
      buffering in this function.
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      36a4cefd
    • S
      diff.c: factor out diff_flush_patch_all_file_pairs · ec331506
      Stefan Beller 提交于
      In a later patch we want to do more things before and after all filepairs
      are flushed. So factor flushing out all file pairs into its own function
      that the new code can be plugged in easily.
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ec331506
    • S
      diff.c: move line ending check into emit_hunk_header · dfb7728f
      Stefan Beller 提交于
      The emit_hunk_header() function is responsible for assembling a
      hunk header and calling emit_line() to send the hunk header
      to the output file.  Its only caller fn_out_consume() needs
      to prepare for a case where the function emits an incomplete
      line and add the terminating LF.
      
      Instead make sure emit_hunk_header() to always send a
      completed line to emit_line().
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dfb7728f
    • S
      diff.c: readability fix · f2d2a5de
      Stefan Beller 提交于
      We already have dereferenced 'p->two' into a local variable 'two'.
      Use that.
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f2d2a5de
    • J
      Merge branch 'sb/hashmap-customize-comparison' into sb/diff-color-move · 2cfb6cec
      Junio C Hamano 提交于
      * sb/hashmap-customize-comparison: (566 commits)
        hashmap: migrate documentation from Documentation/technical into header
        patch-ids.c: use hashmap correctly
        hashmap.h: compare function has access to a data field
        Twelfth batch for 2.14
        Git 2.13.2
        Eleventh batch for 2.14
        Revert "split-index: add and use unshare_split_index()"
        Tenth batch for 2.14
        add--interactive: quote commentChar regex
        add--interactive: handle EOF in prompt_yesno
        auto-correct: tweak phrasing
        docs: update 64-bit core.packedGitLimit default
        t7508: fix a broken indentation
        grep: fix erroneously copy/pasted variable in check/assert pattern
        Ninth batch for 2.14
        glossary: define 'stash entry'
        status: add optional stash count information
        stash: update documentation to use 'stash entry'
        for_each_bisect_ref(): don't trim refnames
        mergetools/meld: improve compatibiilty with Meld on macOS X
        ...
      2cfb6cec
    • S
      hashmap: migrate documentation from Documentation/technical into header · 1ecbf31d
      Stefan Beller 提交于
      While at it, clarify the use of `key`, `keydata`, `entry_or_key` as well
      as documenting the new data pointer for the compare function.
      
      Rework the example.
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1ecbf31d
    • S
      patch-ids.c: use hashmap correctly · 3da492f8
      Stefan Beller 提交于
      As alluded to in the previous patch, the code in patch-ids.c is
      using the hashmaps API wrong.
      
      Luckily we do not have a bug, as all hashmap functionality that we use
      here (hashmap_get) passes through the keydata.  If hashmap_get_next were
      to be used, a bug would occur as that passes NULL for the key_data.
      
      So instead use the hashmap API correctly and provide the caller required
      data in the compare function via the first argument that always gets
      passed and was setup via the hashmap_init function.
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3da492f8
    • S
      hashmap.h: compare function has access to a data field · 7663cdc8
      Stefan Beller 提交于
      When using the hashmap a common need is to have access to caller provided
      data in the compare function. A couple of times we abuse the keydata field
      to pass in the data needed. This happens for example in patch-ids.c.
      
      This patch changes the function signature of the compare function
      to have one more void pointer available. The pointer given for each
      invocation of the compare function must be defined in the init function
      of the hashmap and is just passed through.
      
      Documentation of this new feature is deferred to a later patch.
      This is a rather mechanical conversion, just adding the new pass-through
      parameter.  However while at it improve the naming of the fields of all
      compare functions used by hashmaps by ensuring unused parameters are
      prefixed with 'unused_' and naming the parameters what they are (instead
      of 'unused' make it 'unused_keydata').
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7663cdc8
  2. 27 6月, 2017 7 次提交
  3. 25 6月, 2017 21 次提交
    • J
      Sync with 2.13.2 · e629a7d2
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e629a7d2
    • J
      Git 2.13.2 · 8c8e978f
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8c8e978f
    • J
      Merge branch 'sn/reset-doc-typofix' into maint · 8992def6
      Junio C Hamano 提交于
      Doc update.
      
      * sn/reset-doc-typofix:
        doc: git-reset: fix a trivial typo
      8992def6
    • J
      Merge branch 'sg/doc-pretty-formats' into maint · 74567ac0
      Junio C Hamano 提交于
      Doc update.
      
      * sg/doc-pretty-formats:
        docs/pretty-formats: stress that %- removes all preceding line-feeds
      74567ac0
    • J
      Merge branch 'sd/t3200-branch-m-test' into maint · 77bcac3e
      Junio C Hamano 提交于
      New test.
      
      * sd/t3200-branch-m-test:
        t3200: add test for single parameter passed to -m option
      77bcac3e
    • J
      Merge branch 'sg/revision-parser-skip-prefix' into maint · 8d7a6b6c
      Junio C Hamano 提交于
      Code clean-up.
      
      * sg/revision-parser-skip-prefix:
        revision.c: use skip_prefix() in handle_revision_pseudo_opt()
        revision.c: use skip_prefix() in handle_revision_opt()
        revision.c: stricter parsing of '--early-output'
        revision.c: stricter parsing of '--no-{min,max}-parents'
        revision.h: turn rev_info.early_output back into an unsigned int
      8d7a6b6c
    • J
      Merge branch 'km/test-mailinfo-b-failure' into maint · 6f0c89d0
      Junio C Hamano 提交于
      New tests.
      
      * km/test-mailinfo-b-failure:
        t5100: add some more mailinfo tests
      6f0c89d0
    • J
      Merge branch 'sb/submodule-rm-absorb' into maint · 4f7132a9
      Junio C Hamano 提交于
      Doc update to a recently graduated topic.
      
      * sb/submodule-rm-absorb:
        Documentation/git-rm: correct submodule description
      4f7132a9
    • J
      Merge branch 'jc/diff-tree-stale-comment' into maint · b960cd37
      Junio C Hamano 提交于
      Comment fix.
      
      * jc/diff-tree-stale-comment:
        diff-tree: update stale in-code comments
      b960cd37
    • J
      Merge branch 'ps/stash-push-pathspec-fix' into maint · c4db75f2
      Junio C Hamano 提交于
      "git stash push <pathspec>" did not work from a subdirectory at all.
      Bugfix for a topic in v2.13
      
      * ps/stash-push-pathspec-fix:
        git-stash: fix pushing stash with pathspec from subdir
      c4db75f2
    • J
      Merge branch 'ls/github' into maint · 0378c856
      Junio C Hamano 提交于
      Help contributors that visit us at GitHub.
      
      * ls/github:
        Configure Git contribution guidelines for github.com
      0378c856
    • J
      Merge branch 'jk/pack-idx-corruption-safety' into maint · 7deb48af
      Junio C Hamano 提交于
      A flaky test has been corrected.
      
      * jk/pack-idx-corruption-safety:
        t5313: make extended-table test more deterministic
      7deb48af
    • J
      Merge branch 'jk/diff-blob' into maint · 78098768
      Junio C Hamano 提交于
      The result from "git diff" that compares two blobs, e.g. "git diff
      $commit1:$path $commit2:$path", used to be shown with the full
      object name as given on the command line, but it is more natural to
      use the $path in the output and use it to look up .gitattributes.
      
      * jk/diff-blob:
        diff: use blob path for blob/file diffs
        diff: use pending "path" if it is available
        diff: use the word "path" instead of "name" for blobs
        diff: pass whole pending entry in blobinfo
        handle_revision_arg: record paths for pending objects
        handle_revision_arg: record modes for "a..b" endpoints
        t4063: add tests of direct blob diffs
        get_sha1_with_context: dynamically allocate oc->path
        get_sha1_with_context: always initialize oc->symlink_path
        sha1_name: consistently refer to object_context as "oc"
        handle_revision_arg: add handle_dotdot() helper
        handle_revision_arg: hoist ".." check out of range parsing
        handle_revision_arg: stop using "dotdot" as a generic pointer
        handle_revision_arg: simplify commit reference lookups
        handle_revision_arg: reset "dotdot" consistently
      78098768
    • J
      Merge branch 'jc/name-rev-lw-tag' into maint · e8d9d8b0
      Junio C Hamano 提交于
      "git describe --contains" penalized light-weight tags so much that
      they were almost never considered.  Instead, give them about the
      same chance to be considered as an annotated tag that is the same
      age as the underlying commit would.
      
      * jc/name-rev-lw-tag:
        name-rev: favor describing with tags and use committer date to tiebreak
        name-rev: refactor logic to see if a new candidate is a better name
      e8d9d8b0
    • J
      Eleventh batch for 2.14 · a2ba37c5
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a2ba37c5
    • J
      Merge branch 'ab/free-and-null' · 50f03c66
      Junio C Hamano 提交于
      A common pattern to free a piece of memory and assign NULL to the
      pointer that used to point at it has been replaced with a new
      FREE_AND_NULL() macro.
      
      * ab/free-and-null:
        *.[ch] refactoring: make use of the FREE_AND_NULL() macro
        coccinelle: make use of the "expression" FREE_AND_NULL() rule
        coccinelle: add a rule to make "expression" code use FREE_AND_NULL()
        coccinelle: make use of the "type" FREE_AND_NULL() rule
        coccinelle: add a rule to make "type" code use FREE_AND_NULL()
        git-compat-util: add a FREE_AND_NULL() wrapper around free(ptr); ptr = NULL
      50f03c66
    • J
      Merge branch 'jk/warn-add-gitlink' · cda4ba30
      Junio C Hamano 提交于
      Using "git add d/i/r" when d/i/r is the top of the working tree of
      a separate repository would create a gitlink in the index, which
      would appear as a not-quite-initialized submodule to others.  We
      learned to give warnings when this happens.
      
      * jk/warn-add-gitlink:
        t: move "git add submodule" into test blocks
        add: warn when adding an embedded repository
      cda4ba30
    • J
      Merge branch 'bw/config-h' · f31d23a3
      Junio C Hamano 提交于
      Fix configuration codepath to pay proper attention to commondir
      that is used in multi-worktree situation, and isolate config API
      into its own header file.
      
      * bw/config-h:
        config: don't implicitly use gitdir or commondir
        config: respect commondir
        setup: teach discover_git_directory to respect the commondir
        config: don't include config.h by default
        config: remove git_config_iter
        config: create config.h
      f31d23a3
    • J
      Merge branch 'bw/ls-files-sans-the-index' · 5812b3f7
      Junio C Hamano 提交于
      Code clean-up.
      
      * bw/ls-files-sans-the-index:
        ls-files: factor out tag calculation
        ls-files: factor out debug info into a function
        ls-files: convert show_files to take an index
        ls-files: convert show_ce_entry to take an index
        ls-files: convert prune_cache to take an index
        ls-files: convert ce_excluded to take an index
        ls-files: convert show_ru_info to take an index
        ls-files: convert show_other_files to take an index
        ls-files: convert show_killed_files to take an index
        ls-files: convert write_eolinfo to take an index
        ls-files: convert overlay_tree_on_cache to take an index
        tree: convert read_tree to take an index parameter
        convert: convert renormalize_buffer to take an index
        convert: convert convert_to_git to take an index
        convert: convert convert_to_git_filter_fd to take an index
        convert: convert crlf_to_git to take an index
        convert: convert get_cached_convert_stats_ascii to take an index
      5812b3f7
    • J
      Merge branch 'js/alias-early-config' · 1c3d87cf
      Junio C Hamano 提交于
      The code to pick up and execute command alias definition from the
      configuration used to switch to the top of the working tree and
      then come back when the expanded alias was executed, which was
      unnecessarilyl complex.  Attempt to simplify the logic by using the
      early-config mechanism that does not chdir around.
      
      * js/alias-early-config:
        alias: use the early config machinery to expand aliases
        t7006: demonstrate a problem with aliases in subdirectories
        t1308: relax the test verifying that empty alias values are disallowed
        help: use early config when autocorrecting aliases
        config: report correct line number upon error
        discover_git_directory(): avoid setting invalid git_dir
      1c3d87cf
    • J
      Merge branch 'sn/reset-doc-typofix' · 9bca0e55
      Junio C Hamano 提交于
      Doc update.
      
      * sn/reset-doc-typofix:
        doc: git-reset: fix a trivial typo
      9bca0e55