diff options
author | Clemens Buchacher <drizzd@aon.at> | 2011-07-30 19:13:47 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-02 14:20:35 -0700 |
commit | 8894d5358095a08c2f700a87ce9fdefb0b6eb61b (patch) | |
tree | 9bb41b5eba638c33b61acb7041817c6b129c0796 /LGPL-2.1 | |
parent | Merge branch 'nk/ref-doc' into maint (diff) | |
download | tgif-8894d5358095a08c2f700a87ce9fdefb0b6eb61b.tar.xz |
commit: allow partial commits with relative paths
In order to do partial commits, git-commit overlays a tree on the
cache and checks pathspecs against the result. Currently, the
overlaying is done using "prefix" which prevents relative pathspecs
with ".." and absolute pathspec from matching when they refer to
files not under "prefix" and absent from the index, but still in
the tree (i.e. files staged for removal).
The point of providing a prefix at all is performance optimization.
If we say there is no common prefix for the files of interest, then
we have to read the entire tree into the index.
But even if we cannot use the working directory as a prefix, we can
still figure out if there is a common prefix for all given paths,
and use that instead. The pathspec_prefix() routine from ls-files.c
does exactly that.
Any use of global variables is removed from pathspec_prefix() so
that it can be called from commit.c.
Reported-by: Reuben Thomas <rrt@sc3d.org>
Analyzed-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'LGPL-2.1')
0 files changed, 0 insertions, 0 deletions