Code

git.git
13 years agoarchive: don't let remote clients get unreachable commits
Jeff King [Thu, 17 Nov 2011 23:04:22 +0000 (18:04 -0500)]
archive: don't let remote clients get unreachable commits

Usually git is careful not to allow clients to fetch
arbitrary objects from the database; for example, objects
received via upload-pack must be reachable from a ref.
Upload-archive breaks this by feeding the client's tree-ish
directly to get_sha1, which will accept arbitrary hex sha1s,
reflogs, etc.

This is not a problem if all of your objects are publicly
reachable anyway (or at least public to anybody who can run
upload-archive). Or if you are making the repo available by
dumb protocols like http or rsync (in which case the client
can read your whole object db directly).

But for sites which allow access only through smart
protocols, clients may be able to fetch trees from commits
that exist in the server's object database but are not
referenced (e.g., because history was rewound).

This patch tightens upload-archive's lookup to use dwim_ref
rather than get_sha1. This means a remote client can only
fetch the tip of a named ref, not an arbitrary sha1 or
reflog entry.

This also restricts some legitimate requests, too:

  1. Reachable non-tip commits, like:

        git archive --remote=$url v1.0~5

  2. Sub-trees of reachable commits, like:

        git archive --remote=$url v1.7.7:Documentation

Local requests continue to use get_sha1, and are not
restricted at all.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Sun, 10 Jan 2010 08:49:47 +0000 (00:49 -0800)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  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
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails

Conflicts:
diff.c

14 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sun, 10 Jan 2010 08:48:47 +0000 (00:48 -0800)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  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
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".

14 years agobase85: Make the code more obvious instead of explaining the non-obvious
Andreas Gruenbacher [Fri, 8 Jan 2010 13:40:00 +0000 (14:40 +0100)]
base85: Make the code more obvious instead of explaining the non-obvious

Here is another cleanup ...

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobase85: encode_85() does not use the decode table
Andreas Gruenbacher [Fri, 8 Jan 2010 16:22:18 +0000 (17:22 +0100)]
base85: encode_85() does not use the decode table

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobase85 debug code: Fix length byte calculation
Andreas Gruenbacher [Fri, 8 Jan 2010 13:39:58 +0000 (14:39 +0100)]
base85 debug code: Fix length byte calculation

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocheckout -m: do not try to fall back to --merge from an unborn branch
Junio C Hamano [Thu, 7 Jan 2010 07:51:47 +0000 (23:51 -0800)]
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 <gitster@pobox.com>
14 years agobranch: die explicitly why when calling "git branch [-a|-r] branchname".
Matthieu Moy [Wed, 30 Dec 2009 14:45:31 +0000 (15:45 +0100)]
branch: die explicitly why when calling "git branch [-a|-r] branchname".

The -a and -r options used to be silently ignored in such a command.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotextconv: stop leaking file descriptors
Jeff King [Wed, 30 Dec 2009 09:02:53 +0000 (04:02 -0500)]
textconv: stop leaking file descriptors

We read the output from textconv helpers over a pipe, but we
never actually closed our end of the pipe after using it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Wed, 30 Dec 2009 04:16:34 +0000 (20:16 -0800)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  commit: --cleanup is a message option
  t7102: make the test fail if one of its check fails

14 years agocommit: --cleanup is a message option
Greg Price [Tue, 29 Dec 2009 21:54:49 +0000 (16:54 -0500)]
commit: --cleanup is a message option

In the usage message for "git commit", the --cleanup option appeared
at the end, as one of the "contents options":

usage: git commit [options] [--] <filepattern>...
...
Commit message options
...
Commit contents options
...
    --allow-empty         ok to record an empty change
    --cleanup <default>   how to strip spaces and #comments from message

This is confusing, in part because it makes it ambiguous whether
--allow-empty, just above, refers to an empty diff or an empty message.

Move --cleanup into the 'message options' group.  Also add a pair of
comments to prevent similar oversights in the future.

Signed-off-by: Greg Price <price@ksplice.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit count-objects: handle packs bigger than 4G
Andreas Schwab [Tue, 29 Dec 2009 19:09:15 +0000 (20:09 +0100)]
git count-objects: handle packs bigger than 4G

