Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on May 19, 2015
  1. @gitster

    Merge branch 'nd/diff-i-t-a'

    gitster authored
    After "git add -N", the path appeared in output of "git diff HEAD"
    and "git diff --cached HEAD", leading "git status" to classify it
    as "Changes to be committed".  Such a path, however, is not yet to
    be scheduled to be committed.  "git diff" showed the change to the
    path as modification, not as a "new file", in the header of its
    output.
    
    Treat such paths as "yet to be added to the index but Git already
    know about them"; "git diff HEAD" and "git diff --cached HEAD"
    should not talk about them, and "git diff" should show them as new
    files yet to be added to the index.
    
    * nd/diff-i-t-a:
      diff-lib.c: adjust position of i-t-a entries in diff
Commits on May 6, 2015
  1. @gitster

    Merge branch 'bc/object-id'

    gitster authored
    Identify parts of the code that knows that we use SHA-1 hash to
    name our objects too much, and use (1) symbolic constants instead
    of hardcoded 20 as byte count and/or (2) use struct object_id
    instead of unsigned char [20] for object names.
    
    * bc/object-id:
      apply: convert threeway_stage to object_id
      patch-id: convert to use struct object_id
      commit: convert parts to struct object_id
      diff: convert struct combine_diff_path to object_id
      bulk-checkin.c: convert to use struct object_id
      zip: use GIT_SHA1_HEXSZ for trailers
      archive.c: convert to use struct object_id
      bisect.c: convert leaf functions to use struct object_id
      define utility functions for object IDs
      define a structure for object IDs
Commits on Mar 23, 2015
  1. @pclouds @gitster

    diff-lib.c: adjust position of i-t-a entries in diff

    pclouds authored gitster committed
    Entries added by "git add -N" are reminder for the user so that they
    don't forget to add them before committing. These entries appear in
    the index even though they are not real. Their presence in the index
    leads to a confusing "git status" like this:
    
        On branch master
        Changes to be committed:
                new file:   foo
    
        Changes not staged for commit:
                modified:   foo
    
    If you do a "git commit", "foo" will not be included even though
    "status" reports it as "to be committed". This patch changes the
    output to become
    
        On branch master
        Changes not staged for commit:
                new file:   foo
    
        no changes added to commit
    
    The two hunks in diff-lib.c adjust "diff-index" and "diff-files" so
    that i-t-a entries appear as new files in diff-files and nothing in
    diff-index.
    
    Due to this change, diff-files may start to report "new files" for the
    first time. "add -u" needs to be told about this or it will die in
    denial, screaming "new files can't exist! Reality is wrong." Luckily,
    it's the only one among run_diff_files() callers that needs fixing.
    
    Now in the new world order, a hierarchy in the index that contain
    i-t-a paths is written out as a tree object as if these i-t-a
    entries do not exist, and comparing the index with such a tree
    object that would result from writing out the hierarchy will result
    in no difference.  Update a test in t2203 that expected the i-t-a
    entries to appear as "added to the index" in the comparison to
    instead expect no output.
    
    An earlier change eec3e7e (cache-tree: invalidate i-t-a paths after
    generating trees, 2012-12-16) becomes an unnecessary pessimization
    in the new world order---a cache-tree in the index that corresponds
    to a hierarchy with i-t-a paths can now be marked as valid and
    record the object name of the tree that results from writing a tree
    object out of that hierarchy, as it will compare equal to that tree.
    
    Reverting the commit is left for the future, though, as it is purely
    a performance issue and no longer affects correctness.
    
    Helped-by: Michael J Gruber <git@drmicha.warpmail.net>
    Helped-by: Junio C Hamano <gitster@pobox.com>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 14, 2015
  1. @bk2204 @gitster

    diff: convert struct combine_diff_path to object_id

    bk2204 authored gitster committed
    Also, convert a constant to GIT_SHA1_HEXSZ.
    
    Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 4, 2015
  1. @gitster

    run_diff_files(): clarify computation of sha1 validity

    gitster authored
    Remove the need to have duplicated "if there is a change then feed
    null_sha1 and otherwise sha1 from the cache entry" for the "new"
    side of the diff by introducing two temporary variables to point
    at the object name of the old and the new side of the blobs.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 16, 2014
  1. @gitster

    Merge branch 'jk/diff-files-assume-unchanged'

    gitster authored
    * jk/diff-files-assume-unchanged:
      run_diff_files: do not look at uninitialized stat data
