summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-18 23:40:22 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-11-18 23:40:22 (GMT)
commitf9039f30d56e3815eaab870d8b19c7b94aded8aa (patch)
tree45749ba15ab38131ad1961630572b93698c06579 /git.c
parent9a888b758f48d88d1e83c9765e33d4452710d5a5 (diff)
downloadgit-f9039f30d56e3815eaab870d8b19c7b94aded8aa.zip
git-f9039f30d56e3815eaab870d8b19c7b94aded8aa.tar.gz
git-f9039f30d56e3815eaab870d8b19c7b94aded8aa.tar.bz2
Do not show .exe in git command list.
Truncate the result from readdir() in the exec-path if they end with .exe, to make it a bit more readable on Cygwin. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git.c')
-rw-r--r--git.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/git.c b/git.c
index b9b8c62..bdd3f8d 100644
--- a/git.c
+++ b/git.c
@@ -59,7 +59,8 @@ static void add_cmdname(const char *name, int len)
if (!ent)
oom();
ent->len = len;
- memcpy(ent->name, name, len+1);
+ memcpy(ent->name, name, len);
+ ent->name[len] = 0;
cmdname[cmdname_cnt++] = ent;
}
@@ -132,6 +133,8 @@ static void list_commands(const char *exec_path, const char *pattern)
continue;
entlen = strlen(de->d_name);
+ if (4 < entlen && !strcmp(de->d_name + entlen - 4, ".exe"))
+ entlen -= 4;
if (longest < entlen)
longest = entlen;