Compare commits

..

52 Commits

Author SHA1 Message Date
740c281d21 Git 2.0.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-23 11:33:16 -07:00
98b12a4b9a .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 398dd4bd03
(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>
2014-07-23 11:27:05 -07:00
405869d0d5 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>
2014-07-23 11:26:52 -07:00
cd989a97ec Merge branch 'ah/fix-http-push' into maint
* ah/fix-http-push:
  http-push.c: make CURLOPT_IOCTLDATA a usable pointer
2014-07-22 10:29:07 -07:00
0d854fc1e3 Merge branch 'po/error-message-style' into maint
* po/error-message-style:
  doc: give some guidelines for error messages
2014-07-22 10:28:59 -07:00
a1991f1734 Merge branch 'zk/log-graph-showsig' into maint
* zk/log-graph-showsig:
  log: fix indentation for --graph --show-signature
2014-07-22 10:28:51 -07:00
514dd21326 Merge branch 'mg/fix-log-mergetag-color' into maint
* mg/fix-log-mergetag-color:
  log: correctly identify mergetag signature verification status
2014-07-22 10:28:43 -07:00
5796c5baa3 Merge branch 'cb/filter-branch-prune-empty-degenerate-merges' into maint
* cb/filter-branch-prune-empty-degenerate-merges:
  filter-branch: eliminate duplicate mapped parents
2014-07-22 10:28:30 -07:00
1a1f7b2c52 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
2014-07-22 10:28:02 -07:00
0196a605f7 Merge branch 'jm/api-strbuf-doc' into maint
* jm/api-strbuf-doc:
  api-strbuf.txt minor typos
2014-07-22 10:26:52 -07:00
054e22caf4 Merge branch 'jm/dedup-test-config' into maint
* jm/dedup-test-config:
  t/t7810-grep.sh: remove duplicate test_config()
2014-07-22 10:26:45 -07:00
ef937140a6 Merge branch 'sk/test-cmp-bin' into maint
* sk/test-cmp-bin:
  t5000, t5003: do not use test_cmp to compare binary files
2014-07-22 10:26:34 -07:00
79e9dba0d4 Merge branch 'jm/doc-wording-tweaks' into maint
* jm/doc-wording-tweaks:
  Documentation: wording fixes in the user manual and glossary
2014-07-22 10:26:17 -07:00
af3e5d1b2a Merge branch 'jm/instaweb-apache-24' into maint
* jm/instaweb-apache-24:
  git-instaweb: add support for Apache 2.4
2014-07-22 10:25:24 -07:00
cfececfe1f 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
2014-07-22 10:25:17 -07:00
1fbc6e6e60 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
2014-07-22 10:25:02 -07:00
85dd37941a Merge branch 'lt/request-pull' into maint
* lt/request-pull:
  fix brown paper bag breakage in t5150-request-pull.sh
2014-07-22 10:23:41 -07:00
63618af24a 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
2014-07-22 10:22:57 -07:00
bba6acb335 Merge branch 'maint-1.9' into maint
* maint-1.9:
  Documentation: fix missing text for rev-parse --verify
2014-07-22 10:17:34 -07:00
d31f3ad23d Merge branch 'maint-1.8.5' into maint-1.9
* maint-1.8.5:
  Documentation: fix missing text for rev-parse --verify
2014-07-22 10:16:50 -07:00
e6aaa39347 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>
2014-07-22 10:10:57 -07:00
5c0b13f85a 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>
2014-07-21 10:37:02 -07:00
51a60f5bfb 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>
2014-07-21 10:30:21 -07:00
479eaa8ef8 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>
2014-07-13 17:57:59 -07:00
42c55ce49e 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>
2014-07-10 15:25:03 -07:00
0ae0e882b2 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>
2014-07-10 13:31:55 -07:00
cf3983d1ff 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>
2014-07-09 09:37:43 -07:00
79bc4ef368 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>
2014-07-01 08:30:41 -07:00
04953bc888 http-protocol.txt: Basic Auth is defined in RFC 2617, not RFC 2616
Signed-off-by: Yi EungJun <eungjun.yi@navercorp.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-16 12:00:43 -07:00
97ea0d1043 api-strbuf.txt minor typos
Fixed some minor typos in api-strbuf.txt: 'A' instead of 'An', 'have'
instead of 'has', a overlong line, and 'another' instead of 'an other'.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-09 14:54:52 -07:00
dce6818d10 t/t7810-grep.sh: remove duplicate test_config()
t/t7810-grep.sh had its own test_config() function which served the
same purpose as the one in t/test-lib-functions.sh.  Removed, all tests
pass.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-05 11:56:01 -07:00
b93e6e3663 t5000, t5003: do not use test_cmp to compare binary files
test_cmp() is primarily meant to compare text files (and display the
difference for debug purposes).

Raw "cmp" is better suited to compare binary files (tar, zip, etc.).

On MinGW, test_cmp is a shell function mingw_test_cmp that tries to
read both files into environment, stripping CR characters (introduced
in commit 4d715ac0).

This function usually speeds things up, as fork is extremly slow on
Windows.  But no wonder that this function is extremely slow and
sometimes even crashes when comparing large tar or zip files.

Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-04 11:14:25 -07:00
644edd02c1 fix brown paper bag breakage in t5150-request-pull.sh
The recent addition to the test case 'pull request format' interrupted
the single-quoted text, effectively adding a third argument to the
test_expect_success command. Since we do not have a prerequisite named
"pull request format", the test is skipped, no matter what. Additionally,
the file name argument to the grep command is missing. Fix both issues.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-02 11:05:33 -07:00
9c65ee15ee compat/bswap.h: fix endianness detection
The changes to make detection of endianness more portable had a bug
that breaks on (at least) Solaris x86.

The bug appears to be a simple copy/paste typo. It checks for
_BIG_ENDIAN and not _LITTLE_ENDIAN for both the case where we would
decide the system is big endian and little endian. Instead, the
second test should be for _LITTLE_ENDIAN and not _BIG_ENDIAN.

Two fixes were possible:

 1. Change the negation order of the conditions in the second test.
 2. Reverse the order of the conditions in the second test.

Use the second option so that the condition we expect is always a
positive check.

Signed-off-by: Ben Walton <bdwalton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-30 11:48:28 -07:00
3c735e0776 Documentation: wording fixes in the user manual and glossary
Re-word the section on "Updating a repository with git fetch" in the
user manual.

Various other minor fixes in the manual and glossary.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-28 10:40:06 -07:00
92e25b6b5b transport-helper.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
transport_helper_init passes the arguments in reverse order, passing the
size of a helper_data*, followed by the number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:02:45 -07:00
da7a478bc0 remote.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
parse_refspec_internal passes the arguments in reverse order, passing the
size of a refspec, followed by the number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:02:45 -07:00
8e1aa2f792 reflog-walk.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
reflog-walk.c includes several calls to xcalloc() that pass the arguments
in reverse order.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:02:45 -07:00
48d547fb38 pack-revindex.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
init_pack_revindex() passes the arguments in reverse order, passing the
size of a pack_revindex, followed by the number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:02:45 -07:00
65bbf082c2 notes.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
notes.c includes several calls to xcalloc() that pass the arguments in
reverse order.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:02:45 -07:00
3345c0f5b9 imap-send.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
imap_open_store() passes the arguments in reverse order, passing the
size of an imap_store*, followed by the number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:02:45 -07:00
f3d51ffde8 http-push.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
http-push passes the arguments in reverse order, passing the size
of a repo, followed by the number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:02:45 -07:00
1a4927c5c5 diff.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
diffstat_add() passes the arguments in reverse order, passing the
size of a diffstat_file*, followed by the number of diffstat_file* to
be allocated.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:02:03 -07:00
f1064f6bc8 config.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
config.c includes several calls to xcalloc() that pass the arguments
in reverse order: the size of a struct lock_file*, followed by the
number to allocate.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:00:44 -07:00
c4a7b0092b commit.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
reduce_heads() passes the arguments in reverse order, passing the
size of a commit*, followed by the number of commit* to be allocated.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:00:43 -07:00
380694544d builtin/remote.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
builtin/remote.c includes several calls to xcalloc() that pass the
arguments in reverse order.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:00:43 -07:00
edd2d84665 builtin/ls-remote.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size.
cmd_ls_remote() passes the arguments in reverse order, passing the
size of a char*, followed by the number of char* to be allocated.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 14:00:43 -07:00
f8ee1f02da git-instaweb: add support for Apache 2.4
Detect available Apache MPMs and use first available according to
following order of precedence:
mpm_event
mpm_prefork
mpm_worker

Add authz_core module if available to avoid HTTP Error 500 errors.

Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-27 12:57:19 -07:00
c1cebcf431 scripts: more "export VAR=VALUE" fixes
Found by

    git grep '[^-]export [^&]*=' -- \*.sh

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-23 15:32:54 -07:00
bed137d2d5 scripts: "export VAR=VALUE" construct is not portable
Found by check-non-portable-shell.pl

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-23 15:32:33 -07:00
839fa9c500 compat/bswap.h: restore preference __BIG_ENDIAN over BIG_ENDIAN
The previous commit swaps the order we check the macros defined by
the compiler and the system headers from the original.  Since the
order of check should not matter (i.e. it is insane to define both
__BIG_ENDIAN and friends and BIG_ENDIAN and friends and in a
conflicting way), it is the most conservative thing to do not to
change it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-02 12:36:10 -07:00
3cf6bb3406 compat/bswap.h: detect endianness on more platforms that don't use BYTE_ORDER
Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-02 12:31:59 -07:00
51 changed files with 221 additions and 124 deletions

View File

@ -202,6 +202,7 @@ Seth Falcon <seth@userprimary.net> <sfalcon@fhcrc.org>
Shawn O. Pearce <spearce@spearce.org> Shawn O. Pearce <spearce@spearce.org>
Simon Hausmann <hausmann@kde.org> <simon@lst.de> Simon Hausmann <hausmann@kde.org> <simon@lst.de>
Simon Hausmann <hausmann@kde.org> <shausman@trolltech.com> Simon Hausmann <hausmann@kde.org> <shausman@trolltech.com>
Stefan Beller <stefanbeller@gmail.com> <stefanbeller@googlemail.com>
Stefan Naewe <stefan.naewe@gmail.com> <stefan.naewe@atlas-elektronik.com> Stefan Naewe <stefan.naewe@gmail.com> <stefan.naewe@atlas-elektronik.com>
Stefan Naewe <stefan.naewe@gmail.com> <stefan.naewe@googlemail.com> Stefan Naewe <stefan.naewe@gmail.com> <stefan.naewe@googlemail.com>
Stefan Sperling <stsp@elego.de> <stsp@stsp.name> Stefan Sperling <stsp@elego.de> <stsp@stsp.name>

View File

@ -264,6 +264,15 @@ For Python scripts:
documentation for version 2.6 does not mention this prefix, it has documentation for version 2.6 does not mention this prefix, it has
been supported since version 2.6.0. been supported since version 2.6.0.
Error Messages
- Do not end error messages with a full stop.
- Do not capitalize ("unable to open %s", not "Unable to open %s")
- Say what the error is first ("cannot open %s", not "%s: cannot open")
Writing Documentation: Writing Documentation:
Most (if not all) of the documentation pages are written in the Most (if not all) of the documentation pages are written in the

View File

@ -0,0 +1,17 @@
Git v2.0.3 Release Notes
========================
* An ancient rewrite passed a wrong pointer to a curl library
function in a rarely used code path.
* "filter-branch" left an empty single-parent commit that results when
all parents of a merge commit gets mapped to the same commit, even
under "--prune-empty".
* "log --show-signature" incorrectly decided the color to paint a
mergetag that was and was not correctly validated.
* "log --show-signature" did not pay attention to "--graph" option.
Also a lot of fixes to the tests and some updates to the docs are
included.

View File

@ -102,7 +102,7 @@ eval "set -- $(git rev-parse --sq --prefix "$prefix" "$@")"
+ +
If you want to make sure that the output actually names an object in If you want to make sure that the output actually names an object in
your object database and/or can be used as a specific type of object your object database and/or can be used as a specific type of object
you require, you can add "^{type}" peeling operator to the parameter. you require, you can add "\^{type}" peeling operator to the parameter.
For example, `git rev-parse "$VAR^{commit}"` will make sure `$VAR` For example, `git rev-parse "$VAR^{commit}"` will make sure `$VAR`
names an existing object that is a commit-ish (i.e. a commit, or an names an existing object that is a commit-ish (i.e. a commit, or an
annotated tag that points at a commit). To make sure that `$VAR` annotated tag that points at a commit). To make sure that `$VAR`

View File

@ -43,9 +43,10 @@ unreleased) version of Git, that is available from 'master'
branch of the `git.git` repository. branch of the `git.git` repository.
Documentation for older releases are available here: Documentation for older releases are available here:
* link:v2.0.2/git.html[documentation for release 2.0.2] * link:v2.0.3/git.html[documentation for release 2.0.3]
* release notes for * release notes for
link:RelNotes/2.0.3.txt[2.0.3],
link:RelNotes/2.0.2.txt[2.0.2], link:RelNotes/2.0.2.txt[2.0.2],
link:RelNotes/2.0.1.txt[2.0.1], link:RelNotes/2.0.1.txt[2.0.1],
link:RelNotes/2.0.0.txt[2.0.0]. link:RelNotes/2.0.0.txt[2.0.0].
@ -1044,7 +1045,7 @@ Authors
------- -------
Git was started by Linus Torvalds, and is currently maintained by Junio Git was started by Linus Torvalds, and is currently maintained by Junio
C Hamano. Numerous contributions have come from the Git mailing list C Hamano. Numerous contributions have come from the Git mailing list
<git@vger.kernel.org>. http://www.ohloh.net/p/git/contributors/summary <git@vger.kernel.org>. http://www.openhub.net/p/git/contributors/summary
gives you a more complete list of contributors. gives you a more complete list of contributors.
If you have a clone of git.git itself, the If you have a clone of git.git itself, the