Commits on May 15, 2014
  1. @peff @gitster

    run_diff_files: do not look at uninitialized stat data

    peff authored gitster committed
    If we try to diff an index entry marked CE_VALID (because it
    was marked with --assume-unchanged), we do not bother even
    running stat() on the file to see if it was removed. This
    started long ago with 540e694 (Prevent diff machinery from
    examining assume-unchanged entries on worktree, 2009-08-11).
    
    However, the subsequent code may look at our "struct stat"
    and expect to find actual data; currently it will find
    whatever cruft was left on the stack. This can cause
    problems in two situations:
    
      1. We call match_stat_with_submodule with the stat data,
         so a submodule may be erroneously marked as changed.
    
      2. If --find-copies-harder is in effect, we pass all
         entries, even unchanged ones, to diff_change, so it can
         list them as rename/copy sources. Since we found no
         change, we assume that function will realize it and not
         actually display any diff output. However, we end up
         feeding it a bogus mode, leading it to sometimes claim
         there was a mode change.
    
    We can fix both by splitting the CE_VALID and regular code
    paths, and making sure only to look at the stat information
    in the latter. Furthermore, we push the declaration of our
    "struct stat" down into the code paths that actually set it,
    so we cannot accidentally access it uninitialized in future
    code.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 7, 2014
  1. @gitster

    Merge branch 'jc/hold-diff-remove-q-synonym-for-no-deletion'

    gitster authored
    Remove a confusing and deprecated "-q" option from "git diff-files";
    "git diff-files --diff-filter=d" can be used instead.
Commits on Mar 5, 2014
  1. @gitster

    Merge branch 'ks/combine-diff'

    gitster authored
    Teach combine-diff to honour the path-output-order imposed by
    diffcore-order, and optimize how matching paths are found in
    the N-way diffs made with parents.
    
    * ks/combine-diff:
      tests: add checking that combine-diff emits only correct paths
      combine-diff: simplify intersect_paths() further
      combine-diff: combine_diff_path.len is not needed anymore
      combine-diff: optimize combine_diff_path sets intersection
      diff test: add tests for combine-diff with orderfile
      diffcore-order: export generic ordering interface
Commits on Feb 24, 2014
  1. @gitster

    combine-diff: combine_diff_path.len is not needed anymore

    Kirill Smelkov authored gitster committed
    The field was used in order to speed-up name comparison and also to
    mark removed paths by setting it to 0.
    
    Because the updated code does significantly less strcmp and also
    just removes paths from the list and free right after we know a path
    will not be needed, it is not needed anymore.
    
    Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @pclouds @gitster

    pathspec: convert some match_pathspec_depth() to ce_path_match()

    pclouds authored gitster committed
    This helps reduce the number of match_pathspec_depth() call sites and
    show how match_pathspec_depth() is used.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 9, 2013
  1. @gitster

    Merge branch 'jl/submodule-mv'

    gitster authored
    "git mv A B" when moving a submodule A does "the right thing",
    inclusing relocating its working tree and adjusting the paths in
    the .gitmodules file.
    
    * jl/submodule-mv: (53 commits)
      rm: delete .gitmodules entry of submodules removed from the work tree
      mv: update the path entry in .gitmodules for moved submodules
      submodule.c: add .gitmodules staging helper functions
      mv: move submodules using a gitfile
      mv: move submodules together with their work trees
      rm: do not set a variable twice without intermediate reading.
      t6131 - skip tests if on case-insensitive file system
      parse_pathspec: accept :(icase)path syntax
      pathspec: support :(glob) syntax
      pathspec: make --literal-pathspecs disable pathspec magic
      pathspec: support :(literal) syntax for noglob pathspec
      kill limit_pathspec_to_literal() as it's only used by parse_pathspec()
      parse_pathspec: preserve prefix length via PATHSPEC_PREFIX_ORIGIN
      parse_pathspec: make sure the prefix part is wildcard-free
      rename field "raw" to "_raw" in struct pathspec
      tree-diff: remove the use of pathspec's raw[] in follow-rename codepath
      remove match_pathspec() in favor of match_pathspec_depth()
      remove init_pathspec() in favor of parse_pathspec()
      remove diff_tree_{setup,release}_paths
      convert common_prefix() to use struct pathspec
      ...
  2. @gitster

    Merge branch 'jc/diff-filter-negation'

    gitster authored
    Teach "git diff --diff-filter" to express "I do not want to see
    these classes of changes" more directly by listing only the
    unwanted ones in lowercase (e.g. "--diff-filter=d" will show
    everything but deletion) and deprecate "diff-files -q" which did
    the same thing as "--diff-filter=d".
    
    * jc/diff-filter-negation:
      diff: deprecate -q option to diff-files
      diff: allow lowercase letter to specify what change class to exclude
      diff: reject unknown change class given to --diff-filter
      diff: preparse --diff-filter string argument
      diff: factor out match_filter()
      diff: pass the whole diff_options to diffcore_apply_filter()
