diff options
author | Jeff King <peff@peff.net> | 2010-05-22 02:59:42 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-05-25 09:21:28 -0700 |
commit | 560fb6a183e1cdbc2948b06cc60bba07f79804a6 (patch) | |
tree | bf8d7eb6c7fd8e1501ba500460ea2ca13ce41db8 /git-cvsimport.perl | |
parent | Fix checkout of large files to network shares on Windows XP (diff) | |
download | tgif-560fb6a183e1cdbc2948b06cc60bba07f79804a6.tar.xz |
remove over-eager caching in sha1_file_name
This function takes a sha1 and produces a loose object
filename. It caches the location of the object directory so
that it can fill the sha1 information directly without
allocating a new buffer (and in its original incarnation,
without calling getenv(), though these days we cache that
with the code in environment.c).
This cached base directory can become stale, however, if in
a single process git changes the location of the object
directory (e.g., by running setup_work_tree, which will
chdir to the new worktree).
In most cases this isn't a problem, because we tend to set
up the git repository location and do any chdir()s before
actually looking up any objects, so the first lookup will
cache the correct location. In the case of reset --hard,
however, we do something like:
1. look up the commit object
2. notice we are doing --hard, run setup_work_tree
3. look up the tree object to reset
Step (3) fails because our cache object directory value is
bogus.
This patch simply removes the caching. We use a static
buffer instead of allocating one each time (the original
version treated the malloc'd buffer as a static, so there is
no change in calling semantics).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-cvsimport.perl')
0 files changed, 0 insertions, 0 deletions