Skip to content

Commit 83b10ca

Browse files
committed
Merge branch 'maint'
* maint: base85: Make the code more obvious instead of explaining the non-obvious base85: encode_85() does not use the decode table base85 debug code: Fix length byte calculation Documentation: tiny git config manual tweaks Documentation: git gc packs refs by default now checkout -m: do not try to fall back to --merge from an unborn branch
2 parents 15515b7 + 8fb5d44 commit 83b10ca

File tree

3 files changed

+21
-26
lines changed

3 files changed

+21
-26
lines changed

Documentation/config.txt

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ apply.whitespace::
537537
as the '--whitespace' option. See linkgit:git-apply[1].
538538

539539
branch.autosetupmerge::
540-
Tells 'git-branch' and 'git-checkout' to setup new branches
540+
Tells 'git-branch' and 'git-checkout' to set up new branches
541541
so that linkgit:git-pull[1] will appropriately merge from the
542542
starting point branch. Note that even if this option is not set,
543543
this behavior can be chosen per-branch using the `--track`
@@ -725,7 +725,7 @@ diff.autorefreshindex::
725725
contents in the work tree match the contents in the
726726
index. This option defaults to true. Note that this
727727
affects only 'git-diff' Porcelain, and not lower level
728-
'diff' commands, such as 'git-diff-files'.
728+
'diff' commands such as 'git-diff-files'.
729729

730730
diff.external::
731731
If this config variable is set, diff generation is not
@@ -841,8 +841,8 @@ format.pretty::
841841

842842
format.thread::
843843
The default threading style for 'git-format-patch'. Can be
844-
either a boolean value, `shallow` or `deep`. `shallow`
845-
threading makes every mail a reply to the head of the series,
844+
a boolean value, or `shallow` or `deep`. `shallow` threading
845+
makes every mail a reply to the head of the series,
846846
where the head is chosen from the cover letter, the
847847
`\--in-reply-to`, and the first patch mail, in this order.
848848
`deep` threading makes every mail a reply to the previous one.
@@ -875,15 +875,12 @@ gc.autopacklimit::
875875
default value is 50. Setting this to 0 disables it.
876876

877877
gc.packrefs::
878-
'git-gc' does not run `git pack-refs` in a bare repository by
879-
default so that older dumb-transport clients can still fetch
880-
from the repository. Setting this to `true` lets 'git-gc'
881-
to run `git pack-refs`. Setting this to `false` tells
882-
'git-gc' never to run `git pack-refs`. The default setting is
883-
`notbare`. Enable it only when you know you do not have to
884-
support such clients. The default setting will change to `true`
885-
at some stage, and setting this to `false` will continue to
886-
prevent `git pack-refs` from being run from 'git-gc'.
878+
Running `git pack-refs` in a repository renders it
879+
unclonable by Git versions prior to 1.5.1.2 over dumb
880+
transports such as HTTP. This variable determines whether
881+
'git gc' runs `git pack-refs`. This can be set to "nobare"
882+
to enable it within all non-bare repos or it can be set to a
883+
boolean value. The default is `true`.
887884

888885
gc.pruneexpire::
889886
When 'git-gc' is run, it will call 'prune --expire 2.weeks.ago'.

base85.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,8 @@ int decode_85(char *dst, const char *buffer, int len)
5757
de = de85[ch];
5858
if (--de < 0)
5959
return error("invalid base85 alphabet %c", ch);
60-
/*
61-
* Detect overflow. The largest
62-
* 5-letter possible is "|NsC0" to
63-
* encode 0xffffffff, and "|NsC" gives
64-
* 0x03030303 at this point (i.e.
65-
* 0xffffffff = 0x03030303 * 85).
66-
*/
67-
if (0x03030303 < acc ||
60+
/* Detect overflow. */
61+
if (0xffffffff / 85 < acc ||
6862
0xffffffff - de < (acc *= 85))
6963
return error("invalid base85 sequence %.5s", buffer-5);
7064
acc += de;
@@ -84,8 +78,6 @@ int decode_85(char *dst, const char *buffer, int len)
8478

8579
void encode_85(char *buf, const unsigned char *data, int bytes)
8680
{
87-
prep_base85();
88-
8981
say("encode 85");
9082
while (bytes) {
9183
unsigned acc = 0;
@@ -118,7 +110,7 @@ int main(int ac, char **av)
118110
int len = strlen(av[2]);
119111
encode_85(buf, av[2], len);
120112
if (len <= 26) len = len + 'A' - 1;
121-
else len = len + 'a' - 26 + 1;
113+
else len = len + 'a' - 26 - 1;
122114
printf("encoded: %c%s\n", len, buf);
123115
return 0;
124116
}

builtin-checkout.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static int merge_working_tree(struct checkout_opts *opts,
397397
topts.initial_checkout = is_cache_unborn();
398398
topts.update = 1;
399399
topts.merge = 1;
400-
topts.gently = opts->merge;
400+
topts.gently = opts->merge && old->commit;
401401
topts.verbose_update = !opts->quiet;
402402
topts.fn = twoway_merge;
403403
topts.dir = xcalloc(1, sizeof(*topts.dir));
@@ -422,7 +422,13 @@ static int merge_working_tree(struct checkout_opts *opts,
422422
struct merge_options o;
423423
if (!opts->merge)
424424
return 1;
425-
parse_commit(old->commit);
425+
426+
/*
427+
* Without old->commit, the below is the same as
428+
* the two-tree unpack we already tried and failed.
429+
*/
430+
if (!old->commit)
431+
return 1;
426432

427433
/* Do more real merge */
428434

0 commit comments

Comments
 (0)