Commits on Jul 19, 2013
  1. @gitster

    diff: remove "diff-files -q" in a version of Git in a distant future

    gitster authored
    This was inherited from "show-diff -q" that was invented to tell
    comparison between the index and the working tree to ignore only
    removals in 2005.
    
    These days, it is spelled as "--diff-filter=d".
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    diff: deprecate -q option to diff-files

    gitster authored
    This reimplements the ancient "-q" option to "git diff-files" that
    was inherited from "show-diff -q" in terms of "--diff-filter=d".  We
    will be deprecating the "-q" option, so let's issue a warning when
    we do so.
    
    Incidentally this also tentatively fixes "git diff --no-index" to
    honor "-q" and hide deletions; the use will get the same warning.
    
    We should remove the support for "-q" in a future version but it is
    not that urgent.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 15, 2013
  1. @pclouds @gitster

    remove init_pathspec() in favor of parse_pathspec()

    pclouds authored gitster committed
    While at there, move free_pathspec() to pathspec.c
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @pclouds @gitster

    parse_pathspec: add special flag for max_depth feature

    pclouds authored gitster committed
    match_pathspec_depth() and tree_entry_interesting() check max_depth
    field in order to support "git grep --max-depth". The feature
    activation is tied to "recursive" field, which led to some unwanted
    activation, e.g. 5c8eeb8 (diff-index: enable recursive pathspec
    matching in unpack_trees - 2012-01-15).
    
    This patch decouples the activation from "recursive" field, puts it in
    "magic" field instead. This makes sure that only "git grep" can
    activate this feature. And because parse_pathspec knows when the
    feature is not used, it does not need to sort pathspec (required for
    max_depth to work correctly). A small win for non-grep cases.
    
    Even though a new magic flag is introduced, no magic syntax is. The
    magic can be only enabled by parse_pathspec() caller. We might someday
    want to support ":(maxdepth:10)src." It all depends on actual use
    cases.
    
    max_depth feature cannot be enabled via init_pathspec() anymore. But
    that's ok because init_pathspec() is on its way to /dev/null.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 2, 2013
  1. @gitster

    diff-lib, read-tree, unpack-trees: mark cache_entry array paramters c…

    René Scharfe authored gitster committed
    …onst
    
    Change the type merge_fn_t to accept the array of cache_entry pointers
    as const pointers to const pointers.  This documents the fact that the
    merge functions don't modify the cache_entry contents or replace any of
    the pointers in the array.
    
    Only a single cast is necessary in unpack_nondirectories because adding
    two const modifiers at once is not allowed in C.  The cast is safe in
    that it doesn't mask any modfication; call_unpack_fn only needs the
    array for reading.
    
    Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    diff-lib, read-tree, unpack-trees: mark cache_entry pointers const

    René Scharfe authored gitster committed
    Add const to struct cache_entry pointers throughout the tree which are
    only used for reading.  This allows callers to pass in const pointers.
    
    Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 29, 2012
  1. @peff @gitster

    diff: do not use null sha1 as a sentinel value

    peff authored gitster committed
    The diff code represents paths using the diff_filespec
    struct. This struct has a sha1 to represent the sha1 of the
    content at that path, as well as a sha1_valid member which
    indicates whether its sha1 field is actually useful. If
    sha1_valid is not true, then the filespec represents a
    working tree file (e.g., for the no-index case, or for when
    the index is not up-to-date).
    
    The diff_filespec is only used internally, though. At the
    interfaces to the diff subsystem, callers feed the sha1
    directly, and we create a diff_filespec from it. It's at
    that point that we look at the sha1 and decide whether it is
    valid or not; callers may pass the null sha1 as a sentinel
    value to indicate that it is not.
    
    We should not typically see the null sha1 coming from any
    other source (e.g., in the index itself, or from a tree).
    However, a corrupt tree might have a null sha1, which would
    cause "diff --patch" to accidentally diff the working tree
    version of a file instead of treating it as a blob.
    
    This patch extends the edges of the diff interface to accept
    a "sha1_valid" flag whenever we accept a sha1, and to use
    that flag when creating a filespec. In some cases, this
    means passing the flag through several layers, making the
    code change larger than would be desirable.
    
    One alternative would be to simply die() upon seeing
    corrupted trees with null sha1s. However, this fix more
    directly addresses the problem (while bogus sha1s in a tree
    are probably a bad thing, it is really the sentinel
    confusion sending us down the wrong code path that is what
    makes it devastating). And it means that git is more capable
    of examining and debugging these corrupted trees. For
    example, you can still "diff --raw" such a tree to find out
    when the bogus entry was introduced; you just cannot do a
    "--patch" diff (just as you could not with any other
    corrupted tree, as we do not have any content to diff).
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 16, 2012
  1. @pclouds @gitster

    diff-index: enable recursive pathspec matching in unpack_trees

    pclouds authored gitster committed
    The pathspec structure has a few bits of data to drive various operation
    modes after we unified the pathspec matching logic in various codepaths.
    For example, max_depth field is there so that "git grep" can limit the
    output for files found in limited depth of tree traversal. Also in order
    to show just the surface level differences in "git diff-tree", recursive
    field stops us from descending into deeper level of the tree structure
    when it is set to false, and this also affects pathspec matching when
    we have wildcards in the pathspec.
    
    The diff-index has always wanted the recursive behaviour, and wanted to
    match pathspecs without any depth limit. But we forgot to do so when we
    updated tree_entry_interesting() logic to unify the pathspec matching
    logic.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 5, 2011
  1. @gitster

    Merge branch 'cn/eradicate-working-copy'

    gitster authored
    * cn/eradicate-working-copy:
      Remove 'working copy' from the documentation and C code
  2. @gitster

    Merge branch 'jc/diff-index-unpack'

    gitster authored
    * jc/diff-index-unpack:
      diff-index: pass pathspec down to unpack-trees machinery
      unpack-trees: allow pruning with pathspec
      traverse_trees(): allow pruning with pathspec
