Skip to content

Commit 6cd3729

Browse files
committed
Merge branch 'maint'
* maint: Start 1.6.0.5 cycle Fix pack.packSizeLimit and --max-pack-size handling checkout: Fix "initial checkout" detection Remove the period after the git-check-attr summary Conflicts: RelNotes
2 parents 2baf185 + c14639f commit 6cd3729

File tree

8 files changed

+47
-6
lines changed

8 files changed

+47
-6
lines changed

Documentation/RelNotes-1.6.0.5.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
GIT v1.6.0.5 Release Notes
2+
==========================
3+
4+
Fixes since v1.6.0.4
5+
--------------------
6+
7+
* 'git checkout' used to crash when your HEAD was pointing at a deleted
8+
branch.
9+
10+
* 'git checkout' from an un-checked-out state did not allow switching out
11+
of the current branch.
12+
13+
* 'git pack-objects' did not make its best effort to honor --max-pack-size
14+
option when a single first object already busted the given limit and
15+
placed many objects in a single pack.
16+
17+
* 'make check' cannot be run without sparse; people may have meant to say
18+
'make test' instead, so suggest that.
19+
20+
* Many unsafe call to sprintf() style varargs functions are corrected.
21+

Documentation/git-check-attr.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ git-check-attr(1)
33

44
NAME
55
----
6-
git-check-attr - Display gitattributes information.
6+
git-check-attr - Display gitattributes information
77

88

99
SYNOPSIS

builtin-checkout.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,7 @@ static int merge_working_tree(struct checkout_opts *opts,
397397
}
398398

399399
/* 2-way merge to the new branch */
400-
topts.initial_checkout = (!active_nr &&
401-
(old->commit == new->commit));
400+
topts.initial_checkout = is_cache_unborn();
402401
topts.update = 1;
403402
topts.merge = 1;
404403
topts.gently = opts->merge;

builtin-pack-objects.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,16 @@ static unsigned long write_object(struct sha1file *f,
245245
type = entry->type;
246246

247247
/* write limit if limited packsize and not first object */
248-
limit = pack_size_limit && nr_written ?
249-
pack_size_limit - write_offset : 0;
248+
if (!pack_size_limit || !nr_written)
249+
limit = 0;
250+
else if (pack_size_limit <= write_offset)
251+
/*
252+
* the earlier object did not fit the limit; avoid
253+
* mistaking this with unlimited (i.e. limit = 0).
254+
*/
255+
limit = 1;
256+
else
257+
limit = pack_size_limit - write_offset;
250258

251259
if (!entry->delta)
252260
usable_delta = 0; /* no delta */

builtin-read-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
206206
break;
207207
case 2:
208208
opts.fn = twoway_merge;
209-
opts.initial_checkout = !active_nr;
209+
opts.initial_checkout = is_cache_unborn();
210210
break;
211211
case 3:
212212
default:

cache.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ static inline void remove_name_hash(struct cache_entry *ce)
262262

263263
#define read_cache() read_index(&the_index)
264264
#define read_cache_from(path) read_index_from(&the_index, (path))
265+
#define is_cache_unborn() is_index_unborn(&the_index)
265266
#define read_cache_unmerged() read_index_unmerged(&the_index)
266267
#define write_cache(newfd, cache, entries) write_index(&the_index, (newfd))
267268
#define discard_cache() discard_index(&the_index)
@@ -368,6 +369,7 @@ extern int init_db(const char *template_dir, unsigned int flags);
368369
/* Initialize and use the cache information */
369370
extern int read_index(struct index_state *);
370371
extern int read_index_from(struct index_state *, const char *path);
372+
extern int is_index_unborn(struct index_state *);
371373
extern int read_index_unmerged(struct index_state *);
372374
extern int write_index(const struct index_state *, int newfd);
373375
extern int discard_index(struct index_state *);

read-cache.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,11 @@ int read_index_from(struct index_state *istate, const char *path)
12691269
die("index file corrupt");
12701270
}
12711271

1272+
int is_index_unborn(struct index_state *istate)
1273+
{
1274+
return (!istate->cache_nr && !istate->alloc && !istate->timestamp);
1275+
}
1276+
12721277
int discard_index(struct index_state *istate)
12731278
{
12741279
istate->cache_nr = 0;

t/t5300-pack-object.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,4 +376,10 @@ test_expect_success 'index-pack with --strict' '
376376
)
377377
'
378378

379+
test_expect_success 'tolerate absurdly small packsizelimit' '
380+
git config pack.packSizeLimit 2 &&
381+
packname_9=$(git pack-objects test-9 <obj-list) &&
382+
test $(wc -l <obj-list) = $(ls test-9-*.pack | wc -l)
383+
'
384+
379385
test_done

0 commit comments

Comments
 (0)