summaryrefslogtreecommitdiff
path: root/index-pack.c
diff options
context:
space:
mode:
authorRene Scharfe <rene.scharfe@lsrfire.ath.cx>2006-08-10 17:02:30 +0200
committerJunio C Hamano <junkio@cox.net>2006-08-10 14:13:53 -0700
commit83a2b841d6b90e6f4b797df40ed3a105364574b6 (patch)
tree06b21e14a70cde595570d2b7948245b26995dbb8 /index-pack.c
parent242abf106c6929028c2dc916504879885cd64d4d (diff)
downloadgit-83a2b841d6b90e6f4b797df40ed3a105364574b6.tar.gz
Add has_extension()
The little helper has_extension() documents through its name what we are trying to do and makes sure we don't forget the underrun check. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'index-pack.c')
-rw-r--r--index-pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/index-pack.c b/index-pack.c
index b39953dc69..a91e39ecd6 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -447,7 +447,7 @@ int main(int argc, char **argv)
usage(index_pack_usage);
if (!index_name) {
int len = strlen(pack_name);
- if (len < 5 || strcmp(pack_name + len - 5, ".pack"))
+ if (!has_extension(pack_name, len, ".pack"))
die("packfile name '%s' does not end with '.pack'",
pack_name);
index_name_buf = xmalloc(len);