Commits on Sep 21, 2011
  1. @carlosmn @gitster

    Remove 'working copy' from the documentation and C code

    carlosmn authored gitster committed
    The git term is 'working tree', so replace the most public references
    to 'working copy'.
    
    Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 29, 2011
  1. @gitster

    diff-index: pass pathspec down to unpack-trees machinery

    gitster authored
    And finally, pass the pathspec down through unpack_trees() to traverse_trees()
    callchain.
    
    Before and after applying this series, looking for changes in the kernel
    repository with a fairly narrow pathspec becomes somewhat faster.
    
      (without patch)
      $ /usr/bin/time git diff --raw v2.6.27 -- net/ipv6 >/dev/null
      0.48user 0.05system 0:00.53elapsed 100%CPU (0avgtext+0avgdata 163296maxresident)k
      0inputs+952outputs (0major+11163minor)pagefaults 0swaps
    
      (with patch)
      $ /usr/bin/time git diff --raw v2.6.27 -- net/ipv6 >/dev/null
      0.01user 0.00system 0:00.02elapsed 104%CPU (0avgtext+0avgdata 43856maxresident)k
      0inputs+24outputs (0major+3688minor)pagefaults 0swaps
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 8, 2011
  1. @gitster

    Merge branch 'jc/diff-index-refactor'

    gitster authored
    * jc/diff-index-refactor:
      diff-lib: refactor run_diff_index() and do_diff_cache()
      diff-lib: simplify do_diff_cache()
Commits on Aug 1, 2011
  1. @gitster

    Merge branch 'jc/maint-reset-unmerged-path'

    gitster authored
    * jc/maint-reset-unmerged-path:
      reset [<commit>] paths...: do not mishandle unmerged paths
