summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 61e2b01)
raw | patch | inline | side by side (parent: 61e2b01)
author | Junio C Hamano <junkio@cox.net> | |
Sat, 26 Nov 2005 08:22:48 +0000 (00:22 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 29 Nov 2005 07:13:02 +0000 (23:13 -0800) |
With this, git-checkout-index from a subdirectory works as
expected. Note that "git-checkout-index -a" checks out files
only in the current directory and under.
Signed-off-by: Junio C Hamano <junkio@cox.net>
expected. Note that "git-checkout-index -a" checks out files
only in the current directory and under.
Signed-off-by: Junio C Hamano <junkio@cox.net>
checkout-index.c | patch | blob | history |
diff --git a/checkout-index.c b/checkout-index.c
index dab3778a9585bcfde98be436255542df13aacddb..f1e716d4126c7dc9a0fd1be665dee9f8d0fbc87e 100644 (file)
--- a/checkout-index.c
+++ b/checkout-index.c
*/
#include "cache.h"
+static const char *prefix;
+static int prefix_length;
+
static struct checkout state = {
.base_dir = "",
.base_dir_len = 0,
struct cache_entry *ce = active_cache[i];
if (ce_stage(ce))
continue;
+ if (prefix && *prefix &&
+ ( ce_namelen(ce) <= prefix_length ||
+ memcmp(prefix, ce->name, prefix_length) ))
+ continue;
if (checkout_entry(ce, &state) < 0)
errs++;
}
int newfd = -1;
int all = 0;
+ prefix = setup_git_directory();
+ prefix_length = prefix ? strlen(prefix) : 0;
+
if (read_cache() < 0) {
die("invalid cache");
}
if (all)
die("git-checkout-index: don't mix '--all' and explicit filenames");
- checkout_file(arg);
+ checkout_file(prefix_path(prefix, prefix_length, arg));
}
if (all)