Skip to content
This repository

Feb 13, 2012

  1. Junio C Hamano

    Merge branch 'nd/cache-tree-api-refactor'

    * nd/cache-tree-api-refactor:
      cache-tree: update API to take abitrary flags
    gitster authored
  2. Junio C Hamano

    Merge branch 'jc/maint-commit-ignore-i-t-a'

    * jc/maint-commit-ignore-i-t-a:
      commit: ignore intent-to-add entries instead of refusing
    
    Conflicts:
    	cache-tree.c
    gitster authored

Feb 07, 2012

  1. Junio C Hamano

    commit: ignore intent-to-add entries instead of refusing

    Originally, "git add -N" was introduced to help users from forgetting to
    add new files to the index before they ran "git commit -a".  As an attempt
    to help them further so that they do not forget to say "-a", "git commit"
    to commit the index as-is was taught to error out, reminding the user that
    they may have forgotten to add the final contents of the paths before
    running the command.
    
    This turned out to be a false "safety" that is useless.  If the user made
    changes to already tracked paths and paths added with "git add -N", and
    then ran "git add" to register the final contents of the paths added with
    "git add -N", "git commit" will happily create a commit out of the index,
    without including the local changes made to the already tracked paths. It
    was not a useful "safety" measure to prevent "forgetful" mistakes from
    happening.
    
    It turns out that this behaviour is not just a useless false "safety", but
    actively hurts use cases of "git add -N" that were discovered later and
    have become popular, namely, to tell Git to be aware of these paths added
    by "git add -N", so that commands like "git status" and "git diff" would
    include them in their output, even though the user is not interested in
    including them in the next commit they are going to make.
    
    Fix this ancient UI mistake, and instead make a commit from the index
    ignoring the paths added by "git add -N" without adding real contents.
    
    Based on the work by Nguyễn Thái Ngọc Duy, and helped by injection of
    sanity from Jonathan Nieder and others on the Git mailing list.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    gitster authored

May 25, 2009

  1. Junio C Hamano

    Optimize "diff-index --cached" using cache-tree

    When running "diff-index --cached" after making a change to only a small
    portion of the index, there is no point unpacking unchanged subtrees into
    the index recursively, only to find that all entries match anyway.  Tweak
    unpack_trees() logic that is used to read in the tree object to catch the
    case where the tree entry we are looking at matches the index as a whole
    by looking at the cache-tree.
    
    As an exercise, after modifying a few paths in the kernel tree, here are
    a few numbers on my Athlon 64X2 3800+:
    
        (without patch, hot cache)
        $ /usr/bin/time git diff --cached --raw
        :100644 100644 b57e1f5... e69de29... M  Makefile
        :100644 000000 8c86b72... 0000000... D  arch/x86/Makefile
        :000000 100644 0000000... e69de29... A  arche
        0.07user 0.02system 0:00.09elapsed 102%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+0outputs (0major+9407minor)pagefaults 0swaps
    
        (with patch, hot cache)
        $ /usr/bin/time ../git.git/git-diff --cached --raw
        :100644 100644 b57e1f5... e69de29... M  Makefile
        :100644 000000 8c86b72... 0000000... D  arch/x86/Makefile
        :000000 100644 0000000... e69de29... A  arche
        0.02user 0.00system 0:00.02elapsed 103%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+0outputs (0major+2446minor)pagefaults 0swaps
    
    Cold cache numbers are very impressive, but it does not matter very much
    in practice:
    
        (without patch, cold cache)
        $ su root sh -c 'echo 3 >/proc/sys/vm/drop_caches'
        $ /usr/bin/time git diff --cached --raw
        :100644 100644 b57e1f5... e69de29... M  Makefile
        :100644 000000 8c86b72... 0000000... D  arch/x86/Makefile
        :000000 100644 0000000... e69de29... A  arche
        0.06user 0.17system 0:10.26elapsed 2%CPU (0avgtext+0avgdata 0maxresident)k
        247032inputs+0outputs (1172major+8237minor)pagefaults 0swaps
    
        (with patch, cold cache)
        $ su root sh -c 'echo 3 >/proc/sys/vm/drop_caches'
        $ /usr/bin/time ../git.git/git-diff --cached --raw
        :100644 100644 b57e1f5... e69de29... M  Makefile
        :100644 000000 8c86b72... 0000000... D  arch/x86/Makefile
        :000000 100644 0000000... e69de29... A  arche
        0.02user 0.01system 0:01.01elapsed 3%CPU (0avgtext+0avgdata 0maxresident)k
        18440inputs+0outputs (79major+2369minor)pagefaults 0swaps
    
    This of course helps "git status" as well.
    
        (without patch, hot cache)
        $ /usr/bin/time ../git.git/git-status >/dev/null
        0.17user 0.18system 0:00.35elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+5336outputs (0major+10970minor)pagefaults 0swaps
    
        (with patch, hot cache)
        $ /usr/bin/time ../git.git/git-status >/dev/null
        0.10user 0.16system 0:00.27elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
        0inputs+5336outputs (0major+3921minor)pagefaults 0swaps
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    gitster authored
  2. Junio C Hamano

    cache-tree.c::cache_tree_find(): simplify internal API

    Earlier cache_tree_find() needs to be called with a valid cache_tree,
    but repeated look-up may find an invalid or missing cache_tree in between.
    Help simplify the callers by returning NULL to mean "nothing appropriate
    found" when the input is NULL.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    gitster authored

