]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
8 years agofilter-branch: remove multi-line headers in msg filter
James McCoy [Fri, 9 Oct 2015 00:21:13 +0000 (20:21 -0400)] 
filter-branch: remove multi-line headers in msg filter

df062010 (filter-branch: avoid passing commit message through sed)
introduced a regression when filtering commits with multi-line headers,
if the header contains a blank line.  An example of this is a gpg-signed
commit:

  $ git cat-file commit signed-commit
  tree 3d4038e029712da9fc59a72afbfcc90418451630
  parent 110eac945dc1713b27bdf49e74e5805db66971f0
  author A U Thor <author@example.com> 1112912413 -0700
  committer C O Mitter <committer@example.com> 1112912413 -0700
  gpgsig -----BEGIN PGP SIGNATURE-----
   Version: GnuPG v1

   iEYEABECAAYFAlYXADwACgkQE7b1Hs3eQw23CACgldB/InRyDgQwyiFyMMm3zFpj
   pUsAnA+f3aMUsd9mNroloSmlOgL6jIMO
   =0Hgm
   -----END PGP SIGNATURE-----

  Adding gpg

As a consequence, "filter-branch --msg-filter cat" (which should leave the
commit message unchanged) spills the signature (after the internal blank
line) into the original commit message.

The reason is that although the signature is indented, making the line a
whitespace only line, the "read" call is splitting the line based on
the shell's IFS, which defaults to <space><tab><newline>.  The leading
space is consumed and $header_line is empty, causing the "skip header
lines" loop to exit.

The rest of the commit object is then re-used as the rewritten commit
message, causing the new message to include the signature of the
original commit.

Set IFS to an empty string for the "read" call, thus disabling the word
splitting, which causes $header_line to be set to the non-empty value ' '.
This allows the loop to fully consume the header lines before
emitting the original, intact commit message.