Use off_t to count sizes of packs and objects to avoid overflow after
4Gb.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot7102: make the test fail if one of its check fails
Nguyễn Thái Ngọc Duy [Tue, 29 Dec 2009 08:13:18 +0000 (15:13 +0700)]
t7102: make the test fail if one of its check fails

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-clone: add missing comma in --reference documentation
Miklos Vajna [Thu, 3 Sep 2009 11:24:16 +0000 (13:24 +0200)]
git-clone: add missing comma in --reference documentation

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoclone: disconnect transport after fetching
Jeff King [Wed, 2 Sep 2009 06:36:47 +0000 (02:36 -0400)]
clone: disconnect transport after fetching

The current code just leaves the transport in whatever state
it was in after performing the fetch.  For a non-empty clone
over the git protocol, the transport code already
disconnects at the end of the fetch.

But for an empty clone, we leave the connection hanging, and
eventually close the socket when clone exits. This causes
the remote upload-pack to complain "the remote end hung up
unexpectedly". While this message is harmless to the clone
itself, it is unnecessarily scary for a user to see and may
pollute git-daemon logs.

This patch just explicitly calls disconnect after we are
done with the remote end, which sends a flush packet to
upload-pack and cleanly disconnects, avoiding the error
message.

Other transports are unaffected or slightly improved:

 - for a non-empty repo over the git protocol, the second
   disconnect is a no-op (since we are no longer connected)

 - for "walker" transports (like HTTP or FTP), we actually
   free some used memory (which previously just sat until
   the clone process exits)

 - for "rsync", disconnect is always a no-op anyway

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix overridable written with an extra 'e'
Nanako Shiraishi [Fri, 28 Aug 2009 03:18:49 +0000 (12:18 +0900)]
Fix overridable written with an extra 'e'

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Fri, 28 Aug 2009 03:41:37 +0000 (20:41 -0700)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  Documentation: git-archive: mark --format as optional in summary

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Fri, 28 Aug 2009 03:41:31 +0000 (20:41 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  Documentation: git-archive: mark --format as optional in summary

15 years agoDocumentation: git-archive: mark --format as optional in summary
Wesley J. Landaker [Fri, 28 Aug 2009 02:55:43 +0000 (20:55 -0600)]
Documentation: git-archive: mark --format as optional in summary

The --format option was made optional in 8ff21b1 (git-archive: make
tar the default format, 2007-04-09), but it was not marked as optional
in the summary. This trival patch just changes the summary to match
the rest of the documentation.

Signed-off-by: Wesley J. Landaker <wjl@icecavern.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.5.6' into maint-1.6.0
Junio C Hamano [Fri, 28 Aug 2009 03:03:35 +0000 (20:03 -0700)]
Merge branch 'maint-1.5.6' into maint-1.6.0

* maint-1.5.6:
  revision traversal and pack: notice and die on missing commit

15 years agoRound-down years in "years+months" relative date view
David Reiss [Thu, 27 Aug 2009 23:39:38 +0000 (16:39 -0700)]
Round-down years in "years+months" relative date view

Previously, a commit from 1 year and 7 months ago would display as
"2 years, 7 months ago".

Signed-off-by: David Reiss <dreiss@facebook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Sat, 8 Aug 2009 03:44:09 +0000 (20:44 -0700)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  verify-pack -v: do not report "chain length 0"
  t5510: harden the way verify-pack is used

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sat, 8 Aug 2009 03:44:02 +0000 (20:44 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  verify-pack -v: do not report "chain length 0"
  t5510: harden the way verify-pack is used

15 years agoverify-pack -v: do not report "chain length 0"
Junio C Hamano [Fri, 7 Aug 2009 22:36:31 +0000 (15:36 -0700)]
verify-pack -v: do not report "chain length 0"

When making a histogram of delta chain length in the pack, the program
collects number of objects whose delta depth exceeds the MAX_CHAIN limit
in histogram[0], and showed it as the number of items that exceeds the
limit correctly.  HOWEVER, it also showed the same number labeled as
"chain length = 0".

In fact, we are not showing the number of objects whose chain length is
zero, i.e. the base objects.  Correct this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot5510: harden the way verify-pack is used
Junio C Hamano [Sat, 8 Aug 2009 03:12:13 +0000 (20:12 -0700)]
t5510: harden the way verify-pack is used

The test ignored the exit status from verify pack command, and also relied
on not seeing any delta chain statistics.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Sun, 21 Jun 2009 06:48:28 +0000 (23:48 -0700)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  git-show-ref.txt: remove word and make consistent
  git-svn documentation: fix typo in 'rebase vs. pull/merge' section
  use xstrdup, not strdup in ll-merge.c

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sun, 21 Jun 2009 06:48:21 +0000 (23:48 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  git-show-ref.txt: remove word and make consistent
  git-svn documentation: fix typo in 'rebase vs. pull/merge' section
  use xstrdup, not strdup in ll-merge.c

15 years agogit-show-ref.txt: remove word and make consistent
Stephen Boyd [Sun, 21 Jun 2009 04:40:45 +0000 (21:40 -0700)]
git-show-ref.txt: remove word and make consistent

Under is better than in because of the nested nature of the .git
directory.

"also using" sounds a little odd, plus we say combined with later on so
just use that.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn documentation: fix typo in 'rebase vs. pull/merge' section
Miklos Vajna [Sat, 20 Jun 2009 11:27:15 +0000 (13:27 +0200)]
git-svn documentation: fix typo in 'rebase vs. pull/merge' section

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agouse xstrdup, not strdup in ll-merge.c
Jim Meyering [Sun, 14 Jun 2009 19:47:54 +0000 (21:47 +0200)]
use xstrdup, not strdup in ll-merge.c

Otherwise, a fluky allocation failure would cause merge
configuration settings to be silently ignored.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Sun, 14 Jun 2009 00:09:50 +0000 (17:09 -0700)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  git-rerere.txt: grammatical fixups and cleanups

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sun, 14 Jun 2009 00:09:45 +0000 (17:09 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  git-rerere.txt: grammatical fixups and cleanups
  http-push.c::remove_locks(): fix use after free

15 years agogit-rerere.txt: grammatical fixups and cleanups
Stephen Boyd [Sat, 13 Jun 2009 18:20:00 +0000 (11:20 -0700)]
git-rerere.txt: grammatical fixups and cleanups

Rewrite the gc section using unresolved and resolved instead of "not
recorded". Add plurals and missing articles. Make some sentences have
consistent tense. Try and be more active by removing "that" and
simplifying sentences.

The terms "hand-resolve" and "hand resolve" were used, so just use "hand
resolve" to be more consistent.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Sun, 24 May 2009 22:29:23 +0000 (15:29 -0700)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  http-push.c::remove_locks(): fix use after free

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sun, 24 May 2009 22:29:13 +0000 (15:29 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  http-push.c::remove_locks(): fix use after free

15 years agohttp-push.c::remove_locks(): fix use after free
Alex Riesen [Sun, 24 May 2009 13:16:49 +0000 (15:16 +0200)]
http-push.c::remove_locks(): fix use after free

Noticed and reported by Serhat Şevki Dinçer.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Thu, 14 May 2009 04:06:11 +0000 (21:06 -0700)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  ls-tree manpage: output of ls-tree is compatible with update-index
  ls-tree manpage: use "unless" instead of "when ... is not"

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Thu, 14 May 2009 04:05:59 +0000 (21:05 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  ls-tree manpage: output of ls-tree is compatible with update-index
  ls-tree manpage: use "unless" instead of "when ... is not"

15 years agoMerge branch 'jc/maint-read-tree-multi' into maint-1.6.2
Junio C Hamano [Tue, 12 May 2009 16:58:21 +0000 (09:58 -0700)]
Merge branch 'jc/maint-read-tree-multi' into maint-1.6.2

* jc/maint-read-tree-multi:
  Revert "checkout branch: prime cache-tree fully"

15 years agoRevert "checkout branch: prime cache-tree fully"
Junio C Hamano [Tue, 12 May 2009 16:41:28 +0000 (09:41 -0700)]
Revert "checkout branch: prime cache-tree fully"

The logic in 83ae209 (checkout branch: prime cache-tree fully,
2009-04-20) is bogus; checkout can switch branches with a dirty
index and in such a case the tree won't match HEAD.

Add t2014-switch to catch this breakage.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agols-tree manpage: output of ls-tree is compatible with update-index
Alex Riesen [Sun, 10 May 2009 16:14:49 +0000 (18:14 +0200)]
ls-tree manpage: output of ls-tree is compatible with update-index

Such format relationships are very useful things to remember for
script writers.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agols-tree manpage: use "unless" instead of "when ... is not"
Alex Riesen [Sun, 10 May 2009 16:13:45 +0000 (18:13 +0200)]
ls-tree manpage: use "unless" instead of "when ... is not"

Delayed negation in a statement is harder to spot and keep in mind.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Sat, 9 May 2009 04:13:47 +0000 (21:13 -0700)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sat, 9 May 2009 04:12:41 +0000 (21:12 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  dir.c: Fix two minor grammatical errors in comments

15 years agoMerge branch 'rj/maint-1.6.0-svn-parse-fix' into maint
Junio C Hamano [Wed, 6 May 2009 05:51:49 +0000 (22:51 -0700)]
Merge branch 'rj/maint-1.6.0-svn-parse-fix' into maint

* rj/maint-1.6.0-svn-parse-fix:
  git-svn: fix a sloppy Getopt::Long usage

15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Wed, 6 May 2009 05:51:31 +0000 (22:51 -0700)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  dir.c: Fix two minor grammatical errors in comments

15 years agoimprove error message in config.c
Alex Riesen [Wed, 29 Apr 2009 21:27:54 +0000 (23:27 +0200)]
improve error message in config.c

Show errno if opening a lockfile fails.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot4018-diff-funcname: add cpp xfuncname pattern to syntax test
Brandon Casey [Sat, 2 May 2009 14:31:16 +0000 (09:31 -0500)]
t4018-diff-funcname: add cpp xfuncname pattern to syntax test

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoWork around BSD whose typeof(tv.tv_sec) != time_t
Bernd Ahlers [Mon, 6 Apr 2009 17:26:37 +0000 (19:26 +0200)]
Work around BSD whose typeof(tv.tv_sec) != time_t

According to POSIX, tv_sec is supposed to be a time_t, but OpenBSD
(and FreeBSD, too) defines it to be a long, which triggers a type
mismatch when a pointer to it is given to localtime_r().

Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am.txt: reword extra headers in message body
Stephen Boyd [Mon, 4 May 2009 06:46:58 +0000 (23:46 -0700)]
git-am.txt: reword extra headers in message body

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am.txt: Use date or value instead of time or timestamp
Stephen Boyd [Tue, 5 May 2009 05:19:00 +0000 (22:19 -0700)]
git-am.txt: Use date or value instead of time or timestamp

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am.txt: add an 'a', say what 'it' is, simplify a sentence
Stephen Boyd [Tue, 5 May 2009 05:18:42 +0000 (22:18 -0700)]
git-am.txt: add an 'a', say what 'it' is, simplify a sentence

It's nice to know that 'it' is git-am or the subject line. Whitespace
implies characters so just remove characters.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodir.c: Fix two minor grammatical errors in comments
Allan Caffee [Mon, 4 May 2009 17:37:30 +0000 (13:37 -0400)]
dir.c: Fix two minor grammatical errors in comments

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: fix a sloppy Getopt::Long usage
Robin H. Johnson [Tue, 5 May 2009 18:16:14 +0000 (11:16 -0700)]
git-svn: fix a sloppy Getopt::Long usage

Getopt-Long v2.38 is much stricter about sloppy getopt usage. The
trailing pipe causes git-svn testcases to fail for all of the --stdin
argument calls.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.2.5 v1.6.2.5
Junio C Hamano [Sun, 3 May 2009 23:14:58 +0000 (16:14 -0700)]
GIT 1.6.2.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'np/maint-no-ofs-delta' into maint
Junio C Hamano [Sun, 3 May 2009 23:50:47 +0000 (16:50 -0700)]
Merge branch 'np/maint-no-ofs-delta' into maint

* np/maint-no-ofs-delta:
  honor repack.usedeltabaseoffset when fetching packs

15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Sun, 3 May 2009 23:14:07 +0000 (16:14 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  GIT 1.6.1.4

Conflicts:
GIT-VERSION-GEN

15 years agoGIT 1.6.1.4 v1.6.1.4
Junio C Hamano [Sun, 3 May 2009 22:20:03 +0000 (15:20 -0700)]
GIT 1.6.1.4

With a handful of fixes backmerged from 1.6.2.X series

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/maint-read-tree-multi' into maint
Junio C Hamano [Sun, 3 May 2009 22:02:59 +0000 (15:02 -0700)]
Merge branch 'jc/maint-read-tree-multi' into maint

* jc/maint-read-tree-multi:
  checkout branch: prime cache-tree fully
  read-tree -m A B: prime cache-tree from the switched-to tree
  Move prime_cache_tree() to cache-tree.c
  read-tree A B: do not corrupt cache-tree

15 years agoMerge branch 'mk/maint-apply-swap' into maint
Junio C Hamano [Sun, 3 May 2009 22:02:52 +0000 (15:02 -0700)]
Merge branch 'mk/maint-apply-swap' into maint

* mk/maint-apply-swap:
  tests: make test-apply-criss-cross-rename more robust
  builtin-apply: keep information about files to be deleted
  tests: test applying criss-cross rename patch

15 years agoMerge branch 'mm/maint-add-p-quit' into maint
Junio C Hamano [Sun, 3 May 2009 22:02:46 +0000 (15:02 -0700)]
Merge branch 'mm/maint-add-p-quit' into maint

* mm/maint-add-p-quit:
  git add -p: add missing "q" to patch prompt

15 years agoMerge branch 'lt/pack-object-memuse' into maint
Junio C Hamano [Sun, 3 May 2009 22:02:40 +0000 (15:02 -0700)]
Merge branch 'lt/pack-object-memuse' into maint

* lt/pack-object-memuse:
  show_object(): push path_name() call further down
  process_{tree,blob}: show objects without buffering

15 years agoMerge branch 'jc/maint-1.6.0-keep-pack' into maint-1.6.1
Junio C Hamano [Sun, 3 May 2009 22:01:31 +0000 (15:01 -0700)]
Merge branch 'jc/maint-1.6.0-keep-pack' into maint-1.6.1

* jc/maint-1.6.0-keep-pack:
  pack-objects: don't loosen objects available in alternate or kept packs
  t7700: demonstrate repack flaw which may loosen objects unnecessarily
  Remove --kept-pack-only option and associated infrastructure
  pack-objects: only repack or loosen objects residing in "local" packs
  git-repack.sh: don't use --kept-pack-only option to pack-objects
  t7700-repack: add two new tests demonstrating repacking flaws
  is_kept_pack(): final clean-up
  Simplify is_kept_pack()
  Consolidate ignore_packed logic more
  has_sha1_kept_pack(): take "struct rev_info"
  has_sha1_pack(): refactor "pretend these packs do not exist" interface
  git-repack: resist stray environment variable

15 years agoMerge branch 'jc/maint-1.6.0-diff-borrow-carefully' into maint-1.6.1
Junio C Hamano [Sun, 3 May 2009 22:01:26 +0000 (15:01 -0700)]
Merge branch 'jc/maint-1.6.0-diff-borrow-carefully' into maint-1.6.1

* jc/maint-1.6.0-diff-borrow-carefully:
  diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged

15 years agoMerge branch 'bs/maint-1.6.0-tree-walk-prefix' into maint-1.6.1
Junio C Hamano [Sun, 3 May 2009 22:01:19 +0000 (15:01 -0700)]
Merge branch 'bs/maint-1.6.0-tree-walk-prefix' into maint-1.6.1

* bs/maint-1.6.0-tree-walk-prefix:
  match_tree_entry(): a pathspec only matches at directory boundaries
  tree_entry_interesting: a pathspec only matches at directory boundary

15 years agohonor repack.usedeltabaseoffset when fetching packs
Nicolas Pitre [Sat, 2 May 2009 00:18:02 +0000 (20:18 -0400)]
honor repack.usedeltabaseoffset when fetching packs

If the local receiving repository has disabled the use of delta base
offset, for example to retain compatibility with older versions of
Git that predate OFS_DELTA, we shouldn't ask for ofs-delta support
when we obtain a pack from the remote server.

[ issue noticed by Shawn Pearce ]

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Wed, 29 Apr 2009 22:40:33 +0000 (15:40 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  diff -c -p: do not die on submodules

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Wed, 29 Apr 2009 20:43:13 +0000 (13:43 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  diff -c -p: do not die on submodules

15 years agodiff -c -p: do not die on submodules
Junio C Hamano [Wed, 29 Apr 2009 19:49:52 +0000 (12:49 -0700)]
diff -c -p: do not die on submodules

The combine diff logic knew only about blobs (and their checked-out form
in the work tree, either regular files or symlinks), and barfed when fed
submodules.  This "externalizes" gitlinks in the same way as the normal
patch generation codepath does (i.e. "Subproject commit Xxx\n") to fix the
issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Tue, 28 Apr 2009 07:46:25 +0000 (00:46 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  grep: fix segfault when "git grep '('" is given
  Documentation: fix a grammatical error in api-builtin.txt
  builtin-merge: fix a typo in an error message

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Tue, 28 Apr 2009 07:46:20 +0000 (00:46 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  grep: fix segfault when "git grep '('" is given
  Documentation: fix a grammatical error in api-builtin.txt
  builtin-merge: fix a typo in an error message

15 years agogrep: fix segfault when "git grep '('" is given
Linus Torvalds [Mon, 27 Apr 2009 18:10:24 +0000 (11:10 -0700)]
grep: fix segfault when "git grep '('" is given

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: fix a grammatical error in api-builtin.txt
Allan Caffee [Mon, 13 Apr 2009 18:11:21 +0000 (14:11 -0400)]
Documentation: fix a grammatical error in api-builtin.txt

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-merge: fix a typo in an error message
Allan Caffee [Mon, 13 Apr 2009 18:10:08 +0000 (14:10 -0400)]
builtin-merge: fix a typo in an error message

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Acked-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Sat, 25 Apr 2009 05:58:31 +0000 (22:58 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:
  test-genrandom: Add newline to usage string

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sat, 25 Apr 2009 05:49:34 +0000 (22:49 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  test-genrandom: Add newline to usage string

15 years agotest-genrandom: Add newline to usage string
Stephen Boyd [Thu, 23 Apr 2009 07:25:33 +0000 (00:25 -0700)]
test-genrandom: Add newline to usage string

A minor fix to place the terminal input on a new line if test-genrandom
is run with no arguments.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: make test-apply-criss-cross-rename more robust
Michał Kiedrowicz [Sat, 18 Apr 2009 21:03:57 +0000 (23:03 +0200)]
tests: make test-apply-criss-cross-rename more robust

I realized that this test does check if git-apply succeeds, but doesn't
tell if it applies patches correctly. So I added test_cmp to check it.

I also added a test which checks swapping three files.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-apply: keep information about files to be deleted
Michał Kiedrowicz [Sat, 11 Apr 2009 19:31:00 +0000 (21:31 +0200)]
builtin-apply: keep information about files to be deleted

Example correct diff generated by `diff -M -B' might look like this:

diff --git a/file1 b/file2
similarity index 100%
rename from file1
rename to file2
diff --git a/file2 b/file1
similarity index 100%
rename from file2
rename to file1

Information about removing `file2' comes after information about creation
of new `file2' (renamed from `file1'). Existing implementation isn't able to
apply such patch, because it has to know in advance which files will be
removed.

This patch populates fn_table with information about removal of files
before calling check_patch() for each patch to be applied.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: test applying criss-cross rename patch
Michał Kiedrowicz [Sat, 11 Apr 2009 15:26:24 +0000 (17:26 +0200)]
tests: test applying criss-cross rename patch

Originally reported by Linus in $gmane/116198

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitcvs-migration: Link to git-cvsimport documentation
Frank Lichtenheld [Sat, 18 Apr 2009 14:38:42 +0000 (16:38 +0200)]
gitcvs-migration: Link to git-cvsimport documentation

Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix off-by-one in read_tree_recursive
Johannes Schindelin [Mon, 20 Apr 2009 17:44:53 +0000 (19:44 +0200)]
Fix off-by-one in read_tree_recursive

Found by valgrind.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocheckout branch: prime cache-tree fully
Junio C Hamano [Mon, 20 Apr 2009 10:58:20 +0000 (03:58 -0700)]
checkout branch: prime cache-tree fully

When switching to another branch, the earlier code relied on incremental
invalidation of cache-tree entries to degrade it.  While it is not wrong
per-se, we know that the resulting index must fully match the branch we
are switching to unless the -m (merge) option is used.

We should simply fully re-prime the cache-tree using the new tree object
in such a case.  And for safety, invalidate the cache-tree as a whole in
other cases.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoread-tree -m A B: prime cache-tree from the switched-to tree
Junio C Hamano [Mon, 20 Apr 2009 10:58:19 +0000 (03:58 -0700)]
read-tree -m A B: prime cache-tree from the switched-to tree

When switching to a new branch with "read-tree -m A B", the resulting
index must match tree B and we can prime the cache tree with it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMove prime_cache_tree() to cache-tree.c
Junio C Hamano [Mon, 20 Apr 2009 10:58:18 +0000 (03:58 -0700)]
Move prime_cache_tree() to cache-tree.c

The interface to build cache-tree belongs there.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoread-tree A B: do not corrupt cache-tree
Junio C Hamano [Mon, 20 Apr 2009 10:58:17 +0000 (03:58 -0700)]
read-tree A B: do not corrupt cache-tree

An earlier commit aab3b9a (read-tree A B C: do not create a bogus index
and do not segfault, 2009-03-12) resurrected the support for an obscure
(but useful) feature to read and overlay more than one tree into the index
without the -m (merge) option.  But the fix was not enough.

Exercising this feature exposes a longstanding bug in the code that primes
the cache-tree in the index from the tree that was read.  The intention
was that when we know that the index must exactly match the tree we just
read, we prime the entire cache-tree with it.

However, the logic to detect that case incorrectly triggered if you read
two trees without -m.  This resulted in a corrupted cache-tree, and
write-tree would have produced an incorrect tree object out of such an
index.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit add -p: add missing "q" to patch prompt
Wincent Colaiuta [Mon, 20 Apr 2009 09:42:52 +0000 (11:42 +0200)]
git add -p: add missing "q" to patch prompt

Commit cbd3a01 added a new "q" subcommand to the "git add -p"
command loop, but forgot to add it to the prompt.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.2.4 v1.6.2.4
Junio C Hamano [Mon, 20 Apr 2009 00:34:26 +0000 (17:34 -0700)]
GIT 1.6.2.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: remove {fetch,send}-pack from PROGRAMS as they are builtins
Nguyễn Thái Ngọc Duy [Mon, 20 Apr 2009 00:17:25 +0000 (10:17 +1000)]
Makefile: remove {fetch,send}-pack from PROGRAMS as they are builtins

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'ef/maint-fast-export' into maint
Junio C Hamano [Sun, 19 Apr 2009 19:40:17 +0000 (12:40 -0700)]
Merge branch 'ef/maint-fast-export' into maint

* ef/maint-fast-export:
  builtin-fast-export.c: handle nested tags
  builtin-fast-export.c: fix crash on tagged trees
  builtin-fast-export.c: turn error into warning
  test-suite: adding a test for fast-export with tag variants

15 years agoMerge branch 'mm/maint-add-p-quit' into maint
Junio C Hamano [Sun, 19 Apr 2009 19:40:14 +0000 (12:40 -0700)]
Merge branch 'mm/maint-add-p-quit' into maint

* mm/maint-add-p-quit:
  Update git-add.txt according to the new possibilities of 'git add -p'.
  add-interactive: refactor mode hunk handling
  git add -p: new "quit" command at the prompt.

15 years agoMerge branch 'lt/maint-reflog-expire' into maint
Junio C Hamano [Sun, 19 Apr 2009 19:40:11 +0000 (12:40 -0700)]
Merge branch 'lt/maint-reflog-expire' into maint

* lt/maint-reflog-expire:
  Speed up reflog pruning of unreachable commits
  Clean up reflog unreachability pruning decision

15 years agoMerge branch 'jc/maint-shared-literally' into maint
Junio C Hamano [Sun, 19 Apr 2009 19:40:05 +0000 (12:40 -0700)]
Merge branch 'jc/maint-shared-literally' into maint

* jc/maint-shared-literally:
  Update docs on behaviour of 'core.sharedRepository' and 'git init --shared'
  t1301-shared-repo: fix forced modes test

15 years agoUpdate git-add.txt according to the new possibilities of 'git add -p'.
Matthieu Moy [Thu, 16 Apr 2009 16:46:23 +0000 (18:46 +0200)]
Update git-add.txt according to the new possibilities of 'git add -p'.

The text is merely cut-and-pasted from git-add--interactive.perl. The
cut-and-paste also fixes a typo.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd-interactive: refactor mode hunk handling
Jeff King [Thu, 16 Apr 2009 07:14:15 +0000 (03:14 -0400)]
add-interactive: refactor mode hunk handling

The original implementation considered the mode separately
from the rest of the hunks, asking about it outside the main
hunk-selection loop. This patch instead places a mode change
as the first hunk in the loop. This has two advantages:

  1. less duplicated code (since we use the main selection
     loop). This also cleans up an inconsistency, which is
     that the main selection loop separates options with a
     comma, whereas the mode prompt used slashes.

  2. users can now skip the mode change and come back to it,
     search for it (via "/mode"), etc, as they can with other
     hunks.

To facilitate this, each hunk is now marked with a "type".
Mode hunks are not considered for splitting (which would
make no sense, and also confuses the split_hunk function),
nor are they editable. In theory, one could edit the mode
lines and change to a new mode. In practice, there are only
two modes that git cares about (0644 and 0755), so either
you want to move from one to the other or not (and you can
do that by staging or not staging).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit add -p: new "quit" command at the prompt.
Matthieu Moy [Fri, 10 Apr 2009 14:57:01 +0000 (16:57 +0200)]
git add -p: new "quit" command at the prompt.

There's already 'd' to stop staging hunks in a file, but no explicit
command to stop the interactive staging (for the current files and the
remaining ones).  Of course you can do 'd' and then ^C, but it would be
more intuitive to allow 'quit' action.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSpeed up reflog pruning of unreachable commits
Junio Hamano [Tue, 31 Mar 2009 04:34:14 +0000 (21:34 -0700)]
Speed up reflog pruning of unreachable commits

Instead of doing the (potentially very expensive) "in_merge_base()"
check for each commit that might be pruned if it is unreachable, do a
preparatory reachability graph of the commit space, so that the common
case of being reachable can be tested directly.

[ Cleaned up a bit and tweaked to actually work.  - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoClean up reflog unreachability pruning decision
Linus Torvalds [Tue, 31 Mar 2009 16:45:22 +0000 (09:45 -0700)]
Clean up reflog unreachability pruning decision

This clarifies the pruning rules for unreachable commits by having a
separate helpder function for the unreachability decision.

It's preparation for actual bigger changes to come to speed up the
decision when the reachability calculations become a bottleneck.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-fast-export.c: handle nested tags
Erik Faye-Lund [Mon, 23 Mar 2009 12:53:09 +0000 (12:53 +0000)]
builtin-fast-export.c: handle nested tags

When tags that points to tags are passed to fast-export, an error is given,
saying "Tag [TAGNAME] points nowhere?". This fix calls parse_object() on the
object before referencing it's tag, to ensure the tag-info is fully initialized.
In addition, it inserts a comment to point out where nested tags are handled.
This is consistent with the comment for signed tags.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-fast-export.c: fix crash on tagged trees
Erik Faye-Lund [Mon, 23 Mar 2009 12:53:08 +0000 (12:53 +0000)]
builtin-fast-export.c: fix crash on tagged trees

If a tag object points to a tree (or another unhandled type), the commit-
pointer is left uninitialized and later dereferenced. This patch adds a
default case to the switch that issues a warning and skips the object.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>