author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Fri, 18 May 2007 22:09:41 +0000 (00:09 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 18 May 2007 23:36:45 +0000 (16:36 -0700) | ||
commit | 5e6cfc80e26a4d0ebac38cff74c2cdebbe66cd27 | |
tree | 6f816b7b8ea0c284aa9c25c440ecca64c514b83c | tree | snapshot |
parent | 4229aa5141b5d7716d283fa8625209b59398d7ba | commit | diff |
git-archive: convert archive entries like checkouts do
As noted by Johan Herland, git-archive is a kind of checkout and needs
to apply any checkout filters that might be configured.
This patch adds the convenience function convert_sha1_file which returns
a buffer containing the object's contents, after converting, if necessary
(i.e. it's a combination of read_sha1_file and convert_to_working_tree).
Direct calls to read_sha1_file in git-archive are then replaced by calls
to convert_sha1_file.
Since convert_sha1_file expects its path argument to be NUL-terminated --
a convention it inherits from convert_to_working_tree -- the patch also
changes the path handling in archive-tar.c to always NUL-terminate the
string. It used to solely rely on the len field of struct strbuf before.
archive-zip.c already NUL-terminates the path and thus needs no such
change.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
As noted by Johan Herland, git-archive is a kind of checkout and needs
to apply any checkout filters that might be configured.
This patch adds the convenience function convert_sha1_file which returns
a buffer containing the object's contents, after converting, if necessary
(i.e. it's a combination of read_sha1_file and convert_to_working_tree).
Direct calls to read_sha1_file in git-archive are then replaced by calls
to convert_sha1_file.
Since convert_sha1_file expects its path argument to be NUL-terminated --
a convention it inherits from convert_to_working_tree -- the patch also
changes the path handling in archive-tar.c to always NUL-terminate the
string. It used to solely rely on the len field of struct strbuf before.
archive-zip.c already NUL-terminates the path and thus needs no such
change.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
archive-tar.c | diff | blob | history | |
archive-zip.c | diff | blob | history | |
cache.h | diff | blob | history | |
convert.c | diff | blob | history |