[jc: this is literally based on MJG's suggestion]

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: James McCoy <vega.james@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofilter-branch: avoid passing commit message through sed
Jeff King [Wed, 29 Apr 2015 15:48:58 +0000 (11:48 -0400)] 
filter-branch: avoid passing commit message through sed

On some systems (like OS X), if sed encounters input without
a trailing newline, it will silently add it. As a result,
"git filter-branch" on such systems may silently rewrite
commit messages that omit a trailing newline. Even though
this is not something we generate ourselves with "git
commit", it's better for filter-branch to preserve the
original data as closely as possible.

We're using sed here only to strip the header fields from
the commit object. We can accomplish the same thing with a
shell loop. Since shell "read" calls are slow (usually one
syscall per byte), we use "cat" once we've skipped past the
header. Depending on the size of your commit messages, this
is probably faster (you pay the cost to fork, but then read
the data in saner-sized chunks). This idea is shamelessly
stolen from Junio.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'maint-1.9' into maint-2.0
Junio C Hamano [Wed, 7 Jan 2015 21:27:19 +0000 (13:27 -0800)] 
Merge branch 'maint-1.9' into maint-2.0

* maint-1.9:
  is_hfs_dotgit: loosen over-eager match of \u{..47}

9 years agoMerge branch 'maint-1.8.5' into maint-1.9
Junio C Hamano [Wed, 7 Jan 2015 21:27:13 +0000 (13:27 -0800)] 
Merge branch 'maint-1.8.5' into maint-1.9

* maint-1.8.5:
  is_hfs_dotgit: loosen over-eager match of \u{..47}

9 years agoMerge branch 'jk/dotgit-case-maint-1.8.5' into maint-1.8.5
Junio C Hamano [Wed, 7 Jan 2015 21:26:35 +0000 (13:26 -0800)] 
Merge branch 'jk/dotgit-case-maint-1.8.5' into maint-1.8.5

* jk/dotgit-case-maint-1.8.5:
  is_hfs_dotgit: loosen over-eager match of \u{..47}

9 years agois_hfs_dotgit: loosen over-eager match of \u{..47}
Jeff King [Tue, 23 Dec 2014 08:45:36 +0000 (03:45 -0500)] 
is_hfs_dotgit: loosen over-eager match of \u{..47}

Our is_hfs_dotgit function relies on the hackily-implemented
next_hfs_char to give us the next character that an HFS+
filename comparison would look at. It's hacky because it
doesn't implement the full case-folding table of HFS+; it
gives us just enough to see if the path matches ".git".

At the end of next_hfs_char, we use tolower() to convert our
32-bit code point to lowercase. Our tolower() implementation
only takes an 8-bit char, though; it throws away the upper
24 bits. This means we can't have any false negatives for
is_hfs_dotgit. We only care about matching 7-bit ASCII
characters in ".git", and we will correctly process 'G' or
'g'.

However, we _can_ have false positives. Because we throw
away the upper bits, code point \u{0147} (for example) will
look like 'G' and get downcased to 'g'. It's not known
whether a sequence of code points whose truncation ends up
as ".git" is meaningful in any language, but it does not
hurt to be more accurate here. We can just pass out the full
32-bit code point, and compare it manually to the upper and
lowercase characters we care about.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoGit 2.0.5 v2.0.5
Junio C Hamano [Wed, 17 Dec 2014 19:30:46 +0000 (11:30 -0800)] 
Git 2.0.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with v1.9.5
Junio C Hamano [Wed, 17 Dec 2014 19:28:02 +0000 (11:28 -0800)] 
Sync with v1.9.5

* maint-1.9:
  Git 1.9.5
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index

9 years agoGit 1.9.5 v1.9.5
Junio C Hamano [Wed, 17 Dec 2014 19:22:32 +0000 (11:22 -0800)] 
Git 1.9.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with v1.8.5.6
Junio C Hamano [Wed, 17 Dec 2014 19:20:31 +0000 (11:20 -0800)] 
Sync with v1.8.5.6

* maint-1.8.5:
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index

9 years agoGit 1.8.5.6 v1.8.5.6
Junio C Hamano [Wed, 17 Dec 2014 19:18:45 +0000 (11:18 -0800)] 
Git 1.8.5.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'dotgit-case-maint-1.8.5' into maint-1.8.5
Junio C Hamano [Wed, 17 Dec 2014 19:11:15 +0000 (11:11 -0800)] 
Merge branch 'dotgit-case-maint-1.8.5' into maint-1.8.5

* dotgit-case-maint-1.8.5:
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index

9 years agofsck: complain about NTFS ".git" aliases in trees
Johannes Schindelin [Wed, 10 Dec 2014 21:28:27 +0000 (22:28 +0100)] 
fsck: complain about NTFS ".git" aliases in trees

Now that the index can block pathnames that can be mistaken
to mean ".git" on NTFS and FAT32, it would be helpful for
fsck to notice such problematic paths. This lets servers
which use receive.fsckObjects block them before the damage
spreads.

Note that the fsck check is always on, even for systems
without core.protectNTFS set. This is technically more
restrictive than we need to be, as a set of users on ext4
could happily use these odd filenames without caring about
NTFS.

However, on balance, it's helpful for all servers to block
these (because the paths can be used for mischief, and
servers which bother to fsck would want to stop the spread
whether they are on NTFS themselves or not), and hardly
anybody will be affected (because the blocked names are
variants of .git or git~1, meaning mischief is almost
certainly what the tree author had in mind).

Ideally these would be controlled by a separate
"fsck.protectNTFS" flag. However, it would be much nicer to
be able to enable/disable _any_ fsck flag individually, and
any scheme we choose should match such a system. Given the
likelihood of anybody using such a path in practice, it is
not unreasonable to wait until such a system materializes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoread-cache: optionally disallow NTFS .git variants
Johannes Schindelin [Tue, 16 Dec 2014 22:46:59 +0000 (23:46 +0100)] 
read-cache: optionally disallow NTFS .git variants

The point of disallowing ".git" in the index is that we
would never want to accidentally overwrite files in the
repository directory. But this means we need to respect the
filesystem's idea of when two paths are equal. The prior
commit added a helper to make such a comparison for NTFS
and FAT32; let's use it in verify_path().

We make this check optional for two reasons:

  1. It restricts the set of allowable filenames, which is
     unnecessary for people who are not on NTFS nor FAT32.
     In practice this probably doesn't matter, though, as
     the restricted names are rather obscure and almost
     certainly would never come up in practice.

  2. It has a minor performance penalty for every path we
     insert into the index.

This patch ties the check to the core.protectNTFS config
option. Though this is expected to be most useful on Windows,
we allow it to be set everywhere, as NTFS may be mounted on
other platforms. The variable does default to on for Windows,
though.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agopath: add is_ntfs_dotgit() helper
Johannes Schindelin [Tue, 16 Dec 2014 22:31:03 +0000 (23:31 +0100)] 
path: add is_ntfs_dotgit() helper

We do not allow paths with a ".git" component to be added to
the index, as that would mean repository contents could
overwrite our repository files. However, asking "is this
path the same as .git" is not as simple as strcmp() on some
filesystems.

On NTFS (and FAT32), there exist so-called "short names" for
backwards-compatibility: 8.3 compliant names that refer to the same files
as their long names. As ".git" is not an 8.3 compliant name, a short name
is generated automatically, typically "git~1".

Depending on the Windows version, any combination of trailing spaces and
periods are ignored, too, so that both "git~1." and ".git." still refer
to the Git directory. The reason is that 8.3 stores file names shorter
than 8 characters with trailing spaces. So literally, it does not matter
for the short name whether it is padded with spaces or whether it is
shorter than 8 characters, it is considered to be the exact same.

The period is the separator between file name and file extension, and
again, an empty extension consists just of spaces in 8.3 format. So
technically, we would need only take care of the equivalent of this
regex:
        (\.git {0,4}|git~1 {0,3})\. {0,3}

However, there are indications that at least some Windows versions might
be more lenient and accept arbitrary combinations of trailing spaces and
periods and strip them out. So we're playing it real safe here. Besides,
there can be little doubt about the intention behind using file names
matching even the more lenient pattern specified above, therefore we
should be fine with disallowing such patterns.

Extra care is taken to catch names such as '.\\.git\\booh' because the
backslash is marked as a directory separator only on Windows, and we want
to use this new helper function also in fsck on other platforms.

A big thank you goes to Ed Thomson and an unnamed Microsoft engineer for
the detailed analysis performed to come up with the corresponding fixes
for libgit2.

This commit adds a function to detect whether a given file name can refer
to the Git directory by mistake.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofsck: complain about HFS+ ".git" aliases in trees
Jeff King [Mon, 15 Dec 2014 23:21:57 +0000 (18:21 -0500)] 
fsck: complain about HFS+ ".git" aliases in trees

Now that the index can block pathnames that case-fold to
".git" on HFS+, it would be helpful for fsck to notice such
problematic paths. This lets servers which use
receive.fsckObjects block them before the damage spreads.

Note that the fsck check is always on, even for systems
without core.protectHFS set. This is technically more
restrictive than we need to be, as a set of users on ext4
could happily use these odd filenames without caring about
HFS+.

However, on balance, it's helpful for all servers to block
these (because the paths can be used for mischief, and
servers which bother to fsck would want to stop the spread
whether they are on HFS+ themselves or not), and hardly
anybody will be affected (because the blocked names are
variants of .git with invisible Unicode code-points mixed
in, meaning mischief is almost certainly what the tree
author had in mind).

Ideally these would be controlled by a separate
"fsck.protectHFS" flag. However, it would be much nicer to
be able to enable/disable _any_ fsck flag individually, and
any scheme we choose should match such a system. Given the
likelihood of anybody using such a path in practice, it is
not unreasonable to wait until such a system materializes.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoread-cache: optionally disallow HFS+ .git variants
Jeff King [Mon, 15 Dec 2014 23:15:20 +0000 (18:15 -0500)] 
read-cache: optionally disallow HFS+ .git variants

The point of disallowing ".git" in the index is that we
would never want to accidentally overwrite files in the
repository directory. But this means we need to respect the
filesystem's idea of when two paths are equal. The prior
commit added a helper to make such a comparison for HFS+;
let's use it in verify_path.

We make this check optional for two reasons:

  1. It restricts the set of allowable filenames, which is
     unnecessary for people who are not on HFS+. In practice
     this probably doesn't matter, though, as the restricted
     names are rather obscure and almost certainly would
     never come up in practice.

  2. It has a minor performance penalty for every path we
     insert into the index.

This patch ties the check to the core.protectHFS config
option. Though this is expected to be most useful on OS X,
we allow it to be set everywhere, as HFS+ may be mounted on
other platforms. The variable does default to on for OS X,
though.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoutf8: add is_hfs_dotgit() helper
Jeff King [Mon, 15 Dec 2014 22:56:59 +0000 (17:56 -0500)] 
utf8: add is_hfs_dotgit() helper

We do not allow paths with a ".git" component to be added to
the index, as that would mean repository contents could
overwrite our repository files. However, asking "is this
path the same as .git" is not as simple as strcmp() on some
filesystems.

HFS+'s case-folding does more than just fold uppercase into
lowercase (which we already handle with strcasecmp). It may
also skip past certain "ignored" Unicode code points, so
that (for example) ".gi\u200ct" is mapped ot ".git".

The full list of folds can be found in the tables at:

  https://www.opensource.apple.com/source/xnu/xnu-1504.15.3/bsd/hfs/hfscommon/Unicode/UCStringCompareData.h

Implementing a full "is this path the same as that path"
comparison would require us importing the whole set of
tables.  However, what we want to do is much simpler: we
only care about checking ".git". We know that 'G' is the
only thing that folds to 'g', and so on, so we really only
need to deal with the set of ignored code points, which is
much smaller.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofsck: notice .git case-insensitively
Jeff King [Mon, 24 Nov 2014 18:40:44 +0000 (13:40 -0500)] 
fsck: notice .git case-insensitively

We complain about ".git" in a tree because it cannot be
loaded into the index or checked out. Since we now also
reject ".GIT" case-insensitively, fsck should notice the
same, so that errors do not propagate.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot1450: refactor ".", "..", and ".git" fsck tests
Jeff King [Mon, 24 Nov 2014 18:40:11 +0000 (13:40 -0500)] 
t1450: refactor ".", "..", and ".git" fsck tests

We check that fsck notices and complains about confusing
paths in trees. However, there are a few shortcomings:

  1. We check only for these paths as file entries, not as
     intermediate paths (so ".git" and not ".git/foo").

  2. We check "." and ".." together, so it is possible that
     we notice only one and not the other.

  3. We repeat a lot of boilerplate.

Let's use some loops to be more thorough in our testing, and
still end up with shorter code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoverify_dotfile(): reject .git case-insensitively
Jeff King [Mon, 24 Nov 2014 18:39:12 +0000 (13:39 -0500)] 
verify_dotfile(): reject .git case-insensitively

We do not allow ".git" to enter into the index as a path
component, because checking out the result to the working
tree may causes confusion for subsequent git commands.
However, on case-insensitive file systems, ".Git" or ".GIT"
is the same. We should catch and prevent those, too.

Note that technically we could allow this for repos on
case-sensitive filesystems. But there's not much point. It's
unlikely that anybody cares, and it creates a repository
that is unexpectedly non-portable to other systems.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoread-tree: add tests for confusing paths like ".." and ".git"
Jeff King [Mon, 24 Nov 2014 18:37:56 +0000 (13:37 -0500)] 
read-tree: add tests for confusing paths like ".." and ".git"

We should prevent nonsense paths from entering the index in
the first place, as they can cause confusing results if they
are ever checked out into the working tree. We already do
so, but we never tested it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agounpack-trees: propagate errors adding entries to the index
Jeff King [Mon, 24 Nov 2014 18:36:51 +0000 (13:36 -0500)] 
unpack-trees: propagate errors adding entries to the index

When unpack_trees tries to write an entry to the index,
add_index_entry may report an error to stderr, but we ignore
its return value. This leads to us returning a successful
exit code for an operation that partially failed. Let's make
sure to propagate this code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'maint-1.9' into maint-2.0
Junio C Hamano [Tue, 7 Oct 2014 20:40:39 +0000 (13:40 -0700)] 
Merge branch 'maint-1.9' into maint-2.0

* maint-1.9:
  git-tag.txt: Add a missing hyphen to `-s`

9 years agoMerge branch 'maint-1.8.5' into maint-1.9
Junio C Hamano [Tue, 7 Oct 2014 20:40:19 +0000 (13:40 -0700)] 
Merge branch 'maint-1.8.5' into maint-1.9

* maint-1.8.5:
  git-tag.txt: Add a missing hyphen to `-s`

9 years agogit-tag.txt: Add a missing hyphen to `-s`
Wieland Hoffmann [Sat, 4 Oct 2014 16:27:16 +0000 (18:27 +0200)] 
git-tag.txt: Add a missing hyphen to `-s`

Signed-off-by: Wieland Hoffmann <themineo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoGit 2.0.4 v2.0.4
Junio C Hamano [Wed, 30 Jul 2014 21:19:53 +0000 (14:19 -0700)] 
Git 2.0.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agocommit --amend: test specifies authorship but forgets to check
Fabian Ruch [Wed, 30 Jul 2014 09:45:11 +0000 (11:45 +0200)] 
commit --amend: test specifies authorship but forgets to check

The test case "--amend option copies authorship" specifies that the
git-commit option `--amend` uses the authorship of the replaced
commit for the new commit. Add the omitted check that this property
actually holds.

Signed-off-by: Fabian Ruch <bafain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot4013: test diff-tree's --stdin commit formatting
Jeff King [Mon, 28 Jul 2014 18:01:57 +0000 (14:01 -0400)] 
t4013: test diff-tree's --stdin commit formatting

Once upon a time, git-log was just "rev-list | diff-tree",
and we did not bother to test it separately. These days git-log
is implemented internally, but we want to make sure that the
rev-list to diff-tree pipeline continues to function. Let's
add a basic sanity test.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'jk/alloc-commit-id-maint' into maint
Junio C Hamano [Mon, 28 Jul 2014 17:35:35 +0000 (10:35 -0700)] 
Merge branch 'jk/alloc-commit-id-maint' into maint

* jk/alloc-commit-id-maint:
  diff-tree: avoid lookup_unknown_object
  object_as_type: set commit index
  alloc: factor out commit index
  add object_as_type helper for casting objects
  parse_object_buffer: do not set object type
  move setting of object->type to alloc_* functions
  alloc: write out allocator definitions
  alloc.c: remove the alloc_raw_commit_node() function

9 years agodiff-tree: avoid lookup_unknown_object
Jeff King [Sun, 13 Jul 2014 06:42:17 +0000 (02:42 -0400)] 
diff-tree: avoid lookup_unknown_object

We generally want to avoid lookup_unknown_object, because it
results in allocating more memory for the object than may be
strictly necessary.

In this case, it is used to check whether we have an
already-parsed object before calling parse_object, to save
us from reading the object from disk. Using lookup_object
would be fine for that purpose, but we can take it a step
further. Since this code was written, parse_object already
learned the "check lookup_object" optimization, so we can
simply call parse_object directly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoobject_as_type: set commit index
Jeff King [Sun, 13 Jul 2014 06:42:12 +0000 (02:42 -0400)] 
object_as_type: set commit index

The point of the "index" field of struct commit is that
every allocated commit would have one. It is supposed to be
an invariant that whenever object->type is set to
OBJ_COMMIT, we have a unique index.

Commit 969eba6 (commit: push commit_index update into
alloc_commit_node, 2014-06-10) covered this case for
newly-allocated commits. However, we may also allocate an
"unknown" object via lookup_unknown_object, and only later
convert it to a commit. We must make sure that we set the
commit index when we switch the type field.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoalloc: factor out commit index
Jeff King [Sun, 13 Jul 2014 06:42:08 +0000 (02:42 -0400)] 
alloc: factor out commit index

We keep a static counter to set the commit index on newly
allocated objects. However, since we also need to set the
index on any_objects which are converted to commits, let's
make the counter available as a public function.

While we're moving it, let's make sure the counter is
allocated as an unsigned integer to match the index field in
"struct commit".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoadd object_as_type helper for casting objects
Jeff King [Sun, 13 Jul 2014 06:42:03 +0000 (02:42 -0400)] 
add object_as_type helper for casting objects

When we call lookup_commit, lookup_tree, etc, the logic goes
something like:

  1. Look for an existing object struct. If we don't have
     one, allocate and return a new one.

  2. Double check that any object we have is the expected
     type (and complain and return NULL otherwise).

  3. Convert an object with type OBJ_NONE (from a prior
     call to lookup_unknown_object) to the expected type.

We can encapsulate steps 2 and 3 in a helper function which
checks whether we have the expected object type, converts
OBJ_NONE as appropriate, and returns the object.

Not only does this shorten the code, but it also provides
one central location for converting OBJ_NONE objects into
objects of other types. Future patches will use that to
enforce type-specific invariants.

Since this is a refactoring, we would want it to behave
exactly as the current code. It takes a little reasoning to
see that this is the case:

  - for lookup_{commit,tree,etc} functions, we are just
    pulling steps 2 and 3 into a function that does the same
    thing.

  - for the call in peel_object, we currently only do step 3
    (but we want to consolidate it with the others, as
    mentioned above). However, step 2 is a noop here, as the
    surrounding conditional makes sure we have OBJ_NONE
    (which we want to keep to avoid an extraneous call to
    sha1_object_info).

  - for the call in lookup_commit_reference_gently, we are
    currently doing step 2 but not step 3. However, step 3
    is a noop here. The object we got will have just come
    from deref_tag, which must have figured out the type for
    each object in order to know when to stop peeling.
    Therefore the type will never be OBJ_NONE.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoparse_object_buffer: do not set object type
Jeff King [Sun, 13 Jul 2014 06:42:00 +0000 (02:42 -0400)] 
parse_object_buffer: do not set object type

The only way that "obj" can be non-NULL is if it came from
one of the lookup_* functions. These functions always ensure
that the object has the expected type (and return NULL
otherwise), so there is no need for us to set the type.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agomove setting of object->type to alloc_* functions
Jeff King [Sun, 13 Jul 2014 06:41:55 +0000 (02:41 -0400)] 
move setting of object->type to alloc_* functions

The "struct object" type implements basic object
polymorphism.  Individual instances are allocated as
concrete types (or as a union type that can store any
object), and a "struct object *" can be cast into its real
type after examining its "type" enum.  This means it is
dangerous to have a type field that does not match the
allocation (e.g., setting the type field of a "struct blob"
to "OBJ_COMMIT" would mean that a reader might read past the
allocated memory).

In most of the current code this is not a problem; the first
thing we do after allocating an object is usually to set its
type field by passing it to create_object. However, the
virtual commits we create in merge-recursive.c do not ever
get their type set. This does not seem to have caused
problems in practice, though (presumably because we always
pass around a "struct commit" pointer and never even look at
the type).

We can fix this oversight and also make it harder for future
code to get it wrong by setting the type directly in the
object allocation functions.

This will also make it easier to fix problems with commit
index allocation, as we know that any object allocated by
alloc_commit_node will meet the invariant that an object
with an OBJ_COMMIT type field will have a unique index
number.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoalloc: write out allocator definitions
Jeff King [Sun, 13 Jul 2014 06:41:51 +0000 (02:41 -0400)] 
alloc: write out allocator definitions

Because the allocator functions for tree, blobs, etc are all
very similar, we originally used a macro to avoid repeating
ourselves. Since the prior commit, though, the heavy lifting
is done by an inline helper function.  The macro does still
save us a few lines, but at some readability cost.  It
obfuscates the function definitions (and makes them hard to
find via grep).

Much worse, though, is the fact that it isn't used
consistently for all allocators. Somebody coming later may
be tempted to modify DEFINE_ALLOCATOR, but they would miss
alloc_commit_node, which is treated specially.

Let's just drop the macro and write everything out
explicitly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoalloc.c: remove the alloc_raw_commit_node() function
Ramsay Jones [Sun, 13 Jul 2014 06:41:41 +0000 (02:41 -0400)] 
alloc.c: remove the alloc_raw_commit_node() function

In order to encapsulate the setting of the unique commit index, commit
969eba63 ("commit: push commit_index update into alloc_commit_node",
10-06-2014) introduced a (logically private) intermediary allocator
function. However, this function (alloc_raw_commit_node()) was declared
as a public function, which undermines its entire purpose.

Introduce an inline function, alloc_node(), which implements the main
logic of the allocator used by DEFINE_ALLOCATOR, and redefine the macro
in terms of the new function. In addition, use the new function in the
implementation of the alloc_commit_node() allocator, rather than the
intermediary allocator, which can now be removed.

Noticed by sparse ("symbol 'alloc_raw_commit_node' was not declared.
Should it be static?").

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoGit 2.0.3 v2.0.3
Junio C Hamano [Wed, 23 Jul 2014 18:33:16 +0000 (11:33 -0700)] 
Git 2.0.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years ago.mailmap: combine Stefan Beller's emails
Stefan Beller [Wed, 23 Jul 2014 12:32:10 +0000 (14:32 +0200)] 
.mailmap: combine Stefan Beller's emails

Google mail has had the extension @googlemail.com for a long time
in Germany as @gmail.de was already taken by a competitor.
Nowadays the original gmail company isn't there anymore(?), hence
Googlemail also introduced @gmail.com in Germany, which I switched to.

This changed mail address of mine first appeared in 398dd4bd039680b
(2014-07-10, .mailmap: map different names with the same email
address together) ironically.

Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit.1: switch homepage for stats
Stefan Beller [Wed, 23 Jul 2014 12:32:09 +0000 (14:32 +0200)] 
git.1: switch homepage for stats

According to http://meta.ohloh.net/2014/07/black-duck-open-hub/
the site name of ohloh changed to openhub.

Change the man page accordingly.

Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'ah/fix-http-push' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:29:07 +0000 (10:29 -0700)] 
Merge branch 'ah/fix-http-push' into maint

* ah/fix-http-push:
  http-push.c: make CURLOPT_IOCTLDATA a usable pointer

9 years agoMerge branch 'po/error-message-style' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:28:59 +0000 (10:28 -0700)] 
Merge branch 'po/error-message-style' into maint