View File

@ -1,7 +1,7 @@
[[def_alternate_object_database]]alternate object database:: [[def_alternate_object_database]]alternate object database::
Via the alternates mechanism, a <<def_repository,repository>> Via the alternates mechanism, a <<def_repository,repository>>
can inherit part of its <<def_object_database,object database>> can inherit part of its <<def_object_database,object database>>
from another object database, which is called "alternate". from another object database, which is called an "alternate".
[[def_bare_repository]]bare repository:: [[def_bare_repository]]bare repository::
A bare repository is normally an appropriately A bare repository is normally an appropriately

View File

@ -7,10 +7,10 @@ use the mem* functions than a str* one (memchr vs. strchr e.g.).
Though, one has to be careful about the fact that str* functions often Though, one has to be careful about the fact that str* functions often
stop on NULs and that strbufs may have embedded NULs. stop on NULs and that strbufs may have embedded NULs.
An strbuf is NUL terminated for convenience, but no function in the A strbuf is NUL terminated for convenience, but no function in the
strbuf API actually relies on the string being free of NULs. strbuf API actually relies on the string being free of NULs.
strbufs has some invariants that are very important to keep in mind: strbufs have some invariants that are very important to keep in mind:
. The `buf` member is never NULL, so it can be used in any usual C . The `buf` member is never NULL, so it can be used in any usual C
string operations safely. strbuf's _have_ to be initialized either by string operations safely. strbuf's _have_ to be initialized either by
@ -56,8 +56,8 @@ Data structures
* `struct strbuf` * `struct strbuf`
This is the string buffer structure. The `len` member can be used to This is the string buffer structure. The `len` member can be used to
determine the current length of the string, and `buf` member provides access to determine the current length of the string, and `buf` member provides
the string itself. access to the string itself.
Functions Functions
--------- ---------
@ -184,7 +184,7 @@ strbuf_addstr(sb, "immediate string");
`strbuf_addbuf`:: `strbuf_addbuf`::
Copy the contents of an other buffer at the end of the current one. Copy the contents of another buffer at the end of the current one.
`strbuf_adddup`:: `strbuf_adddup`::

