summaryrefslogtreecommitdiff
path: root/builtin-tar-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-tar-tree.c')
-rw-r--r--builtin-tar-tree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c
index 5f740cf702..7663b9bd8e 100644
--- a/builtin-tar-tree.c
+++ b/builtin-tar-tree.c
@@ -168,8 +168,9 @@ static int get_path_prefix(const struct strbuf *path, int maxlen)
int i = path->len;
if (i > maxlen)
i = maxlen;
- while (i > 0 && path->buf[i] != '/')
+ do {
i--;
+ } while (i > 0 && path->buf[i] != '/');
return i;
}