Thread (7 messages) flat view 7 messages, 3 authors, 2016-06-15

[RFC/PATCH] commit: allow partial commits with relative paths

From: Michael J Gruber <hidden>
Date: 2016-06-15 22:51:38
Subsystem: the rest · Maintainer: Linus Torvalds

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).

Overlay the full tree instead.

Reported-by: Reuben Thomas <redacted>
Signed-off-by: Michael J Gruber <redacted>
---
RFC because lack of test, and also because I'm not sure we want this, and
what to do about git add which has the same problem, but would need a
different fix.
---
 builtin/commit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index e1af9b1..431590c 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -257,7 +257,7 @@ static int list_paths(struct string_list *list, const char *with_tree,
 	m = xcalloc(1, i);
 
 	if (with_tree)
-		overlay_tree_on_cache(with_tree, prefix);
+		overlay_tree_on_cache(with_tree, NULL);
 
 	for (i = 0; i < active_nr; i++) {
 		struct cache_entry *ce = active_cache[i];
-- 
1.7.6.336.gdf067
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help