View File

@ -60,7 +60,7 @@ Because Git repositories are accessed by standard path components
server administrators MAY use directory based permissions within server administrators MAY use directory based permissions within
their HTTP server to control repository access. their HTTP server to control repository access.
Clients SHOULD support Basic authentication as described by RFC 2616. Clients SHOULD support Basic authentication as described by RFC 2617.
Servers SHOULD support Basic authentication by relying upon the Servers SHOULD support Basic authentication by relying upon the
HTTP server placed in front of the Git server software. HTTP server placed in front of the Git server software.

View File

@ -416,12 +416,11 @@ REVISIONS" section of linkgit:gitrevisions[7].
Updating a repository with git fetch Updating a repository with git fetch
------------------------------------ ------------------------------------
Eventually the developer cloned from will do additional work in her After you clone a repository and commit a few changes of your own, you
repository, creating new commits and advancing the branches to point may wish to check the original repository for updates.
at the new commits.
The command `git fetch`, with no arguments, will update all of the The `git-fetch` command, with no arguments, will update all of the
remote-tracking branches to the latest version found in her remote-tracking branches to the latest version found in the original
repository. It will not touch any of your own branches--not even the repository. It will not touch any of your own branches--not even the
"master" branch that was created for you on clone. "master" branch that was created for you on clone.
@ -1811,8 +1810,8 @@ manner.
You can then import these into your mail client and send them by You can then import these into your mail client and send them by
hand. However, if you have a lot to send at once, you may prefer to hand. However, if you have a lot to send at once, you may prefer to
use the linkgit:git-send-email[1] script to automate the process. use the linkgit:git-send-email[1] script to automate the process.
Consult the mailing list for your project first to determine how they Consult the mailing list for your project first to determine
prefer such patches be handled. their requirements for submitting patches.
[[importing-patches]] [[importing-patches]]
Importing patches to a project Importing patches to a project
@ -2255,7 +2254,7 @@ $ git checkout test && git merge speed-up-spinlocks
It is unlikely that you would have any conflicts here ... but you might if you It is unlikely that you would have any conflicts here ... but you might if you
spent a while on this step and had also pulled new versions from upstream. spent a while on this step and had also pulled new versions from upstream.
Some time later when enough time has passed and testing done, you can pull the Sometime later when enough time has passed and testing done, you can pull the
same branch into the `release` tree ready to go upstream. This is where you same branch into the `release` tree ready to go upstream. This is where you
see the value of keeping each patch (or patch series) in its own branch. It see the value of keeping each patch (or patch series) in its own branch. It
means that the patches can be moved into the `release` tree in any order. means that the patches can be moved into the `release` tree in any order.

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
GVF=GIT-VERSION-FILE GVF=GIT-VERSION-FILE
DEF_VER=v2.0.2 DEF_VER=v2.0.3
LF=' LF='
' '

View File

@ -1 +1 @@
Documentation/RelNotes/2.0.2.txt Documentation/RelNotes/2.0.3.txt

View File

@ -2869,9 +2869,7 @@ static int apply_binary_fragment(struct image *img, struct patch *patch)
case BINARY_LITERAL_DEFLATED: case BINARY_LITERAL_DEFLATED:
clear_image(img); clear_image(img);
img->len = fragment->size; img->len = fragment->size;
img->buf = xmalloc(img->len+1); img->buf = xmemdupz(fragment->patch, img->len);
memcpy(img->buf, fragment->patch, img->len);
img->buf[img->len] = '\0';
return 0; return 0;
} }
return -1; return -1;

View File