* po/error-message-style:
  doc: give some guidelines for error messages

9 years agoMerge branch 'zk/log-graph-showsig' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:28:51 +0000 (10:28 -0700)] 
Merge branch 'zk/log-graph-showsig' into maint

* zk/log-graph-showsig:
  log: fix indentation for --graph --show-signature

9 years agoMerge branch 'mg/fix-log-mergetag-color' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:28:43 +0000 (10:28 -0700)] 
Merge branch 'mg/fix-log-mergetag-color' into maint

* mg/fix-log-mergetag-color:
  log: correctly identify mergetag signature verification status

9 years agoMerge branch 'cb/filter-branch-prune-empty-degenerate-merges' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:28:30 +0000 (10:28 -0700)] 
Merge branch 'cb/filter-branch-prune-empty-degenerate-merges' into maint

* cb/filter-branch-prune-empty-degenerate-merges:
  filter-branch: eliminate duplicate mapped parents

9 years agoMerge branch 'ye/doc-http-proto' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:28:02 +0000 (10:28 -0700)] 
Merge branch 'ye/doc-http-proto' into maint

* ye/doc-http-proto:
  http-protocol.txt: Basic Auth is defined in RFC 2617, not RFC 2616

9 years agoMerge branch 'jm/api-strbuf-doc' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:26:52 +0000 (10:26 -0700)] 
Merge branch 'jm/api-strbuf-doc' into maint

