summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 83e77a2)
raw | patch | inline | side by side (parent: 83e77a2)
author | Junio C Hamano <junkio@cox.net> | |
Sat, 6 May 2006 06:09:05 +0000 (23:09 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 6 May 2006 06:11:29 +0000 (23:11 -0700) |
When pathspecs are given, update-index --again further limits
the set of paths to be updated to those that match them.
Signed-off-by: Junio C Hamano <junkio@cox.net>
the set of paths to be updated to those that match them.
Signed-off-by: Junio C Hamano <junkio@cox.net>
t/t2101-update-index-reupdate.sh | patch | blob | history | |
update-index.c | patch | blob | history |
index 5c505c6ac8c14956626a1523edfde1728b4a08d8..77aed8d80067798d9cedb20963ad57a3f0f8ab15 100755 (executable)
100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
EOF'
-test_done
+test_expect_success 'update-index --update with pathspec' \
+ 'echo very happy >file2 &&
+ cat file2 >dir1/file3 &&
+ git-update-index --again dir1/ &&
+ git-ls-files -s >current &&
+ cmp current - <<\EOF
+100644 594fb5bb1759d90998e2bf2a38261ae8e243c760 0 dir1/file3
+100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
+EOF'
+test_done
diff --git a/update-index.c b/update-index.c
index 5496d68ae9c556431c5f21c9ca703fe92482beca..184b2526da58b56b8e808faceb1efc6949d3c831 100644 (file)
--- a/update-index.c
+++ b/update-index.c
*/
int pos;
int has_head = 1;
+ char **pathspec = get_pathspec(prefix, av + 1);
if (read_ref(git_path("HEAD"), head_sha1))
/* If there is no HEAD, that means it is an initial
struct cache_entry *ce = active_cache[pos];
struct cache_entry *old = NULL;
int save_nr;
- if (ce_stage(ce))
+
+ if (ce_stage(ce) || !ce_path_match(ce, pathspec))
continue;
if (has_head)
old = read_one_ent(NULL, head_sha1,