@ -2458,11 +2458,8 @@ parse_done:
die("revision walk setup failed"); die("revision walk setup failed");
if (is_null_sha1(sb.final->object.sha1)) { if (is_null_sha1(sb.final->object.sha1)) {
char *buf;
o = sb.final->util; o = sb.final->util;
buf = xmalloc(o->file.size + 1); sb.final_buf = xmemdupz(o->file.ptr, o->file.size);
memcpy(buf, o->file.ptr, o->file.size + 1);
sb.final_buf = buf;
sb.final_buf_size = o->file.size; sb.final_buf_size = o->file.size;
} }
else { else {

View File

@ -621,8 +621,7 @@ static int *list_and_choose(struct menu_opts *opts, struct menu_stuff *stuff)
nr += chosen[i]; nr += chosen[i];
} }
result = xmalloc(sizeof(int) * (nr + 1)); result = xcalloc(nr + 1, sizeof(int));
memset(result, 0, sizeof(int) * (nr + 1));
for (i = 0; i < stuff->nr && j < nr; i++) { for (i = 0; i < stuff->nr && j < nr; i++) {
if (chosen[i]) if (chosen[i])
result[j++] = i; result[j++] = i;

View File

@ -362,8 +362,7 @@ static void set_thread_data(struct thread_local *data)
static struct base_data *alloc_base_data(void) static struct base_data *alloc_base_data(void)
{ {
struct base_data *base = xmalloc(sizeof(struct base_data)); struct base_data *base = xcalloc(1, sizeof(struct base_data));
memset(base, 0, sizeof(*base));
base->ref_last = -1; base->ref_last = -1;
base->ofs_last = -1; base->ofs_last = -1;
return base; return base;

View File

@ -92,7 +92,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
if (argv[i]) { if (argv[i]) {
int j; int j;
pattern = xcalloc(sizeof(const char *), argc - i + 1); pattern = xcalloc(argc - i + 1, sizeof(const char *));
for (j = i; j < argc; j++) { for (j = i; j < argc; j++) {
int len = strlen(argv[j]); int len = strlen(argv[j]);
char *p = xmalloc(len + 3); char *p = xmalloc(len + 3);

View File

@ -282,7 +282,7 @@ static int config_read_branches(const char *key, const char *value, void *cb)
item = string_list_insert(&branch_list, name); item = string_list_insert(&branch_list, name);
if (!item->util) if (!item->util)
item->util = xcalloc(sizeof(struct branch_info), 1); item->util = xcalloc(1, sizeof(struct branch_info));
info = item->util; info = item->util;
if (type == REMOTE) { if (type == REMOTE) {
if (info->remote_name) if (info->remote_name)
@ -398,7 +398,7 @@ static int get_push_ref_states(const struct ref *remote_refs,
item = string_list_append(&states->push, item = string_list_append(&states->push,
abbrev_branch(ref->peer_ref->name)); abbrev_branch(ref->peer_ref->name));
item->util = xcalloc(sizeof(struct push_info), 1); item->util = xcalloc(1, sizeof(struct push_info));
info = item->util; info = item->util;
info->forced = ref->force; info->forced = ref->force;
info->dest = xstrdup(abbrev_branch(ref->name)); info->dest = xstrdup(abbrev_branch(ref->name));
@ -433,7 +433,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)
states->push.strdup_strings = 1; states->push.strdup_strings = 1;
if (!remote->push_refspec_nr) { if (!remote->push_refspec_nr) {
item = string_list_append(&states->push, _("(matching)")); item = string_list_append(&states->push, _("(matching)"));
info = item->util = xcalloc(sizeof(struct push_info), 1); info = item->util = xcalloc(1, sizeof(struct push_info));
info->status = PUSH_STATUS_NOTQUERIED; info->status = PUSH_STATUS_NOTQUERIED;
info->dest = xstrdup(item->string); info->dest = xstrdup(item->string);
} }
@ -446,7 +446,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)
else else
item = string_list_append(&states->push, _("(delete)")); item = string_list_append(&states->push, _("(delete)"));
info = item->util = xcalloc(sizeof(struct push_info), 1); info = item->util = xcalloc(1, sizeof(struct push_info));
info->forced = spec->force; info->forced = spec->force;
info->status = PUSH_STATUS_NOTQUERIED; info->status = PUSH_STATUS_NOTQUERIED;
info->dest = xstrdup(spec->dst ? spec->dst : item->string); info->dest = xstrdup(spec->dst ? spec->dst : item->string);

View File

@ -1089,7 +1089,7 @@ struct commit_list *reduce_heads(struct commit_list *heads)
p->item->object.flags |= STALE; p->item->object.flags |= STALE;
num_head++; num_head++;
} }
array = xcalloc(sizeof(*array), num_head); array = xcalloc(num_head, sizeof(*array));
for (p = heads, i = 0; p; p = p->next) { for (p = heads, i = 0; p; p = p->next) {
if (p->item->object.flags & STALE) { if (p->item->object.flags & STALE) {
array[i++] = p->item; array[i++] = p->item;

View File

@ -101,19 +101,34 @@ static inline uint64_t git_bswap64(uint64_t x)
#undef ntohll #undef ntohll
#undef htonll #undef htonll
#if !defined(__BYTE_ORDER) #if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN)
# if defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)
# define __BYTE_ORDER BYTE_ORDER # define GIT_BYTE_ORDER __BYTE_ORDER
# define __LITTLE_ENDIAN LITTLE_ENDIAN # define GIT_LITTLE_ENDIAN __LITTLE_ENDIAN
# define __BIG_ENDIAN BIG_ENDIAN # define GIT_BIG_ENDIAN __BIG_ENDIAN
#elif defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN)
# define GIT_BYTE_ORDER BYTE_ORDER
# define GIT_LITTLE_ENDIAN LITTLE_ENDIAN
# define GIT_BIG_ENDIAN BIG_ENDIAN
#else
# define GIT_BIG_ENDIAN 4321
# define GIT_LITTLE_ENDIAN 1234
# if defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
# define GIT_BYTE_ORDER GIT_BIG_ENDIAN
# elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
# define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN
# else
# error "Cannot determine endianness"
# endif # endif
#endif #endif
#if !defined(__BYTE_ORDER) #if GIT_BYTE_ORDER == GIT_BIG_ENDIAN
# error "Cannot determine endianness"
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
# define ntohll(n) (n) # define ntohll(n) (n)
# define htonll(n) (n) # define htonll(n) (n)
#else #else

View File

@ -1226,8 +1226,7 @@ static int WSAAPI getaddrinfo_stub(const char *node, const char *service,
else else
ai->ai_canonname = NULL; ai->ai_canonname = NULL;
sin = xmalloc(ai->ai_addrlen); sin = xcalloc(1, ai->ai_addrlen);
memset(sin, 0, ai->ai_addrlen);
sin->sin_family = AF_INET; sin->sin_family = AF_INET;
/* Note: getaddrinfo is supposed to allow service to be a string, /* Note: getaddrinfo is supposed to allow service to be a string,
* which should be looked up using getservbyname. This is * which should be looked up using getservbyname. This is

View File

@ -1538,7 +1538,7 @@ int git_config_set_multivar_in_file(const char *config_filename,
* The lock serves a purpose in addition to locking: the new * The lock serves a purpose in addition to locking: the new
* contents of .git/config will be written into it. * contents of .git/config will be written into it.
*/ */
lock = xcalloc(sizeof(struct lock_file), 1); lock = xcalloc(1, sizeof(struct lock_file));
fd = hold_lock_file_for_update(lock, config_filename, 0); fd = hold_lock_file_for_update(lock, config_filename, 0);
if (fd < 0) { if (fd < 0) {
error("could not lock config file %s: %s", config_filename, strerror(errno)); error("could not lock config file %s: %s", config_filename, strerror(errno));
@ -1793,7 +1793,7 @@ int git_config_rename_section_in_file(const char *config_filename,
if (!config_filename) if (!config_filename)
config_filename = filename_buf = git_pathdup("config"); config_filename = filename_buf = git_pathdup("config");
lock = xcalloc(sizeof(struct lock_file), 1); lock = xcalloc(1, sizeof(struct lock_file));
out_fd = hold_lock_file_for_update(lock, config_filename, 0); out_fd = hold_lock_file_for_update(lock, config_filename, 0);
if (out_fd < 0) { if (out_fd < 0) {
ret = error("could not lock config file %s", config_filename); ret = error("could not lock config file %s", config_filename);

View File

@ -64,9 +64,7 @@ static void parse_one_symref_info(struct string_list *symref, const char *val, i
if (!len) if (!len)
return; /* just "symref" */ return; /* just "symref" */
/* e.g. "symref=HEAD:refs/heads/master" */ /* e.g. "symref=HEAD:refs/heads/master" */
sym = xmalloc(len + 1); sym = xmemdupz(val, len);
memcpy(sym, val, len);
sym[len] = '\0';
target = strchr(sym, ':'); target = strchr(sym, ':');
if (!target) if (!target)
/* just "symref=something" */ /* just "symref=something" */

View File

@ -8,7 +8,8 @@ This test verifies the basic operation of the merge, pull, add
and split subcommands of git subtree. and split subcommands of git subtree.
' '
export TEST_DIRECTORY=$(pwd)/../../../t TEST_DIRECTORY=$(pwd)/../../../t
export TEST_DIRECTORY
. ../../../t/test-lib.sh . ../../../t/test-lib.sh

2
diff.c
View File

@ -1361,7 +1361,7 @@ static struct diffstat_file *diffstat_add(struct diffstat_t *diffstat,
const char *name_b) const char *name_b)
{ {
struct diffstat_file *x; struct diffstat_file *x;
x = xcalloc(sizeof (*x), 1); x = xcalloc(1, sizeof(*x));
ALLOC_GROW(diffstat->files, diffstat->nr + 1, diffstat->alloc); ALLOC_GROW(diffstat->files, diffstat->nr + 1, diffstat->alloc);
diffstat->files[diffstat->nr++] = x; diffstat->files[diffstat->nr++] = x;
if (name_b) { if (name_b) {

View File

@ -332,7 +332,13 @@ while read commit parents; do
parentstr= parentstr=
for parent in $parents; do for parent in $parents; do
for reparent in $(map "$parent"); do for reparent in $(map "$parent"); do
parentstr="$parentstr -p $reparent" case "$parentstr " in
*" -p $reparent "*)
;;
*)
parentstr="$parentstr -p $reparent"
;;
esac
done done
done done
if [ "$filter_parent" ]; then if [ "$filter_parent" ]; then

View File

@ -345,7 +345,17 @@ PidFile "$fqgitdir/pid"
Listen $bind$port Listen $bind$port
EOF EOF
for mod in mime dir env log_config for mod in mpm_event mpm_prefork mpm_worker
do
if test -e $module_path/mod_${mod}.so
then
echo "LoadModule ${mod}_module " \
"$module_path/mod_${mod}.so" >> "$conf"
# only one mpm module permitted
break
fi
done
for mod in mime dir env log_config authz_core
do do
if test -e $module_path/mod_${mod}.so if test -e $module_path/mod_${mod}.so
then then

View File

@ -13,7 +13,8 @@ refspec="${GIT_REMOTE_TESTGIT_REFSPEC-$default_refspec}"
test -z "$refspec" && prefix="refs" test -z "$refspec" && prefix="refs"
export GIT_DIR="$url/.git" GIT_DIR="$url/.git"
export GIT_DIR
force= force=

View File

@ -94,7 +94,8 @@ create_stash () {
# ease of unpacking later. # ease of unpacking later.
u_commit=$( u_commit=$(
untracked_files | ( untracked_files | (
export GIT_INDEX_FILE="$TMPindex" GIT_INDEX_FILE="$TMPindex" &&
export GIT_INDEX_FILE &&
rm -f "$TMPindex" && rm -f "$TMPindex" &&
git update-index -z --add --remove --stdin && git update-index -z --add --remove --stdin &&
u_tree=$(git write-tree) && u_tree=$(git write-tree) &&

View File

@ -607,9 +607,7 @@ int main(int argc, char **argv)
cmd = c; cmd = c;
n = out[0].rm_eo - out[0].rm_so; n = out[0].rm_eo - out[0].rm_so;
cmd_arg = xmalloc(n); cmd_arg = xmemdupz(dir + out[0].rm_so + 1, n - 1);
memcpy(cmd_arg, dir + out[0].rm_so + 1, n-1);
cmd_arg[n-1] = '\0';
dir[out[0].rm_so] = 0; dir[out[0].rm_so] = 0;
break; break;
} }

View File

@ -199,7 +199,7 @@ static void curl_setup_http(CURL *curl, const char *url,
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer); curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer);
#ifndef NO_CURL_IOCTL #ifndef NO_CURL_IOCTL
curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_buffer); curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_buffer);
curl_easy_setopt(curl, CURLOPT_IOCTLDATA, &buffer); curl_easy_setopt(curl, CURLOPT_IOCTLDATA, buffer);
#endif #endif
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_fn); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_fn);
curl_easy_setopt(curl, CURLOPT_NOBODY, 0); curl_easy_setopt(curl, CURLOPT_NOBODY, 0);
@ -1732,7 +1732,7 @@ int main(int argc, char **argv)
git_extract_argv0_path(argv[0]); git_extract_argv0_path(argv[0]);
repo = xcalloc(sizeof(*repo), 1); repo = xcalloc(1, sizeof(*repo));
argv++; argv++;
for (i = 1; i < argc; i++, argv++) { for (i = 1; i < argc; i++, argv++) {

View File

@ -951,7 +951,7 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc)
char *arg, *rsp; char *arg, *rsp;
int s = -1, preauth; int s = -1, preauth;
ctx = xcalloc(sizeof(*ctx), 1); ctx = xcalloc(1, sizeof(*ctx));
ctx->imap = imap = xcalloc(sizeof(*imap), 1); ctx->imap = imap = xcalloc(sizeof(*imap), 1);
imap->buf.sock.fd[0] = imap->buf.sock.fd[1] = -1; imap->buf.sock.fd[0] = imap->buf.sock.fd[1] = -1;

View File

@ -365,6 +365,7 @@ static void show_sig_lines(struct rev_info *opt, int status, const char *bol)
eol = strchrnul(bol, '\n'); eol = strchrnul(bol, '\n');
printf("%s%.*s%s%s", color, (int)(eol - bol), bol, reset, printf("%s%.*s%s%s", color, (int)(eol - bol), bol, reset,
*eol ? "\n" : ""); *eol ? "\n" : "");
graph_show_oneline(opt->graph);
bol = (*eol) ? (eol + 1) : eol; bol = (*eol) ? (eol + 1) : eol;
} }
} }
@ -446,16 +447,17 @@ static void show_one_mergetag(struct rev_info *opt,
payload_size = parse_signature(extra->value, extra->len); payload_size = parse_signature(extra->value, extra->len);
status = -1; status = -1;
if (extra->len > payload_size) if (extra->len > payload_size) {
if (verify_signed_buffer(extra->value, payload_size, /* could have a good signature */
extra->value + payload_size, if (!verify_signed_buffer(extra->value, payload_size,
extra->len - payload_size, extra->value + payload_size,
&verify_message, NULL)) { extra->len - payload_size,
if (verify_message.len <= gpg_message_offset) &verify_message, NULL))
strbuf_addstr(&verify_message, "No signature\n"); status = 0; /* good */
else else if (verify_message.len <= gpg_message_offset)
status = 0; strbuf_addstr(&verify_message, "No signature\n");
} /* otherwise we couldn't verify, which is shown as bad */
}
show_sig_lines(opt, status, verify_message.buf); show_sig_lines(opt, status, verify_message.buf);
strbuf_release(&verify_message); strbuf_release(&verify_message);

View File

@ -303,7 +303,7 @@ static int note_tree_insert(struct notes_tree *t, struct int_node *tree,
free(entry); free(entry);
return 0; return 0;
} }
new_node = (struct int_node *) xcalloc(sizeof(struct int_node), 1); new_node = (struct int_node *) xcalloc(1, sizeof(struct int_node));
ret = note_tree_insert(t, new_node, n + 1, l, GET_PTR_TYPE(*p), ret = note_tree_insert(t, new_node, n + 1, l, GET_PTR_TYPE(*p),
combine_notes); combine_notes);
if (ret) if (ret)
@ -443,7 +443,7 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
if (len <= 20) { if (len <= 20) {
type = PTR_TYPE_NOTE; type = PTR_TYPE_NOTE;
l = (struct leaf_node *) l = (struct leaf_node *)
xcalloc(sizeof(struct leaf_node), 1); xcalloc(1, sizeof(struct leaf_node));
hashcpy(l->key_sha1, object_sha1); hashcpy(l->key_sha1, object_sha1);
hashcpy(l->val_sha1, entry.sha1); hashcpy(l->val_sha1, entry.sha1);
if (len < 20) { if (len < 20) {
@ -1003,7 +1003,7 @@ void init_notes(struct notes_tree *t, const char *notes_ref,
if (!combine_notes) if (!combine_notes)
combine_notes = combine_notes_concatenate; combine_notes = combine_notes_concatenate;
t->root = (struct int_node *) xcalloc(sizeof(struct int_node), 1); t->root = (struct int_node *) xcalloc(1, sizeof(struct int_node));
t->first_non_note = NULL; t->first_non_note = NULL;
t->prev_non_note = NULL; t->prev_non_note = NULL;
t->ref = notes_ref ? xstrdup(notes_ref) : NULL; t->ref = notes_ref ? xstrdup(notes_ref) : NULL;

View File

@ -45,7 +45,7 @@ static void init_pack_revindex(void)
if (!num) if (!num)
return; return;
pack_revindex_hashsz = num * 11; pack_revindex_hashsz = num * 11;
pack_revindex = xcalloc(sizeof(*pack_revindex), pack_revindex_hashsz); pack_revindex = xcalloc(pack_revindex_hashsz, sizeof(*pack_revindex));
for (p = packed_git; p; p = p->next) { for (p = packed_git; p; p = p->next) {
num = pack_revindex_ix(p); num = pack_revindex_ix(p);
num = - 1 - num; num = - 1 - num;

4
path.c
View File

@ -249,9 +249,7 @@ int validate_headref(const char *path)
static struct passwd *getpw_str(const char *username, size_t len) static struct passwd *getpw_str(const char *username, size_t len)
{ {
struct passwd *pw; struct passwd *pw;
char *username_z = xmalloc(len + 1); char *username_z = xmemdupz(username, len);
memcpy(username_z, username, len);
username_z[len] = '\0';
pw = getpwnam(username_z); pw = getpwnam(username_z);
free(username_z); free(username_z);
return pw; return pw;

View File

@ -389,8 +389,7 @@ void parse_pathspec(struct pathspec *pathspec,
if (!(flags & PATHSPEC_PREFER_CWD)) if (!(flags & PATHSPEC_PREFER_CWD))
die("BUG: PATHSPEC_PREFER_CWD requires arguments"); die("BUG: PATHSPEC_PREFER_CWD requires arguments");
pathspec->items = item = xmalloc(sizeof(*item)); pathspec->items = item = xcalloc(1, sizeof(*item));
memset(item, 0, sizeof(*item));
item->match = prefix; item->match = prefix;
item->original = prefix; item->original = prefix;
item->nowildcard_len = item->len = strlen(prefix); item->nowildcard_len = item->len = strlen(prefix);

View File

@ -41,7 +41,7 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1,
static struct complete_reflogs *read_complete_reflog(const char *ref) static struct complete_reflogs *read_complete_reflog(const char *ref)
{ {
struct complete_reflogs *reflogs = struct complete_reflogs *reflogs =
xcalloc(sizeof(struct complete_reflogs), 1); xcalloc(1, sizeof(struct complete_reflogs));
reflogs->ref = xstrdup(ref); reflogs->ref = xstrdup(ref);
for_each_reflog_ent(ref, read_one_reflog, reflogs); for_each_reflog_ent(ref, read_one_reflog, reflogs);
if (reflogs->nr == 0) { if (reflogs->nr == 0) {
@ -135,7 +135,7 @@ struct reflog_walk_info {
void init_reflog_walk(struct reflog_walk_info** info) void init_reflog_walk(struct reflog_walk_info** info)
{ {
*info = xcalloc(sizeof(struct reflog_walk_info), 1); *info = xcalloc(1, sizeof(struct reflog_walk_info));
} }
int add_reflog_for_walk(struct reflog_walk_info *info, int add_reflog_for_walk(struct reflog_walk_info *info,
@ -199,7 +199,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
= reflogs; = reflogs;
} }
commit_reflog = xcalloc(sizeof(struct commit_reflog), 1); commit_reflog = xcalloc(1, sizeof(struct commit_reflog));
if (recno < 0) { if (recno < 0) {
commit_reflog->recno = get_reflog_recno_by_time(reflogs, timestamp); commit_reflog->recno = get_reflog_recno_by_time(reflogs, timestamp);
if (commit_reflog->recno < 0) { if (commit_reflog->recno < 0) {
@ -242,7 +242,7 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
return; return;
} }
commit->parents = xcalloc(sizeof(struct commit_list), 1); commit->parents = xcalloc(1, sizeof(struct commit_list));
commit->parents->item = commit_info->commit; commit->parents->item = commit_info->commit;
} }

View File

@ -523,7 +523,7 @@ static void free_refspecs(struct refspec *refspec, int nr_refspec)
static struct refspec *parse_refspec_internal(int nr_refspec, const char **refspec, int fetch, int verify) static struct refspec *parse_refspec_internal(int nr_refspec, const char **refspec, int fetch, int verify)
{ {
int i; int i;
struct refspec *rs = xcalloc(sizeof(*rs), nr_refspec); struct refspec *rs = xcalloc(nr_refspec, sizeof(*rs));
for (i = 0; i < nr_refspec; i++) { for (i = 0; i < nr_refspec; i++) {
size_t llen; size_t llen;

View File

@ -278,9 +278,7 @@ static string_list_ty variables_set;
static void static void
note_variable (const char *var_ptr, size_t var_len) note_variable (const char *var_ptr, size_t var_len)
{ {
char *string = xmalloc (var_len + 1); char *string = xmemdupz (var_ptr, var_len);
memcpy (string, var_ptr, var_len);
string[var_len] = '\0';
string_list_append (&variables_set, string); string_list_append (&variables_set, string);
} }

View File

@ -14,7 +14,11 @@ test_description='merge-recursive options
. ./test-lib.sh . ./test-lib.sh
test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b test_have_prereq SED_STRIPS_CR && SED_OPTIONS=-b
test_have_prereq GREP_STRIPS_CR && export GREP_OPTIONS=-U if test_have_prereq GREP_STRIPS_CR
then
GREP_OPTIONS=-U
export GREP_OPTIONS
fi
test_expect_success 'setup' ' test_expect_success 'setup' '
conflict_hunks () { conflict_hunks () {

View File

@ -3,6 +3,7 @@
test_description='git log' test_description='git log'
. ./test-lib.sh . ./test-lib.sh
. "$TEST_DIRECTORY/lib-gpg.sh"
test_expect_success setup ' test_expect_success setup '
@ -841,4 +842,34 @@ test_expect_success 'dotdot is a parent directory' '
test_cmp expect actual test_cmp expect actual
' '
test_expect_success GPG 'log --graph --show-signature' '
test_when_finished "git reset --hard && git checkout master" &&
git checkout -b signed master &&
echo foo >foo &&
git add foo &&
git commit -S -m signed_commit &&
git log --graph --show-signature -n1 signed >actual &&
grep "^| gpg: Signature made" actual &&
grep "^| gpg: Good signature" actual
'
test_expect_success GPG 'log --graph --show-signature for merged tag' '
test_when_finished "git reset --hard && git checkout master" &&
git checkout -b plain master &&
echo aaa >bar &&
git add bar &&
git commit -m bar_commit &&
git checkout -b tagged master &&
echo bbb >baz &&
git add baz &&
git commit -m baz_commit &&
git tag -s -m signed_tag_msg signed_tag &&
git checkout plain &&
git merge --no-ff -m msg signed_tag &&
git log --graph --show-signature -n1 plain >actual &&
grep "^|\\\ merged tag" actual &&
grep "^| | gpg: Signature made" actual &&
grep "^| | gpg: Good signature" actual
'
test_done test_done

View File

@ -164,7 +164,7 @@ check_tar with_olde-prefix olde-
test_expect_success 'git archive on large files' ' test_expect_success 'git archive on large files' '
test_config core.bigfilethreshold 1 && test_config core.bigfilethreshold 1 &&
git archive HEAD >b3.tar && git archive HEAD >b3.tar &&
test_cmp b.tar b3.tar test_cmp_bin b.tar b3.tar
' '
test_expect_success \ test_expect_success \
@ -173,15 +173,15 @@ test_expect_success \
test_expect_success \ test_expect_success \
'git archive vs. the same in a bare repo' \ 'git archive vs. the same in a bare repo' \
'test_cmp b.tar b3.tar' 'test_cmp_bin b.tar b3.tar'
test_expect_success 'git archive with --output' \ test_expect_success 'git archive with --output' \
'git archive --output=b4.tar HEAD && 'git archive --output=b4.tar HEAD &&
test_cmp b.tar b4.tar' test_cmp_bin b.tar b4.tar'
test_expect_success 'git archive --remote' \ test_expect_success 'git archive --remote' \
'git archive --remote=. HEAD >b5.tar && 'git archive --remote=. HEAD >b5.tar &&
test_cmp b.tar b5.tar' test_cmp_bin b.tar b5.tar'
test_expect_success \ test_expect_success \
'validate file modification time' \ 'validate file modification time' \
@ -198,7 +198,7 @@ test_expect_success \
test_expect_success 'git archive with --output, override inferred format' ' test_expect_success 'git archive with --output, override inferred format' '
git archive --format=tar --output=d4.zip HEAD && git archive --format=tar --output=d4.zip HEAD &&
test_cmp b.tar d4.zip test_cmp_bin b.tar d4.zip
' '
test_expect_success \ test_expect_success \
@ -244,34 +244,34 @@ test_expect_success 'archive --list shows only enabled remote filters' '
test_expect_success 'invoke tar filter by format' ' test_expect_success 'invoke tar filter by format' '
git archive --format=tar.foo HEAD >config.tar.foo && git archive --format=tar.foo HEAD >config.tar.foo &&
tr ab ba <config.tar.foo >config.tar && tr ab ba <config.tar.foo >config.tar &&
test_cmp b.tar config.tar && test_cmp_bin b.tar config.tar &&
git archive --format=bar HEAD >config.bar && git archive --format=bar HEAD >config.bar &&
tr ab ba <config.bar >config.tar && tr ab ba <config.bar >config.tar &&
test_cmp b.tar config.tar test_cmp_bin b.tar config.tar
' '
test_expect_success 'invoke tar filter by extension' ' test_expect_success 'invoke tar filter by extension' '
git archive -o config-implicit.tar.foo HEAD && git archive -o config-implicit.tar.foo HEAD &&
test_cmp config.tar.foo config-implicit.tar.foo && test_cmp_bin config.tar.foo config-implicit.tar.foo &&
git archive -o config-implicit.bar HEAD && git archive -o config-implicit.bar HEAD &&
test_cmp config.tar.foo config-implicit.bar test_cmp_bin config.tar.foo config-implicit.bar
' '
test_expect_success 'default output format remains tar' ' test_expect_success 'default output format remains tar' '
git archive -o config-implicit.baz HEAD && git archive -o config-implicit.baz HEAD &&
test_cmp b.tar config-implicit.baz test_cmp_bin b.tar config-implicit.baz
' '
test_expect_success 'extension matching requires dot' ' test_expect_success 'extension matching requires dot' '
git archive -o config-implicittar.foo HEAD && git archive -o config-implicittar.foo HEAD &&
test_cmp b.tar config-implicittar.foo test_cmp_bin b.tar config-implicittar.foo
' '
test_expect_success 'only enabled filters are available remotely' ' test_expect_success 'only enabled filters are available remotely' '
test_must_fail git archive --remote=. --format=tar.foo HEAD \ test_must_fail git archive --remote=. --format=tar.foo HEAD \
>remote.tar.foo && >remote.tar.foo &&
git archive --remote=. --format=bar >remote.bar HEAD && git archive --remote=. --format=bar >remote.bar HEAD &&
test_cmp remote.bar config.bar test_cmp_bin remote.bar config.bar
' '
test_expect_success GZIP 'git archive --format=tgz' ' test_expect_success GZIP 'git archive --format=tgz' '
@ -280,27 +280,27 @@ test_expect_success GZIP 'git archive --format=tgz' '
test_expect_success GZIP 'git archive --format=tar.gz' ' test_expect_success GZIP 'git archive --format=tar.gz' '
git archive --format=tar.gz HEAD >j1.tar.gz && git archive --format=tar.gz HEAD >j1.tar.gz &&
test_cmp j.tgz j1.tar.gz test_cmp_bin j.tgz j1.tar.gz
' '
test_expect_success GZIP 'infer tgz from .tgz filename' ' test_expect_success GZIP 'infer tgz from .tgz filename' '
git archive --output=j2.tgz HEAD && git archive --output=j2.tgz HEAD &&
test_cmp j.tgz j2.tgz test_cmp_bin j.tgz j2.tgz
' '
test_expect_success GZIP 'infer tgz from .tar.gz filename' ' test_expect_success GZIP 'infer tgz from .tar.gz filename' '
git archive --output=j3.tar.gz HEAD && git archive --output=j3.tar.gz HEAD &&
test_cmp j.tgz j3.tar.gz test_cmp_bin j.tgz j3.tar.gz
' '
test_expect_success GZIP 'extract tgz file' ' test_expect_success GZIP 'extract tgz file' '
gzip -d -c <j.tgz >j.tar && gzip -d -c <j.tgz >j.tar &&
test_cmp b.tar j.tar test_cmp_bin b.tar j.tar
' '
test_expect_success GZIP 'remote tar.gz is allowed by default' ' test_expect_success GZIP 'remote tar.gz is allowed by default' '
git archive --remote=. --format=tar.gz HEAD >remote.tar.gz && git archive --remote=. --format=tar.gz HEAD >remote.tar.gz &&
test_cmp j.tgz remote.tar.gz test_cmp_bin j.tgz remote.tar.gz
' '
test_expect_success GZIP 'remote tar.gz can be disabled' ' test_expect_success GZIP 'remote tar.gz can be disabled' '

View File

@ -68,7 +68,7 @@ test_expect_missing worktree2/ignored-by-worktree
test_expect_success 'git archive vs. bare' ' test_expect_success 'git archive vs. bare' '
(cd bare && git archive HEAD) >bare-archive.tar && (cd bare && git archive HEAD) >bare-archive.tar &&
test_cmp archive.tar bare-archive.tar test_cmp_bin archive.tar bare-archive.tar
' '
test_expect_success 'git archive with worktree attributes, bare' ' test_expect_success 'git archive with worktree attributes, bare' '

View File

@ -97,15 +97,15 @@ test_expect_success \
test_expect_success \ test_expect_success \
'git archive --format=zip vs. the same in a bare repo' \ 'git archive --format=zip vs. the same in a bare repo' \
'test_cmp d.zip d1.zip' 'test_cmp_bin d.zip d1.zip'
test_expect_success 'git archive --format=zip with --output' \ test_expect_success 'git archive --format=zip with --output' \
'git archive --format=zip --output=d2.zip HEAD && 'git archive --format=zip --output=d2.zip HEAD &&
test_cmp d.zip d2.zip' test_cmp_bin d.zip d2.zip'
test_expect_success 'git archive with --output, inferring format' ' test_expect_success 'git archive with --output, inferring format' '
git archive --output=d3.zip HEAD && git archive --output=d3.zip HEAD &&
test_cmp d.zip d3.zip test_cmp_bin d.zip d3.zip
' '
test_expect_success \ test_expect_success \

View File

@ -45,7 +45,7 @@ test_expect_success HEADER_ONLY_TAR_OK 'tar archive of commit with empty tree' '
test_expect_success 'tar archive of empty tree is empty' ' test_expect_success 'tar archive of empty tree is empty' '
git archive --format=tar HEAD: >empty.tar && git archive --format=tar HEAD: >empty.tar &&
perl -e "print \"\\0\" x 10240" >10knuls.tar && perl -e "print \"\\0\" x 10240" >10knuls.tar &&
test_cmp 10knuls.tar empty.tar test_cmp_bin 10knuls.tar empty.tar
' '
test_expect_success 'tar archive of empty tree with prefix' ' test_expect_success 'tar archive of empty tree with prefix' '

View File

@ -229,7 +229,7 @@ test_expect_success 'pull request format' '
cd local && cd local &&
git request-pull initial "$downstream_url" full git request-pull initial "$downstream_url" full
) >request && ) >request &&
grep ' tags/full$' grep " tags/full\$" request
' '
test_expect_success 'request-pull ignores OPTIONS_KEEPDASHDASH poison' ' test_expect_success 'request-pull ignores OPTIONS_KEEPDASHDASH poison' '

View File

@ -5,7 +5,11 @@ test_description='test git-http-backend-noserver'
HTTPD_DOCUMENT_ROOT_PATH="$TRASH_DIRECTORY" HTTPD_DOCUMENT_ROOT_PATH="$TRASH_DIRECTORY"
test_have_prereq GREP_STRIPS_CR && export GREP_OPTIONS=-U if test_have_prereq GREP_STRIPS_CR
then
GREP_OPTIONS=-U
export GREP_OPTIONS
fi
run_backend() { run_backend() {
echo "$2" | echo "$2" |

View File

@ -308,6 +308,17 @@ test_expect_success 'Prune empty commits' '
test_cmp expect actual test_cmp expect actual
' '
test_expect_success 'prune empty collapsed merges' '
test_config merge.ff false &&
git rev-list HEAD >expect &&
test_commit to_remove_2 &&
git reset --hard HEAD^ &&
test_merge non-ff to_remove_2 &&
git filter-branch -f --index-filter "git update-index --remove to_remove_2.t" --prune-empty HEAD &&
git rev-list HEAD >actual &&
test_cmp expect actual
'
test_expect_success '--remap-to-ancestor with filename filters' ' test_expect_success '--remap-to-ancestor with filename filters' '
git checkout master && git checkout master &&
git reset --hard A && git reset --hard A &&

View File

@ -1096,11 +1096,6 @@ test_expect_success 'grep -E pattern with grep.patternType=fixed' '
test_cmp expected actual test_cmp expected actual
' '
test_config() {
git config "$1" "$2" &&
test_when_finished "git config --unset $1"
}
cat >expected <<EOF cat >expected <<EOF
hello.c<RED>:<RESET>int main(int argc, const char **argv) hello.c<RED>:<RESET>int main(int argc, const char **argv)
hello.c<RED>-<RESET>{ hello.c<RED>-<RESET>{

View File

@ -617,6 +617,12 @@ test_cmp() {
$GIT_TEST_CMP "$@" $GIT_TEST_CMP "$@"
} }
# test_cmp_bin - helper to compare binary files
test_cmp_bin() {
cmp "$@"
}
# Check if the file expected to be empty is indeed empty, and barfs # Check if the file expected to be empty is indeed empty, and barfs
# otherwise. # otherwise.

View File

@ -1026,7 +1026,7 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
int transport_helper_init(struct transport *transport, const char *name) int transport_helper_init(struct transport *transport, const char *name)
{ {
struct helper_data *data = xcalloc(sizeof(*data), 1); struct helper_data *data = xcalloc(1, sizeof(*data));
data->name = name; data->name = name;
if (getenv("GIT_TRANSPORT_HELPER_DEBUG")) if (getenv("GIT_TRANSPORT_HELPER_DEBUG"))