Skip to content

Commit 82bc9f5

Browse files
committed
Merge branch 'maint'
* maint: clone: Quote user supplied path in a single quote pair read-cache.c: fix index memory allocation
2 parents 997a194 + a76a326 commit 82bc9f5

File tree

3 files changed

+55
-5
lines changed

3 files changed

+55
-5
lines changed

builtin/clone.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
577577

578578
if (0 <= option_verbosity) {
579579
if (option_bare)
580-
printf(_("Cloning into bare repository %s...\n"), dir);
580+
printf(_("Cloning into bare repository '%s'...\n"), dir);
581581
else
582-
printf(_("Cloning into %s...\n"), dir);
582+
printf(_("Cloning into '%s'...\n"), dir);
583583
}
584584
init_db(option_template, INIT_DB_QUIET);
585585
write_config(&option_config);

read-cache.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,9 +1249,9 @@ static void convert_from_disk(struct ondisk_cache_entry *ondisk, struct cache_en
12491249

12501250
static inline size_t estimate_cache_size(size_t ondisk_size, unsigned int entries)
12511251
{
1252-
long per_entry;
1253-
1254-
per_entry = sizeof(struct cache_entry) - sizeof(struct ondisk_cache_entry);
1252+
size_t fix_size_mem = offsetof(struct cache_entry, name);
1253+
size_t fix_size_dsk = offsetof(struct ondisk_cache_entry, name);
1254+
long per_entry = (fix_size_mem - fix_size_dsk + 7) & ~7;
12551255

12561256
/*
12571257
* Alignment can cause differences. This should be "alignof", but

t/t7511-status-index.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/sh
2+
3+
test_description='git status with certain file name lengths'
4+
5+
. ./test-lib.sh
6+
7+
files="0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z"
8+
9+
check() {
10+
len=$1
11+
prefix=$2
12+
13+
for i in $files
14+
do
15+
: >$prefix$i
16+
done
17+
18+
test_expect_success "status, filename length $len" "
19+
git add $prefix* &&
20+
git status
21+
"
22+
rm $prefix* .git/index
23+
}
24+
25+
check 1
26+
check 2 p
27+
check 3 pr
28+
check 4 pre
29+
check 5 pref
30+
check 6 prefi
31+
check 7 prefix
32+
check 8 prefix-
33+
check 9 prefix-p
34+
check 10 prefix-pr
35+
check 11 prefix-pre
36+
check 12 prefix-pref
37+
check 13 prefix-prefi
38+
check 14 prefix-prefix
39+
check 15 prefix-prefix-
40+
check 16 prefix-prefix-p
41+
check 17 prefix-prefix-pr
42+
check 18 prefix-prefix-pre
43+
check 19 prefix-prefix-pref
44+
check 20 prefix-prefix-prefi
45+
check 21 prefix-prefix-prefix
46+
check 22 prefix-prefix-prefix-
47+
check 23 prefix-prefix-prefix-p
48+
check 24 prefix-prefix-prefix-pr
49+
50+
test_done

0 commit comments

Comments
 (0)