Skip to content

Commit fd60aca

Browse files
author
Junio C Hamano
committed
Merge branch 'fix'
* fix: repack: honor -d even when no new pack was created clone: keep --reference even with -l -s repo-config: document what value_regexp does a bit more clearly. Release config lock if the regex is invalid core-tutorial.txt: escape asterisk
2 parents d92f1dc + 178613c commit fd60aca

File tree

6 files changed

+94
-13
lines changed

6 files changed

+94
-13
lines changed

Documentation/core-tutorial.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ $ git show-branch --topo-order master mybranch
971971
The first two lines indicate that it is showing the two branches
972972
and the first line of the commit log message from their
973973
top-of-the-tree commits, you are currently on `master` branch
974-
(notice the asterisk `*` character), and the first column for
974+
(notice the asterisk `\*` character), and the first column for
975975
the later output lines is used to show commits contained in the
976976
`master` branch, and the second column for the `mybranch`
977977
branch. Three commits are shown along with their log messages.

Documentation/git-repo-config.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ You can query/set/replace/unset options with this command. The name is
2323
actually the section and the key separated by a dot, and the value will be
2424
escaped.
2525

26-
If you want to set/unset an option which can occur on multiple lines, you
27-
should provide a POSIX regex for the value. If you want to handle the lines
28-
*not* matching the regex, just prepend a single exclamation mark in front
29-
(see EXAMPLES).
26+
If you want to set/unset an option which can occur on multiple
27+
lines, a POSIX regexp `value_regex` needs to be given. Only the
28+
existing values that match the regexp are updated or unset. If
29+
you want to handle the lines that do *not* match the regex, just
30+
prepend a single exclamation mark in front (see EXAMPLES).
3031

3132
The type specifier can be either '--int' or '--bool', which will make
3233
'git-repo-config' ensure that the variable(s) are of the given type and

config.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ int git_config_set_multivar(const char* key, const char* value,
516516
fprintf(stderr, "Invalid pattern: %s\n",
517517
value_regex);
518518
free(store.value_regex);
519+
close(fd);
520+
unlink(lock_file);
519521
ret = 6;
520522
goto out_free;
521523
}

git-clone.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ yes,yes)
265265
test -f "$repo/objects/info/alternates" &&
266266
cat "$repo/objects/info/alternates";
267267
echo "$repo/objects"
268-
} >"$GIT_DIR/objects/info/alternates"
268+
} >>"$GIT_DIR/objects/info/alternates"
269269
;;
270270
esac
271271
git-ls-remote "$repo" >"$GIT_DIR/CLONE_HEAD"

git-repack.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ name=$(git-rev-list --objects --all $rev_list 2>&1 |
4848
exit 1
4949
if [ -z "$name" ]; then
5050
echo Nothing new to pack.
51-
exit 0
52-
fi
53-
echo "Pack pack-$name created."
51+
else
52+
echo "Pack pack-$name created."
5453

55-
mkdir -p "$PACKDIR" || exit
54+
mkdir -p "$PACKDIR" || exit
5655

57-
mv .tmp-pack-$name.pack "$PACKDIR/pack-$name.pack" &&
58-
mv .tmp-pack-$name.idx "$PACKDIR/pack-$name.idx" ||
59-
exit
56+
mv .tmp-pack-$name.pack "$PACKDIR/pack-$name.pack" &&
57+
mv .tmp-pack-$name.idx "$PACKDIR/pack-$name.idx" ||
58+
exit
59+
fi
6060

6161
if test "$remove_redundant" = t
6262
then

t/t5700-clone-reference.sh

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (C) 2006 Martin Waitz <tali@admingilde.org>
4+
#
5+
6+
test_description='test clone --reference'
7+
. ./test-lib.sh
8+
9+
base_dir=`pwd`
10+
11+
test_expect_success 'preparing first repository' \
12+
'test_create_repo A && cd A &&
13+
echo first > file1 &&
14+
git add file1 &&
15+
git commit -m initial'
16+
17+
cd "$base_dir"
18+
19+
test_expect_success 'preparing second repository' \
20+
'git clone A B && cd B &&
21+
echo second > file2 &&
22+
git add file2 &&
23+
git commit -m addition &&
24+
git repack -a -d &&
25+
git prune'
26+
27+
cd "$base_dir"
28+
29+
test_expect_success 'cloning with reference' \
30+
'git clone -l -s --reference B A C'
31+
32+
cd "$base_dir"
33+
34+
test_expect_success 'existance of info/alternates' \
35+
'test `wc -l <C/.git/objects/info/alternates` = 2'
36+
37+
cd "$base_dir"
38+
39+
test_expect_success 'pulling from reference' \
40+
'cd C &&
41+
git pull ../B'
42+
43+
cd "$base_dir"
44+
45+
test_expect_success 'that reference gets used' \
46+
'cd C &&
47+
echo "0 objects, 0 kilobytes" > expected &&
48+
git count-objects > current &&
49+
diff expected current'
50+
51+
cd "$base_dir"
52+
53+
test_expect_success 'updating origin' \
54+
'cd A &&
55+
echo third > file3 &&
56+
git add file3 &&
57+
git commit -m update &&
58+
git repack -a -d &&
59+
git prune'
60+
61+
cd "$base_dir"
62+
63+
test_expect_success 'pulling changes from origin' \
64+
'cd C &&
65+
git pull origin'
66+
67+
cd "$base_dir"
68+
69+
# the 2 local objects are commit and tree from the merge
70+
test_expect_success 'that alternate to origin gets used' \
71+
'cd C &&
72+
echo "2 objects" > expected &&
73+
git count-objects | cut -d, -f1 > current &&
74+
diff expected current'
75+
76+
cd "$base_dir"
77+
78+
test_done

0 commit comments

Comments
 (0)