* jm/api-strbuf-doc:
  api-strbuf.txt minor typos

9 years agoMerge branch 'jm/dedup-test-config' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:26:45 +0000 (10:26 -0700)] 
Merge branch 'jm/dedup-test-config' into maint

* jm/dedup-test-config:
  t/t7810-grep.sh: remove duplicate test_config()

9 years agoMerge branch 'sk/test-cmp-bin' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:26:34 +0000 (10:26 -0700)] 
Merge branch 'sk/test-cmp-bin' into maint

* sk/test-cmp-bin:
  t5000, t5003: do not use test_cmp to compare binary files

9 years agoMerge branch 'jm/doc-wording-tweaks' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:26:17 +0000 (10:26 -0700)] 
Merge branch 'jm/doc-wording-tweaks' into maint

* jm/doc-wording-tweaks:
  Documentation: wording fixes in the user manual and glossary

9 years agoMerge branch 'jm/instaweb-apache-24' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:25:24 +0000 (10:25 -0700)] 
Merge branch 'jm/instaweb-apache-24' into maint

* jm/instaweb-apache-24:
  git-instaweb: add support for Apache 2.4

9 years agoMerge branch 'bg/xcalloc-nmemb-then-size' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:25:17 +0000 (10:25 -0700)] 
Merge branch 'bg/xcalloc-nmemb-then-size' into maint