May 20, 2009

  1. Junio C Hamano

    write-tree --ignore-cache-tree

    This allows you to discard the cache-tree information before writing the
    tree out of the index (i.e. it always recomputes the tree object names for
    all the subtrees).
    
    This is only useful as a debug option, so I did not bother documenting it.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    gitster authored

Apr 20, 2009

  1. Junio C Hamano

    Move prime_cache_tree() to cache-tree.c

    The interface to build cache-tree belongs there.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    gitster authored

Dec 01, 2008

  1. Junio C Hamano

    git add --intent-to-add: do not let an empty blob be committed by acc…

    …ident
    
    Writing a tree out of an index with an "intent to add" entry is blocked.
    This implies that you cannot "git commit" from such a state; however you
    can still do "git commit -a" or "git commit $that_path".
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    gitster authored

Apr 25, 2008

  1. Junio C Hamano

    Merge branch 'maint-1.5.4' into maint

    * maint-1.5.4:
      t5516: remove ambiguity test (1)
      Linked glossary from cvs-migration page
      write-tree: properly detect failure to write tree objects
    gitster authored

Apr 23, 2008

  1. Junio C Hamano

    write-tree: properly detect failure to write tree objects

    Tomasz Fortuna reported that "git commit" does not error out properly when
    it cannot write tree objects out.  "git write-tree" shares the same issue,
    as the failure to notice the error is deep in the logic to write tree
    objects out recursively.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    gitster authored

Feb 12, 2008

  1. Junio C Hamano

    Merge branch 'jc/error-message-in-cherry-pick'

    * jc/error-message-in-cherry-pick:
      Make error messages from cherry-pick/revert more sensible
    gitster authored

Feb 05, 2008

  1. Junio C Hamano

    Make error messages from cherry-pick/revert more sensible

    The original "rewrite in C" did somewhat a sloppy job while
    stealing code from git-write-tree.
    
    The caller pretends as if the write_tree() function would return
    an error code and being able to issue a sensible error message
    itself, but write_tree() function just calls die() and never
    returns an error.  Worse yet, the function claims that it was
    running git-write-tree (which is no longer true after
    cherry-pick stole it).
    
    Tested-by: Björn Steinbrink <B.Steinbrink@gmx.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    gitster authored

Jun 23, 2007

  1. Junio C Hamano

    Two trivial -Wcast-qual fixes

    Luiz Fernando N. Capitulino noticed the one in tree-walk.h where
    we cast away constness while computing the legnth of a tree
    entry.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    gitster authored
Something went wrong with that request. Please try again.