Commits on Jul 14, 2011
  1. @gitster

    diff-lib: refactor run_diff_index() and do_diff_cache()

    gitster authored
    The latter is meant to be an API for internal callers that want to inspect
    the resulting diff-queue, while the former is an implementation of "git
    diff-index" command. Extract the common logic into a single helper
    function and make them thin wrappers around it.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    diff-lib: simplify do_diff_cache()

    gitster authored
    Since 34110cd (Make 'unpack_trees()' have a separate source and
    destination index, 2008-03-06), we can run unpack_trees() without munging
    the index at all, but do_diff_cache() tried ever so carefully to work
    around the old behaviour of the function.
    
    We can just tell unpack_trees() not to touch the original index and there
    is no need to clean-up whatever the previous round has done.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @gitster

    reset [<commit>] paths...: do not mishandle unmerged paths

    gitster authored
    Because "diff --cached HEAD" showed an incorrect blob object name on the
    LHS of the diff, we ended up updating the index entry with bogus value,
    not what we read from the tree.
    
    Noticed by John Nowak.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 6, 2011
  1. @gitster

    Merge branch 'jk/diff-not-so-quick'

    gitster authored
    * jk/diff-not-so-quick:
      diff: futureproof "stop feeding the backend early" logic
      diff_tree: disable QUICK optimization with diff filter
    
    Conflicts:
    	diff.c
Commits on May 31, 2011
  1. @gitster

    diff-index --quiet: learn the "stop feeding the backend early" logic

    gitster authored
    A negative return from the unpack callback function usually means unpack
    failed for the entry and signals the unpack_trees() machinery to fail the
    entire merge operation, immediately and there is no other way for the
    callback to tell the machinery to exit early without reporting an error.
    
    This is what we usually want to make a merge all-or-nothing operation, but
    the machinery is also used for diff-index codepath by using a custom
    unpack callback function. And we do sometimes want to exit early without
    failing, namely when we are under --quiet and can short-cut the diff upon
    finding the first difference.
    
    Add "exiting_early" field to unpack_trees_options structure, to signal the
    unpack_trees() machinery that the negative return value is not signaling
    an error but an early return from the unpack_trees() machinery. As this by
    definition hasn't unpacked everything, discard the resulting index just
    like the failure codepath.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    Merge remote-tracking branch 'ko/maint' into jc/diff-index-quick-exit…

    gitster authored
    …-early
    
    * ko/maint: (4352 commits)
      git-submodule.sh: separate parens by a space to avoid confusing some shells
      Documentation/technical/api-diff.txt: correct name of diff_unmerge()
      read_gitfile_gently: use ssize_t to hold read result
      remove tests of always-false condition
      rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
      Git 1.7.5.3
      init/clone: remove short option -L and document --separate-git-dir
      do not read beyond end of malloc'd buffer
      git-svn: Fix git svn log --show-commit
      Git 1.7.5.2
      provide a copy of the LGPLv2.1
      test core.gitproxy configuration
      copy_gecos: fix not adding nlen to len when processing "&"
      Update draft release notes to 1.7.5.2
      Documentation/git-fsck.txt: fix typo: unreadable -> unreachable
      send-pack: avoid deadlock on git:// push with failed pack-objects
      connect: let callers know if connection is a socket
      connect: treat generic proxy processes like ssh processes
      sideband_demux(): fix decl-after-stmt
      t3503: test cherry picking and reverting root commits
      ...
    
    Conflicts:
    	diff.c
  3. @gitster

    diff: futureproof "stop feeding the backend early" logic

    gitster authored
    Refactor the "do not stop feeding the backend early" logic into a small
    helper function and use it in both run_diff_files() and diff_tree() that
    has the stop-early optimization. We may later add other types of diffcore
    transformation that require to look at the whole result like diff-filter
    does, and having the logic in a single place is essential for longer term
    maintainability.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 13, 2011
  1. @gitster

    Merge branch 'jc/fix-diff-files-unmerged' into maint

    gitster authored
    * jc/fix-diff-files-unmerged:
      diff-files: show unmerged entries correctly
      diff: remove often unused parameters from diff_unmerge()
      diff.c: return filepair from diff_unmerge()
      test: use $_z40 from test-lib
Something went wrong with that request. Please try again.