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
This commit is contained in:
Junio C Hamano
2010-01-10 00:52:04 -08:00
3 changed files with 21 additions and 26 deletions

View File

@ -537,7 +537,7 @@ apply.whitespace::
as the '--whitespace' option. See linkgit:git-apply[1]. as the '--whitespace' option. See linkgit:git-apply[1].
branch.autosetupmerge:: branch.autosetupmerge::
Tells 'git-branch' and 'git-checkout' to setup new branches Tells 'git-branch' and 'git-checkout' to set up new branches
so that linkgit:git-pull[1] will appropriately merge from the so that linkgit:git-pull[1] will appropriately merge from the
starting point branch. Note that even if this option is not set, starting point branch. Note that even if this option is not set,
this behavior can be chosen per-branch using the `--track` this behavior can be chosen per-branch using the `--track`
@ -725,7 +725,7 @@ diff.autorefreshindex::
contents in the work tree match the contents in the contents in the work tree match the contents in the
index. This option defaults to true. Note that this index. This option defaults to true. Note that this
affects only 'git-diff' Porcelain, and not lower level affects only 'git-diff' Porcelain, and not lower level
'diff' commands, such as 'git-diff-files'. 'diff' commands such as 'git-diff-files'.
diff.external:: diff.external::
If this config variable is set, diff generation is not If this config variable is set, diff generation is not
@ -841,8 +841,8 @@ format.pretty::
format.thread:: format.thread::
The default threading style for 'git-format-patch'. Can be The default threading style for 'git-format-patch'. Can be
either a boolean value, `shallow` or `deep`. `shallow` a boolean value, or `shallow` or `deep`. `shallow` threading
threading makes every mail a reply to the head of the series, makes every mail a reply to the head of the series,
where the head is chosen from the cover letter, the where the head is chosen from the cover letter, the
`\--in-reply-to`, and the first patch mail, in this order. `\--in-reply-to`, and the first patch mail, in this order.
`deep` threading makes every mail a reply to the previous one. `deep` threading makes every mail a reply to the previous one.
@ -875,15 +875,12 @@ gc.autopacklimit::
default value is 50. Setting this to 0 disables it. default value is 50. Setting this to 0 disables it.
gc.packrefs:: gc.packrefs::
'git-gc' does not run `git pack-refs` in a bare repository by Running `git pack-refs` in a repository renders it
default so that older dumb-transport clients can still fetch unclonable by Git versions prior to 1.5.1.2 over dumb
from the repository. Setting this to `true` lets 'git-gc' transports such as HTTP. This variable determines whether
to run `git pack-refs`. Setting this to `false` tells 'git gc' runs `git pack-refs`. This can be set to "nobare"
'git-gc' never to run `git pack-refs`. The default setting is to enable it within all non-bare repos or it can be set to a
`notbare`. Enable it only when you know you do not have to boolean value. The default is `true`.
support such clients. The default setting will change to `true`
at some stage, and setting this to `false` will continue to
prevent `git pack-refs` from being run from 'git-gc'.
gc.pruneexpire:: gc.pruneexpire::
When 'git-gc' is run, it will call 'prune --expire 2.weeks.ago'. When 'git-gc' is run, it will call 'prune --expire 2.weeks.ago'.

View File

@ -57,14 +57,8 @@ int decode_85(char *dst, const char *buffer, int len)
de = de85[ch]; de = de85[ch];
if (--de < 0) if (--de < 0)
return error("invalid base85 alphabet %c", ch); return error("invalid base85 alphabet %c", ch);
/* /* Detect overflow. */
* Detect overflow. The largest if (0xffffffff / 85 < acc ||
* 5-letter possible is "|NsC0" to
* encode 0xffffffff, and "|NsC" gives
* 0x03030303 at this point (i.e.
* 0xffffffff = 0x03030303 * 85).
*/
if (0x03030303 < acc ||
0xffffffff - de < (acc *= 85)) 0xffffffff - de < (acc *= 85))
return error("invalid base85 sequence %.5s", buffer-5); return error("invalid base85 sequence %.5s", buffer-5);
acc += de; acc += de;
@ -84,8 +78,6 @@ int decode_85(char *dst, const char *buffer, int len)
void encode_85(char *buf, const unsigned char *data, int bytes) void encode_85(char *buf, const unsigned char *data, int bytes)
{ {
prep_base85();
say("encode 85"); say("encode 85");
while (bytes) { while (bytes) {
unsigned acc = 0; unsigned acc = 0;
@ -118,7 +110,7 @@ int main(int ac, char **av)
int len = strlen(av[2]); int len = strlen(av[2]);
encode_85(buf, av[2], len); encode_85(buf, av[2], len);
if (len <= 26) len = len + 'A' - 1; if (len <= 26) len = len + 'A' - 1;
else len = len + 'a' - 26 + 1; else len = len + 'a' - 26 - 1;
printf("encoded: %c%s\n", len, buf); printf("encoded: %c%s\n", len, buf);
return 0; return 0;
} }

View File

@ -397,7 +397,7 @@ static int merge_working_tree(struct checkout_opts *opts,
topts.initial_checkout = is_cache_unborn(); topts.initial_checkout = is_cache_unborn();
topts.update = 1; topts.update = 1;
topts.merge = 1; topts.merge = 1;
topts.gently = opts->merge; topts.gently = opts->merge && old->commit;
topts.verbose_update = !opts->quiet; topts.verbose_update = !opts->quiet;
topts.fn = twoway_merge; topts.fn = twoway_merge;
topts.dir = xcalloc(1, sizeof(*topts.dir)); topts.dir = xcalloc(1, sizeof(*topts.dir));
@ -422,7 +422,13 @@ static int merge_working_tree(struct checkout_opts *opts,
struct merge_options o; struct merge_options o;
if (!opts->merge) if (!opts->merge)
return 1; return 1;
parse_commit(old->commit);
/*
* Without old->commit, the below is the same as
* the two-tree unpack we already tried and failed.
*/
if (!old->commit)
return 1;
/* Do more real merge */ /* Do more real merge */