* bg/xcalloc-nmemb-then-size:
  transport-helper.c: rearrange xcalloc arguments
  remote.c: rearrange xcalloc arguments
  reflog-walk.c: rearrange xcalloc arguments
  pack-revindex.c: rearrange xcalloc arguments
  notes.c: rearrange xcalloc arguments
  imap-send.c: rearrange xcalloc arguments
  http-push.c: rearrange xcalloc arguments
  diff.c: rearrange xcalloc arguments
  config.c: rearrange xcalloc arguments
  commit.c: rearrange xcalloc arguments
  builtin/remote.c: rearrange xcalloc arguments
  builtin/ls-remote.c: rearrange xcalloc arguments

9 years agoMerge branch 'cb/byte-order' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:25:02 +0000 (10:25 -0700)] 
Merge branch 'cb/byte-order' into maint

* cb/byte-order:
  compat/bswap.h: fix endianness detection
  compat/bswap.h: restore preference __BIG_ENDIAN over BIG_ENDIAN
  compat/bswap.h: detect endianness on more platforms that don't use BYTE_ORDER

9 years agoMerge branch 'lt/request-pull' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:23:41 +0000 (10:23 -0700)] 
Merge branch 'lt/request-pull' into maint

* lt/request-pull:
  fix brown paper bag breakage in t5150-request-pull.sh

9 years agoMerge branch 'ep/shell-assign-and-export-vars' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:22:57 +0000 (10:22 -0700)] 
Merge branch 'ep/shell-assign-and-export-vars' into maint

* ep/shell-assign-and-export-vars:
  scripts: more "export VAR=VALUE" fixes
  scripts: "export VAR=VALUE" construct is not portable

9 years agoMerge branch 'maint-1.9' into maint
Junio C Hamano [Tue, 22 Jul 2014 17:17:34 +0000 (10:17 -0700)] 
Merge branch 'maint-1.9' into maint

* maint-1.9:
  Documentation: fix missing text for rev-parse --verify

9 years agoMerge branch 'maint-1.8.5' into maint-1.9
Junio C Hamano [Tue, 22 Jul 2014 17:16:50 +0000 (10:16 -0700)] 
Merge branch 'maint-1.8.5' into maint-1.9

* maint-1.8.5:
  Documentation: fix missing text for rev-parse --verify

9 years agoDocumentation: fix missing text for rev-parse --verify
brian m. carlson [Mon, 21 Jul 2014 23:00:35 +0000 (23:00 +0000)] 
Documentation: fix missing text for rev-parse --verify

The caret (^) is used as a markup symbol in AsciiDoc.  Due to the
inability of AsciiDoc to parse a line containing an unmatched caret, it
omitted the line from the output, resulting in the man page missing the
end of a sentence.  Escape this caret so that the man page ends up with
the complete text.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agouse xmemdupz() to allocate copies of strings given by start and length
René Scharfe [Sat, 19 Jul 2014 15:35:34 +0000 (17:35 +0200)] 
use xmemdupz() to allocate copies of strings given by start and length

Use xmemdupz() to allocate the memory, copy the data and make sure to
NUL-terminate the result, all in one step.  The resulting code is
shorter, doesn't contain the constants 1 and '\0', and avoids
duplicating function parameters.

For blame, the last copied byte (o->file.ptr[o->file.size]) is always
set to NUL by fake_working_tree_commit() or read_sha1_file(), so no
information is lost by the conversion to using xmemdupz().

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agouse xcalloc() to allocate zero-initialized memory
René Scharfe [Sat, 19 Jul 2014 13:56:26 +0000 (15:56 +0200)] 
use xcalloc() to allocate zero-initialized memory

