diff --git a/builtin-add.c b/builtin-add.c
index 866d19dd77e693a1ba77baa802c0e3f3ea85a305..f9a65803d8dcbb9ae7eb3a3c61d8ac345b84d1cd 100644 (file)
--- a/builtin-add.c
+++ b/builtin-add.c
baselen = common_prefix(pathspec);
path = ".";
base = "";
- if (baselen) {
- char *common = xmalloc(baselen + 1);
- memcpy(common, *pathspec, baselen);
- common[baselen] = 0;
- path = base = common;
- }
+ if (baselen)
+ path = base = xmemdupz(*pathspec, baselen);
/* Read the directory and prune it */
read_directory(dir, path, base, baselen, pathspec);
const char *path = p->one->path;
switch (p->status) {
default:
- die("unexpacted diff status %c", p->status);
+ die("unexpected diff status %c", p->status);
case DIFF_STATUS_UNMERGED:
case DIFF_STATUS_MODIFIED:
case DIFF_STATUS_TYPE_CHANGED: