Skip to content

Commit 30aa4fb

Browse files
committed
Merge branch 'maint'
* maint: Prepare for 1.6.1.4. Make repack less likely to corrupt repository fast-export: ensure we traverse commits in topological order Clear the delta base cache if a pack is rebuilt Conflicts: RelNotes
2 parents 0ea29cc + e5887c1 commit 30aa4fb

File tree

4 files changed

+88
-20
lines changed

4 files changed

+88
-20
lines changed

Documentation/RelNotes-1.6.1.4.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
GIT v1.6.1.4 Release Notes
2+
==========================
3+
4+
Fixes since v1.6.1.3
5+
--------------------
6+
7+
* "git fast-export" produced wrong output with some parents missing from
8+
commits, when the history is clock-skewed.
9+
10+
* "git fast-import" sometimes failed to read back objects it just wrote
11+
out and aborted, because it failed to flush stale cached data.
12+
13+
* "git repack" did not error out when necessary object was missing in the
14+
repository.
15+
16+
Also includes minor documentation fixes and updates.
17+
18+
--
19+
git shortlog --no-merges v1.6.1.3..

builtin-fast-export.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
514514

515515
get_tags_and_duplicates(&revs.pending, &extra_refs);
516516

517+
revs.topo_order = 1;
517518
if (prepare_revision_walk(&revs))
518519
die("revision walk setup failed");
519520
revs.diffopt.format_callback = show_filemodify;

git-repack.sh

Lines changed: 67 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,32 +88,79 @@ if [ -z "$names" ]; then
8888
echo Nothing new to pack.
8989
fi
9090
fi
91-
for name in $names ; do
92-
fullbases="$fullbases pack-$name"
93-
chmod a-w "$PACKTMP-$name.pack"
94-
chmod a-w "$PACKTMP-$name.idx"
95-
mkdir -p "$PACKDIR" || exit
9691

92+
# Ok we have prepared all new packfiles.
93+
mkdir -p "$PACKDIR" || exit
94+
95+
# First see if there are packs of the same name and if so
96+
# if we can move them out of the way (this can happen if we
97+
# repacked immediately after packing fully.
98+
rollback=
99+
failed=
100+
for name in $names
101+
do
97102
for sfx in pack idx
98103
do
99-
if test -f "$PACKDIR/pack-$name.$sfx"
100-
then
101-
mv -f "$PACKDIR/pack-$name.$sfx" \
102-
"$PACKDIR/old-pack-$name.$sfx"
103-
fi
104-
done &&
104+
file=pack-$name.$sfx
105+
test -f "$PACKDIR/$file" || continue
106+
rm -f "$PACKDIR/old-$file" &&
107+
mv "$PACKDIR/$file" "$PACKDIR/old-$file" || {
108+
failed=t
109+
break
110+
}
111+
rollback="$rollback $file"
112+
done
113+
test -z "$failed" || break
114+
done
115+
116+
# If renaming failed for any of them, roll the ones we have
117+
# already renamed back to their original names.
118+
if test -n "$failed"
119+
then
120+
rollback_failure=
121+
for file in $rollback
122+
do
123+
mv "$PACKDIR/old-$file" "$PACKDIR/$file" ||
124+
rollback_failure="$rollback_failure $file"
125+
done
126+
if test -n "$rollback_failure"
127+
then
128+
echo >&2 "WARNING: Some packs in use have been renamed by"
129+
echo >&2 "WARNING: prefixing old- to their name, in order to"
130+
echo >&2 "WARNING: replace them with the new version of the"
131+
echo >&2 "WARNING: file. But the operation failed, and"
132+
echo >&2 "WARNING: attempt to rename them back to their"
133+
echo >&2 "WARNING: original names also failed."
134+
echo >&2 "WARNING: Please rename them in $PACKDIR manually:"
135+
for file in $rollback_failure
136+
do
137+
echo >&2 "WARNING: old-$file -> $file"
138+
done
139+
fi
140+
exit 1
141+
fi
142+
143+
# Now the ones with the same name are out of the way...
144+
fullbases=
145+
for name in $names
146+
do
147+
fullbases="$fullbases pack-$name"
148+
chmod a-w "$PACKTMP-$name.pack"
149+
chmod a-w "$PACKTMP-$name.idx"
105150
mv -f "$PACKTMP-$name.pack" "$PACKDIR/pack-$name.pack" &&
106-
mv -f "$PACKTMP-$name.idx" "$PACKDIR/pack-$name.idx" &&
107-
test -f "$PACKDIR/pack-$name.pack" &&
108-
test -f "$PACKDIR/pack-$name.idx" || {
109-
echo >&2 "Couldn't replace the existing pack with updated one."
110-
echo >&2 "The original set of packs have been saved as"
111-
echo >&2 "old-pack-$name.{pack,idx} in $PACKDIR."
112-
exit 1
113-
}
114-
rm -f "$PACKDIR/old-pack-$name.pack" "$PACKDIR/old-pack-$name.idx"
151+
mv -f "$PACKTMP-$name.idx" "$PACKDIR/pack-$name.idx" ||
152+
exit
153+
done
154+
155+
# Remove the "old-" files
156+
for name in $names
157+
do
158+
rm -f "$PACKDIR/old-pack-$name.idx"
159+
rm -f "$PACKDIR/old-pack-$name.pack"
115160
done
116161

162+
# End of pack replacement.
163+
117164
if test "$remove_redundant" = t
118165
then
119166
# We know $existing are all redundant.

sha1_file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@ void free_pack_by_name(const char *pack_name)
689689
while (*pp) {
690690
p = *pp;
691691
if (strcmp(pack_name, p->pack_name) == 0) {
692+
clear_delta_base_cache();
692693
close_pack_windows(p);
693694
if (p->pack_fd != -1)
694695
close(p->pack_fd);

0 commit comments

Comments
 (0)