Use xcalloc() instead of xmalloc() followed by memset() to allocate
and zero out memory because it's shorter and avoids duplicating the
function parameters.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoGit 2.0.2 v2.0.2
Junio C Hamano [Wed, 16 Jul 2014 18:19:56 +0000 (11:19 -0700)] 
Git 2.0.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'jc/fix-clone-single-starting-at-a-tag' into maint
Junio C Hamano [Wed, 16 Jul 2014 18:17:36 +0000 (11:17 -0700)] 
Merge branch 'jc/fix-clone-single-starting-at-a-tag' into maint

"git clone -b brefs/tags/bar" would have mistakenly thought we were
following a single tag, even though it was a name of the branch,
because it incorrectly used strstr().

* jc/fix-clone-single-starting-at-a-tag:
  builtin/clone.c: detect a clone starting at a tag correctly

9 years agoMerge branch 'jk/pretty-G-format-fixes' into maint
Junio C Hamano [Wed, 16 Jul 2014 18:17:21 +0000 (11:17 -0700)] 
Merge branch 'jk/pretty-G-format-fixes' into maint

"%G" (nothing after G) is an invalid pretty format specifier, but
the parser did not notice it as garbage.

* jk/pretty-G-format-fixes:
  move "%G" format test from t7510 to t6006
  pretty: avoid reading past end-of-string with "%G"
  t7510: check %G* pretty-format output
  t7510: test a commit signed by an unknown key
  t7510: use consistent &&-chains in loop
  t7510: stop referring to master in later tests

9 years agoMerge branch 'rs/fix-alt-odb-path-comparison' into maint
Junio C Hamano [Wed, 16 Jul 2014 18:17:08 +0000 (11:17 -0700)] 
Merge branch 'rs/fix-alt-odb-path-comparison' into maint

Code to avoid adding the same alternate object store twice was
subtly broken for a long time, but nobody seems to have noticed.

* rs/fix-alt-odb-path-comparison:
  sha1_file: avoid overrunning alternate object base string

9 years agoMerge branch 'jk/commit-buffer-length' into maint
Junio C Hamano [Wed, 16 Jul 2014 18:16:38 +0000 (11:16 -0700)] 
Merge branch 'jk/commit-buffer-length' into maint

A handful of code paths had to read the commit object more than
once when showing header fields that are usually not parsed.  The
internal data structure to keep track of the contents of the commit
object has been updated to reduce the need for this double-reading,
and to allow the caller find the length of the object.

* jk/commit-buffer-length:
  reuse cached commit buffer when parsing signatures
  commit: record buffer length in cache
  commit: convert commit->buffer to a slab
  commit-slab: provide a static initializer
  use get_commit_buffer everywhere
  convert logmsg_reencode to get_commit_buffer
  use get_commit_buffer to avoid duplicate code
  use get_cached_commit_buffer where appropriate
  provide helpers to access the commit buffer
  provide a helper to set the commit buffer
  provide a helper to free commit buffer
  sequencer: use logmsg_reencode in get_message
  logmsg_reencode: return const buffer
  do not create "struct commit" with xcalloc
  commit: push commit_index update into alloc_commit_node
  alloc: include any-object allocations in alloc_report
  replace dangerous uses of strbuf_attach
  commit_tree: take a pointer/len pair rather than a const strbuf

9 years agoMerge branch 'bc/fix-rebase-merge-skip' into maint
Junio C Hamano [Wed, 16 Jul 2014 18:16:16 +0000 (11:16 -0700)] 
Merge branch 'bc/fix-rebase-merge-skip' into maint

During "git rebase --merge", a conflicted patch could not be
skipped with "--skip" if the next one also conflicted.

* bc/fix-rebase-merge-skip:
  rebase--merge: fix --skip with two conflicts in a row

9 years agoMerge branch 'maint-1.9' into maint
Junio C Hamano [Wed, 16 Jul 2014 18:11:06 +0000 (11:11 -0700)] 
Merge branch 'maint-1.9' into maint

* maint-1.9:
  annotate: use argv_array

9 years agoMerge branch 'maint-1.8.5' into maint-1.9
Junio C Hamano [Wed, 16 Jul 2014 18:10:30 +0000 (11:10 -0700)] 
Merge branch 'maint-1.8.5' into maint-1.9

* maint-1.8.5:
  annotate: use argv_array
  t7300: repair filesystem permissions with test_when_finished
  enums: remove trailing ',' after last item in enum

9 years agoannotate: use argv_array
René Scharfe [Wed, 16 Jul 2014 08:51:33 +0000 (10:51 +0200)] 
annotate: use argv_array

Simplify the code and get rid of some magic constants by using
argv_array to build the argument list for cmd_blame.  Be lazy and let
the OS release our allocated memory, as before.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agohttp-push.c: make CURLOPT_IOCTLDATA a usable pointer
Abbaad Haider [Sun, 6 Jul 2014 00:43:48 +0000 (20:43 -0400)] 
http-push.c: make CURLOPT_IOCTLDATA a usable pointer

Fixes a small bug affecting push to remotes which use some sort of
multi-pass authentication. In particular the bug affected SabreDAV as
configured by Box.com [1].

It must be a weird server configuration for the bug to have survived
this long. Someone should write a test for it.

[1] http://marc.info/?l=git&m=140460482604482

Signed-off-by: Abbaad Haider <abbaad@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agolog: correctly identify mergetag signature verification status
Michael J Gruber [Fri, 27 Jun 2014 13:18:36 +0000 (15:18 +0200)] 
log: correctly identify mergetag signature verification status

A wrong '}' made our code record the results of mergetag signature
verification incorrectly.

Fix it.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agodoc: give some guidelines for error messages
Philip Oakley [Mon, 16 Jun 2014 12:55:57 +0000 (13:55 +0100)] 
doc: give some guidelines for error messages

Clarify error message puntuation to reduce review workload.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoStart preparing for 2.0.2
Junio C Hamano [Thu, 10 Jul 2014 18:15:10 +0000 (11:15 -0700)] 
Start preparing for 2.0.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'pb/trim-trailing-spaces' into maint
Junio C Hamano [Thu, 10 Jul 2014 18:10:52 +0000 (11:10 -0700)] 
Merge branch 'pb/trim-trailing-spaces' into maint

* pb/trim-trailing-spaces:
  t0008: do not depend on 'echo' handling backslashes specially
  dir.c:trim_trailing_spaces(): fix for " \ " sequence

9 years agoMerge branch 'jk/repack-pack-keep-objects' into maint
Junio C Hamano [Thu, 10 Jul 2014 18:10:05 +0000 (11:10 -0700)] 
Merge branch 'jk/repack-pack-keep-objects' into maint

