summaryrefslogtreecommitdiff
path: root/builtin/checkout.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-12-22 12:27:12 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-12-22 12:27:12 -0800
commit570077231f12e995bb9e8ebe3d6a295047bb993e (patch)
tree3a65c9316406bdff1d3af9efa675505490242263 /builtin/checkout.c
parentMerge branch 'jc/hook-cleanup' (diff)
parentt3102: style modernization (diff)
downloadtgif-570077231f12e995bb9e8ebe3d6a295047bb993e.tar.xz
Merge branch 'nd/ls-tree-pathspec'
"git ls-tree" does not support path selection based on negative pathspecs, but did not error out when negative pathspecs are given. * nd/ls-tree-pathspec: t3102: style modernization t3102: document that ls-tree does not yet support negated pathspec ls-tree: disable negative pathspec because it's not supported ls-tree: remove path filtering logic in show_tree tree.c: update read_tree_recursive callback to pass strbuf as base
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 5a78758036..52d6cbb0a8 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -62,7 +62,7 @@ static int post_checkout_hook(struct commit *old, struct commit *new,
}
-static int update_some(const unsigned char *sha1, const char *base, int baselen,
+static int update_some(const unsigned char *sha1, struct strbuf *base,
const char *pathname, unsigned mode, int stage, void *context)
{
int len;
@@ -72,11 +72,11 @@ static int update_some(const unsigned char *sha1, const char *base, int baselen,
if (S_ISDIR(mode))
return READ_TREE_RECURSIVE;
- len = baselen + strlen(pathname);
+ len = base->len + strlen(pathname);
ce = xcalloc(1, cache_entry_size(len));
hashcpy(ce->sha1, sha1);
- memcpy(ce->name, base, baselen);
- memcpy(ce->name + baselen, pathname, len - baselen);
+ memcpy(ce->name, base->buf, base->len);
+ memcpy(ce->name + base->len, pathname, len - base->len);
ce->ce_flags = create_ce_flags(0) | CE_UPDATE;
ce->ce_namelen = len;
ce->ce_mode = create_ce_mode(mode);