From 64da3ae5c188b2b09bc1ed1eedca7e84c1aff940 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 6 Jan 2010 23:51:47 -0800 Subject: checkout -m: do not try to fall back to --merge from an unborn branch If switching from an unborn branch (= empty tree) to a valid commit failed without -m, it would fail with -m option as well. Signed-off-by: Junio C Hamano --- builtin-checkout.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/builtin-checkout.c b/builtin-checkout.c index c107fd643a..b76cd22776 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -272,7 +272,7 @@ static int merge_working_tree(struct checkout_opts *opts, topts.initial_checkout = is_cache_unborn(); topts.update = 1; topts.merge = 1; - topts.gently = opts->merge; + topts.gently = opts->merge && old->commit; topts.verbose_update = !opts->quiet; topts.fn = twoway_merge; topts.dir = xcalloc(1, sizeof(*topts.dir)); @@ -294,7 +294,13 @@ static int merge_working_tree(struct checkout_opts *opts, struct tree *work; if (!opts->merge) 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 */ -- cgit v1.2.3 From efc266e8aedfd6c5011ea645a85e0744aaecb5d1 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 9 Jan 2010 20:59:41 -0600 Subject: Documentation: git gc packs refs by default now In commit 56752391 (Make "git gc" pack all refs by default, 2007-05-24), 'git gc' was changed to run pack-refs by default Versions before v1.5.1.2 cannot clone repos with packed refs over http, and versions before v1.4.4 cannot handled packed refs at all, but more recent git should have no problems. Try to make this more clear in the git-config manual. The analagous passage in git-gc.txt was updated already with commit fe2128a (Change git-gc documentation to reflect gc.packrefs implementation., 2008-01-09). Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/config.txt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index b5b27ba8d3..bcfed1c11d 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -875,15 +875,12 @@ gc.autopacklimit:: default value is 50. Setting this to 0 disables it. gc.packrefs:: - 'git-gc' does not run `git pack-refs` in a bare repository by - default so that older dumb-transport clients can still fetch - from the repository. Setting this to `true` lets 'git-gc' - to run `git pack-refs`. Setting this to `false` tells - 'git-gc' never to run `git pack-refs`. The default setting is - `notbare`. Enable it only when you know you do not have to - 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'. + Running `git pack-refs` in a repository renders it + unclonable by Git versions prior to 1.5.1.2 over dumb + transports such as HTTP. This variable determines whether + 'git gc' runs `git pack-refs`. This can be set to "nobare" + to enable it within all non-bare repos or it can be set to a + boolean value. The default is `true`. gc.pruneexpire:: When 'git-gc' is run, it will call 'prune --expire 2.weeks.ago'. -- cgit v1.2.3 From 578b62bfa239caca89e37fca05dcbed5add17699 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 9 Jan 2010 21:01:21 -0600 Subject: Documentation: tiny git config manual tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As a verb, 'setup' is spelled 'set up'. “diff commands such as diff-files” scans better without a comma. Clarify that shallow and deep are special non-boolean values for format.thread rather than boolean values with some other name. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/config.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index bcfed1c11d..f7728ec40c 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -537,7 +537,7 @@ apply.whitespace:: as the '--whitespace' option. See linkgit:git-apply[1]. 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 starting point branch. Note that even if this option is not set, 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 index. This option defaults to true. Note that this 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:: If this config variable is set, diff generation is not @@ -841,8 +841,8 @@ format.pretty:: format.thread:: The default threading style for 'git-format-patch'. Can be - either a boolean value, `shallow` or `deep`. `shallow` - threading makes every mail a reply to the head of the series, + a boolean value, or `shallow` or `deep`. `shallow` threading + makes every mail a reply to the head of the series, where the head is chosen from the cover letter, the `\--in-reply-to`, and the first patch mail, in this order. `deep` threading makes every mail a reply to the previous one. -- cgit v1.2.3 From 75b7e16b6ea49d0a0da821373ae5ee3a0ee36f2e Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Fri, 8 Jan 2010 14:39:58 +0100 Subject: base85 debug code: Fix length byte calculation Signed-off-by: Andreas Gruenbacher Signed-off-by: Junio C Hamano --- base85.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base85.c b/base85.c index b88270f908..7b76542531 100644 --- a/base85.c +++ b/base85.c @@ -118,7 +118,7 @@ int main(int ac, char **av) int len = strlen(av[2]); encode_85(buf, av[2], len); 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); return 0; } -- cgit v1.2.3 From b0bec518aa4a90485c411cebc7260425271af949 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Fri, 8 Jan 2010 17:22:18 +0100 Subject: base85: encode_85() does not use the decode table Signed-off-by: Andreas Gruenbacher Signed-off-by: Junio C Hamano --- base85.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/base85.c b/base85.c index 7b76542531..f2b9a24d5e 100644 --- a/base85.c +++ b/base85.c @@ -84,8 +84,6 @@ int decode_85(char *dst, const char *buffer, int len) void encode_85(char *buf, const unsigned char *data, int bytes) { - prep_base85(); - say("encode 85"); while (bytes) { unsigned acc = 0; -- cgit v1.2.3 From 0606c36a73449e76d8f6133253c1eff291ee8c97 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Fri, 8 Jan 2010 14:40:00 +0100 Subject: base85: Make the code more obvious instead of explaining the non-obvious Here is another cleanup ... Signed-off-by: Andreas Gruenbacher Signed-off-by: Junio C Hamano --- base85.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/base85.c b/base85.c index f2b9a24d5e..24ddf60eb0 100644 --- a/base85.c +++ b/base85.c @@ -57,14 +57,8 @@ int decode_85(char *dst, const char *buffer, int len) de = de85[ch]; if (--de < 0) return error("invalid base85 alphabet %c", ch); - /* - * Detect overflow. The largest - * 5-letter possible is "|NsC0" to - * encode 0xffffffff, and "|NsC" gives - * 0x03030303 at this point (i.e. - * 0xffffffff = 0x03030303 * 85). - */ - if (0x03030303 < acc || + /* Detect overflow. */ + if (0xffffffff / 85 < acc || 0xffffffff - de < (acc *= 85)) return error("invalid base85 sequence %.5s", buffer-5); acc += de; -- cgit v1.2.3