* jk/repack-pack-keep-objects:
  repack: s/write_bitmap/&s/ in code
  repack: respect pack.writebitmaps
  repack: do not accidentally pack kept objects by default

9 years agoMerge branch 'mc/doc-submodule-sync-recurse' into maint
Junio C Hamano [Thu, 10 Jul 2014 18:08:31 +0000 (11:08 -0700)] 
Merge branch 'mc/doc-submodule-sync-recurse' into maint

* mc/doc-submodule-sync-recurse:
  submodule: document "sync --recursive"

9 years agolog: fix indentation for --graph --show-signature
Zoltan Klinger [Wed, 9 Jul 2014 02:10:21 +0000 (12:10 +1000)] 
log: fix indentation for --graph --show-signature

The git log --graph --show-signature command incorrectly indents the gpg
information about signed commits and merged signed tags. It does not
follow the level of indentation of the current commit.

Example of garbled output:
$ git log --show-signature --graph
*   commit 258e0a237cb69aaa587b0a4fb528bb0316b1b776
|\  gpg: Signature made Mon, Jun 30, 2014 13:22:33 EDT using RSA key ID DA08
gpg: Good signature from "Jason Pyeron <jpye...@pdinc.us>"
Merge: 727c355 1ca13ed
| | Author: Jason Pyeron <jpye...@pdinc.us>
| | Date:   Mon Jun 30 13:22:29 2014 -0400
| |
| |     Merge of 1ca13ed2271d60ba9 branch - rebranding
| |
| * commit 1ca13ed2271d60ba93d40bcc8db17ced8545f172
| | gpg: Signature made Mon, Jun 23, 2014  9:45:47 EDT using RSA key ID DD37
gpg: Good signature from "Stephen Robert Guglielmo <s...@guglielmo.us>"
gpg:                 aka "Stephen Robert Guglielmo <srguglie...@gmail.com>"
Author: Stephen R Guglielmo <s...@guglielmo.us>
| | Date:   Mon Jun 23 09:45:27 2014 -0400
| |
| |     Minor URL updates

In log-tree.c modify show_sig_lines() function to call graph_show_oneline()
after each line of gpg information it has printed in order to preserve
the level of indentation for the next output line.

Reported-by: Jason Pyeron <jpyeron@pdinc.us>
Signed-off-by: Zoltan Klinger <zoltan.klinger@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'maint-1.8.5' into maint
Junio C Hamano [Wed, 2 Jul 2014 19:51:50 +0000 (12:51 -0700)] 
Merge branch 'maint-1.8.5' into maint

* maint-1.8.5:
  t7300: repair filesystem permissions with test_when_finished
  enums: remove trailing ',' after last item in enum

9 years agot7300: repair filesystem permissions with test_when_finished
Jeff King [Wed, 2 Jul 2014 18:44:30 +0000 (14:44 -0400)] 
t7300: repair filesystem permissions with test_when_finished

We create a directory that cannot be removed, confirm that
it cannot be removed, and then fix it like:

  chmod 0 foo &&
  test_must_fail git clean -d -f &&
  chmod 755 foo

If the middle step fails but leaves the directory (e.g., the
bug is that clean does not notice the failure), this
pollutes the test repo with an unremovable directory. Not
only does this cause further tests to fail, but it means
that "rm -rf" fails on the whole trash directory, and the
user has to intervene manually to even re-run the test script.

We can bump the "chmod 755" recovery to a test_when_finished
block to be sure that it always runs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoenums: remove trailing ',' after last item in enum
Ronnie Sahlberg [Wed, 2 Jul 2014 18:24:05 +0000 (11:24 -0700)] 
enums: remove trailing ',' after last item in enum

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosha1_file: avoid overrunning alternate object base string
René Scharfe [Tue, 1 Jul 2014 18:00:01 +0000 (20:00 +0200)] 
sha1_file: avoid overrunning alternate object base string

While checking if a new alternate object database is a duplicate make
sure that old and new base paths have the same length before comparing
them with memcmp.  This avoids overrunning the buffer of the existing
entry if the new one is longer and it stops rejecting foobar/ after
foo/ was already added.

Signed-off-by: Rene Scharfe <ls.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofilter-branch: eliminate duplicate mapped parents
Charles Bailey [Mon, 30 Jun 2014 21:20:27 +0000 (22:20 +0100)] 
filter-branch: eliminate duplicate mapped parents

When multiple parents of a merge commit get mapped to the same
commit, filter-branch used to pass all instances of the parent
commit to the parent and commit filters and to "git commit-tree" or
"git_commit_non_empty_tree".

This can often happen when extracting a small project from a large
repository; merges can join history with no commits on any branch
which affect the paths being retained.  Once the intermediate
commits have been filtered out, all the immediate parents of the
merge commit can end up being mapped to the same commit - either the
original merge-base or an ancestor of it.

"git commit-tree" would display an error but write the commit with
the normalized parents in any case.  "git_commit_non_empty_tree"
would fail to notice that the commit being made was in fact a
non-merge commit and would retain it even if a further pass with
"--prune-empty" would discard the commit as empty.

Ensure that duplicate parents are pruned before the parent filter to
make "--prune-empty" idempotent, removing all empty non-merge
commits in a singe pass.

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agomove "%G" format test from t7510 to t6006
Jeff King [Wed, 25 Jun 2014 21:42:17 +0000 (17:42 -0400)] 
move "%G" format test from t7510 to t6006

The final test in t7510 checks that "--format" placeholders
that look similar to GPG placeholders (but that we don't
actually understand) are passed through. That test was
placed in t7510, since the other GPG placeholder tests are
there. However, it does not have a GPG prerequisite, because
it is not actually checking any signed commits.

This causes the test to erroneously fail when gpg is not
installed on a system, however. Not because we need signed
commits, but because we need _any_ commit to run "git log".
If we don't have gpg installed, t7510 doesn't create any
commits at all.

We can fix this by moving the test into t6006. This is
arguably a better place anyway, because it is where we test
most of the other placeholders (we do not test GPG
placeholders there because of the infrastructure needed to
make signed commits).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoGit 2.0.1 v2.0.1
Junio C Hamano [Wed, 25 Jun 2014 19:21:11 +0000 (12:21 -0700)] 
Git 2.0.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'na/no-http-test-in-the-middle' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:50:13 +0000 (11:50 -0700)] 
Merge branch 'na/no-http-test-in-the-middle' into maint

The mode to run tests with HTTP server tests disabled was broken.

* na/no-http-test-in-the-middle:
  t5538: move http push tests out to t5542

9 years agoMerge branch 'jl/status-added-submodule-is-never-ignored' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:50:03 +0000 (11:50 -0700)] 
Merge branch 'jl/status-added-submodule-is-never-ignored' into maint

"git status" (and "git commit") behaved as if changes in a modified
submodule are not there if submodule.*.ignore configuration is set,
which was misleading.  The configuration is only to unclutter diff
output during the course of development, and should not to hide
changes in the "status" output to cause the users forget to commit
them.

* jl/status-added-submodule-is-never-ignored:
  commit -m: commit staged submodules regardless of ignore config
  status/commit: show staged submodules regardless of ignore config

9 years agoMerge branch 'ym/fix-opportunistic-index-update-race' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:49:48 +0000 (11:49 -0700)] 
Merge branch 'ym/fix-opportunistic-index-update-race' into maint

"git status", even though it is a read-only operation, tries to
update the index with refreshed lstat(2) info to optimize future
accesses to the working tree opportunistically, but this could
race with a "read-write" operation that modify the index while it
is running.  Detect such a race and avoid overwriting the index.

* ym/fix-opportunistic-index-update-race:
  read-cache.c: verify index file before we opportunistically update it
  wrapper.c: add xpread() similar to xread()

9 years agoMerge branch 'mk/show-s-no-extra-blank-line-for-merges' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:49:39 +0000 (11:49 -0700)] 
Merge branch 'mk/show-s-no-extra-blank-line-for-merges' into maint

"git show -s" (i.e. show log message only) used to incorrectly emit
an extra blank line after a merge commit.

* mk/show-s-no-extra-blank-line-for-merges:
  git-show: fix 'git show -s' to not add extra terminator after merge commit

9 years agoMerge branch 'rr/rebase-autostash-fix' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:49:31 +0000 (11:49 -0700)] 
Merge branch 'rr/rebase-autostash-fix' into maint

The autostash mode of "git rebase -i" did not restore the dirty
working tree state if the user aborted the interactive rebase by
emptying the insn sheet.

* rr/rebase-autostash-fix:
  rebase -i: test "Nothing to do" case with autostash
  rebase -i: handle "Nothing to do" case with autostash

9 years agoMerge branch 'jc/shortlog-ref-exclude' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:49:10 +0000 (11:49 -0700)] 
Merge branch 'jc/shortlog-ref-exclude' into maint

"git log --exclude=<glob> --all | git shortlog" worked as expected,
but "git shortlog --exclude=<glob> --all", which is supposed to be
identical to the above pipeline, was not accepted at the command
line argument parser level.

* jc/shortlog-ref-exclude:
  shortlog: allow --exclude=<glob> to be passed

9 years agoMerge branch 'jl/remote-rm-prune' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:49:01 +0000 (11:49 -0700)] 
Merge branch 'jl/remote-rm-prune' into maint

"git remote rm" and "git remote prune" can involve removing many
refs at once, which is not a very efficient thing to do when very
many refs exist in the packed-refs file.

* jl/remote-rm-prune:
  remote prune: optimize "dangling symref" check/warning
  remote: repack packed-refs once when deleting multiple refs
  remote rm: delete remote configuration as the last

9 years agoMerge branch 'fc/rerere-conflict-style' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:48:54 +0000 (11:48 -0700)] 
Merge branch 'fc/rerere-conflict-style' into maint

"git rerere forget" did not work well when merge.conflictstyle
was set to a non-default value.

* fc/rerere-conflict-style:
  rerere: fix for merge.conflictstyle

9 years agoMerge branch 'rs/pack-objects-no-unnecessary-realloc' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:48:42 +0000 (11:48 -0700)] 
Merge branch 'rs/pack-objects-no-unnecessary-realloc' into maint

"git pack-objects" unnecessarily copied the previous contents when
extending the hashtable, even though it will populate the table
from scratch anyway.

* rs/pack-objects-no-unnecessary-realloc:
  pack-objects: use free()+xcalloc() instead of xrealloc()+memset()

9 years agoMerge branch 'dt/merge-recursive-case-insensitive' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:48:34 +0000 (11:48 -0700)] 
Merge branch 'dt/merge-recursive-case-insensitive' into maint

On a case insensitive filesystem, merge-recursive incorrectly
deleted the file that is to be renamed to a name that is the same
except for case differences.

* dt/merge-recursive-case-insensitive:
  mv: allow renaming to fix case on case insensitive filesystems
  merge-recursive.c: fix case-changing merge bug

9 years agoMerge branch 'rs/mailinfo-header-cmp' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:48:23 +0000 (11:48 -0700)] 
Merge branch 'rs/mailinfo-header-cmp' into maint

"git mailinfo" used to read beyond the end of header string while
parsing an incoming e-mail message to extract the patch.

* rs/mailinfo-header-cmp:
  mailinfo: use strcmp() for string comparison

9 years agoMerge branch 'jk/index-pack-report-missing' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:48:13 +0000 (11:48 -0700)] 
Merge branch 'jk/index-pack-report-missing' into maint

The error reporting from "git index-pack" has been improved to
distinguish missing objects from type errors.

* jk/index-pack-report-missing:
  index-pack: distinguish missing objects from type errors

9 years agoMerge branch 'nd/index-pack-one-fd-per-thread' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:47:58 +0000 (11:47 -0700)] 
Merge branch 'nd/index-pack-one-fd-per-thread' into maint

We used to disable threaded "git index-pack" on platforms without
thread-safe pread(); use a different workaround for such
platforms to allow threaded "git index-pack".

* nd/index-pack-one-fd-per-thread:
  index-pack: work around thread-unsafe pread()

9 years agoMerge branch 'sk/spawn-less-case-insensitively-from-grep-O-i' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:47:49 +0000 (11:47 -0700)] 
Merge branch 'sk/spawn-less-case-insensitively-from-grep-O-i' into maint

"git grep -O" to show the lines that hit in the pager did not work
well with case insensitive search.  We now spawn "less" with its
"-I" option when it is used as the pager (which is the default).

* sk/spawn-less-case-insensitively-from-grep-O-i:
  git grep -O -i: if the pager is 'less', pass the '-I' option

9 years agoMerge branch 'nd/daemonize-gc' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:47:36 +0000 (11:47 -0700)] 
Merge branch 'nd/daemonize-gc' into maint

"git gc --auto" was recently changed to run in the background to
give control back early to the end-user sitting in front of the
terminal, but it forgot that housekeeping involving reflogs should
be done without other processes competing for accesses to the refs.

* nd/daemonize-gc:
  gc --auto: do not lock refs in the background