git.git
11 years agodo not write null sha1s to on-disk index
Jeff King [Sat, 28 Jul 2012 15:05:24 +0000 (11:05 -0400)]
do not write null sha1s to on-disk index

We should never need to write the null sha1 into an index
entry (short of the 1 in 2^160 chance that somebody actually
has content that hashes to it). If we attempt to do so, it
is much more likely that it is a bug, since we use the null
sha1 as a sentinel value to mean "not valid".

The presence of null sha1s in the index (which can come
from, among other things, "update-index --cacheinfo", or by
reading a corrupted tree) can cause problems for later
readers, because they cannot distinguish the literal null
sha1 from its use a sentinel value.  For example, "git
diff-files" on such an entry would make it appear as if it
is stat-dirty, and until recently, the diff code assumed
such an entry meant that we should be diffing a working tree
file rather than a blob.

Ideally, we would stop such entries from entering even our
in-core index. However, we do sometimes legitimately add
entries with null sha1s in order to represent these sentinel
situations; simply forbidding them in add_index_entry breaks
a lot of the existing code. However, we can at least make
sure that our in-core sentinel representation never makes it
to disk.

To be thorough, we will test an attempt to add both a blob
and a submodule entry. In the former case, we might run into
problems anyway because we will be missing the blob object.
But in the latter case, we do not enforce connectivity
across gitlink entries, making this our only point of
enforcement. The current implementation does not care which
type of entry we are seeing, but testing both cases helps
future-proof the test suite in case that changes.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodiff: do not use null sha1 as a sentinel value
Jeff King [Sat, 28 Jul 2012 15:03:01 +0000 (11:03 -0400)]
diff: do not use null sha1 as a sentinel value

The diff code represents paths using the diff_filespec
struct. This struct has a sha1 to represent the sha1 of the
content at that path, as well as a sha1_valid member which
indicates whether its sha1 field is actually useful. If
sha1_valid is not true, then the filespec represents a
working tree file (e.g., for the no-index case, or for when
the index is not up-to-date).

The diff_filespec is only used internally, though. At the
interfaces to the diff subsystem, callers feed the sha1
directly, and we create a diff_filespec from it. It's at
that point that we look at the sha1 and decide whether it is
valid or not; callers may pass the null sha1 as a sentinel
value to indicate that it is not.

We should not typically see the null sha1 coming from any
other source (e.g., in the index itself, or from a tree).
However, a corrupt tree might have a null sha1, which would
cause "diff --patch" to accidentally diff the working tree
version of a file instead of treating it as a blob.

This patch extends the edges of the diff interface to accept
a "sha1_valid" flag whenever we accept a sha1, and to use
that flag when creating a filespec. In some cases, this
means passing the flag through several layers, making the
code change larger than would be desirable.

One alternative would be to simply die() upon seeing
corrupted trees with null sha1s. However, this fix more
directly addresses the problem (while bogus sha1s in a tree
are probably a bad thing, it is really the sentinel
confusion sending us down the wrong code path that is what
makes it devastating). And it means that git is more capable
of examining and debugging these corrupted trees. For
example, you can still "diff --raw" such a tree to find out
when the bogus entry was introduced; you just cannot do a
"--patch" diff (just as you could not with any other
corrupted tree, as we do not have any content to diff).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.9.7 v1.7.9.7
Junio C Hamano [Thu, 26 Apr 2012 17:23:15 +0000 (10:23 -0700)]
Git 1.7.9.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoSync with 1.7.8.6
Junio C Hamano [Thu, 26 Apr 2012 17:22:20 +0000 (10:22 -0700)]
Sync with 1.7.8.6

12 years agoGit 1.7.8.6 v1.7.8.6
Junio C Hamano [Thu, 26 Apr 2012 16:59:22 +0000 (09:59 -0700)]
Git 1.7.8.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoSync with 1.7.7.7
Junio C Hamano [Thu, 26 Apr 2012 16:52:33 +0000 (09:52 -0700)]
Sync with 1.7.7.7

12 years agoGit 1.7.7.7 v1.7.7.7
Junio C Hamano [Thu, 26 Apr 2012 16:41:52 +0000 (09:41 -0700)]
Git 1.7.7.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agobundle: remove stray single-quote from error message
Jonathan Nieder [Thu, 26 Apr 2012 05:53:59 +0000 (00:53 -0500)]
bundle: remove stray single-quote from error message

After running rev-list --boundary to retrieve the list of boundary
commits, "git bundle create" runs its own revision walk.  If in this
stage git encounters an unfamiliar option, it writes a message with an
unbalanced quotation mark:

error: unrecognized argument: --foo'

Drop the stray quote to match the "unrecognized argument: %s" message
used elsewhere and save translators some work.

This is mostly a futureproofing measure: for now, the "rev-list
--boundary" command catches most strange arguments on its own and the
above message is not seen unless you try something esoteric like "git
bundle create test.bundle --header HEAD".

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint-1.7.8' into maint-1.7.9
Junio C Hamano [Tue, 10 Apr 2012 19:44:45 +0000 (12:44 -0700)]
Merge branch 'maint-1.7.8' into maint-1.7.9

* maint-1.7.8:
  Documentation/gitweb: trivial English fixes
  fetch/receive: remove over-pessimistic connectivity check

12 years agoMerge branch 'jc/maint-verify-objects-remove-pessimism' into maint-1.7.8
Junio C Hamano [Mon, 9 Apr 2012 20:43:16 +0000 (13:43 -0700)]
Merge branch 'jc/maint-verify-objects-remove-pessimism' into maint-1.7.8

* jc/maint-verify-objects-remove-pessimism:
  fetch/receive: remove over-pessimistic connectivity check

12 years agoMerge branch 'dw/gitweb-doc-grammo' into maint-1.7.8
Junio C Hamano [Mon, 9 Apr 2012 20:42:56 +0000 (13:42 -0700)]
Merge branch 'dw/gitweb-doc-grammo' into maint-1.7.8

* dw/gitweb-doc-grammo:
  Documentation/gitweb: trivial English fixes

12 years agoMerge branch 'tr/cache-tree' into maint-1.7.8
Junio C Hamano [Mon, 9 Apr 2012 20:40:32 +0000 (13:40 -0700)]
Merge branch 'tr/cache-tree' into maint-1.7.8

* tr/cache-tree:
  t0090: be prepared that 'wc -l' writes leading blanks
  reset: update cache-tree data when appropriate
  commit: write cache-tree data when writing index anyway
  Refactor cache_tree_update idiom from commit
  Test the current state of the cache-tree optimization
  Add test-scrap-cache-tree

12 years agoMerge branch 'cb/maint-t5541-make-server-port-portable' into maint-1.7.8
Junio C Hamano [Mon, 9 Apr 2012 20:38:41 +0000 (13:38 -0700)]
Merge branch 'cb/maint-t5541-make-server-port-portable' into maint-1.7.8

* cb/maint-t5541-make-server-port-portable:
  t5541: check error message against the real port number used
  remote-curl: Fix push status report when all branches fail

12 years agoMerge branch 'cn/maint-rev-list-doc' into maint-1.7.8
Junio C Hamano [Mon, 9 Apr 2012 20:36:44 +0000 (13:36 -0700)]
Merge branch 'cn/maint-rev-list-doc' into maint-1.7.8

* cn/maint-rev-list-doc:
  Documentation: use {asterisk} in rev-list-options.txt when needed

12 years agoMerge branch 'tr/maint-bundle-boundary' into maint-1.7.8
Junio C Hamano [Mon, 9 Apr 2012 20:36:26 +0000 (13:36 -0700)]
Merge branch 'tr/maint-bundle-boundary' into maint-1.7.8

* tr/maint-bundle-boundary:
  bundle: keep around names passed to add_pending_object()
  t5510: ensure we stay in the toplevel test dir
  t5510: refactor bundle->pack conversion

12 years agoMerge branch 'tr/maint-bundle-long-subject' into maint-1.7.8
Junio C Hamano [Mon, 9 Apr 2012 20:36:20 +0000 (13:36 -0700)]
Merge branch 'tr/maint-bundle-long-subject' into maint-1.7.8

* tr/maint-bundle-long-subject:
  t5704: match tests to modern style
  strbuf: improve strbuf_get*line documentation
  bundle: use a strbuf to scan the log for boundary commits
  bundle: put strbuf_readline_fd in strbuf.c with adjustments

12 years agoMerge branch 'ph/rerere-doc' into maint-1.7.8
Junio C Hamano [Mon, 9 Apr 2012 20:34:09 +0000 (13:34 -0700)]
Merge branch 'ph/rerere-doc' into maint-1.7.8

* ph/rerere-doc:
  rerere: Document 'rerere remaining'

12 years agoGit 1.7.9.6 v1.7.9.6
Junio C Hamano [Mon, 2 Apr 2012 20:07:58 +0000 (13:07 -0700)]
Git 1.7.9.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/maint-merge-autoedit' into maint
Junio C Hamano [Mon, 2 Apr 2012 19:56:35 +0000 (12:56 -0700)]
Merge branch 'jc/maint-merge-autoedit' into maint

* jc/maint-merge-autoedit:
  merge: backport GIT_MERGE_AUTOEDIT support

12 years agostring-list: document that string_list_insert() inserts unique strings
Heiko Voigt [Thu, 29 Mar 2012 07:21:22 +0000 (09:21 +0200)]
string-list: document that string_list_insert() inserts unique strings

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.9.5 v1.7.9.5
Junio C Hamano [Mon, 26 Mar 2012 19:23:34 +0000 (12:23 -0700)]
Git 1.7.9.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jn/maint-fast-import-empty-ls' into maint
Junio C Hamano [Mon, 26 Mar 2012 19:10:25 +0000 (12:10 -0700)]
Merge branch 'jn/maint-fast-import-empty-ls' into maint

* jn/maint-fast-import-empty-ls:
  fast-import: don't allow 'ls' of path with empty components
  fast-import: leakfix for 'ls' of dirty trees

12 years agoMerge branch 'ph/rerere-doc' into maint
Junio C Hamano [Mon, 26 Mar 2012 19:10:12 +0000 (12:10 -0700)]
Merge branch 'ph/rerere-doc' into maint

* ph/rerere-doc:
  rerere: Document 'rerere remaining'

12 years agoMerge branch 'ms/maint-config-error-at-eol-linecount' into maint
Junio C Hamano [Mon, 26 Mar 2012 19:10:05 +0000 (12:10 -0700)]
Merge branch 'ms/maint-config-error-at-eol-linecount' into maint

* ms/maint-config-error-at-eol-linecount:
  config: report errors at the EOL with correct line number

12 years agogrep doc: add --break / --heading / -W to synopsis
Mark Lodato [Mon, 26 Mar 2012 02:41:42 +0000 (22:41 -0400)]
grep doc: add --break / --heading / -W to synopsis

All of the other options were included in the synopsis, so it makes
sense to include these as well.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: improve description of GIT_EDITOR and preference order
Rodrigo Silva (MestreLion) [Fri, 23 Mar 2012 12:38:42 +0000 (12:38 +0000)]
Documentation: improve description of GIT_EDITOR and preference order

Previously GIT_EDITOR was not listed in git(1) "Environment Variables" section,
which could be very confusing to users. Include it in "other" subsection along
with a link to git-var(1), since that is the page that fully describes all
places where editor can be set and also their preference order.

Also, git-var(1) did not say that hardcoded fallback 'vi' may have been changed
at build time. A user could be puzzled if 'nano' pops up even when none of the
mentioned environment vars or config.editor are set. Clarify this.

Ideally, the build system should be changed to reflect the chosen fallback
editor when creating the man pages. Not sure if that is even possible though.

Signed-off-by: Rodrigo Silva (MestreLion) <linux@rodrigosilva.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodocumentation: fix alphabetic ordered list for git-rebase man page
Nelson Benitez Leon [Fri, 23 Mar 2012 11:31:39 +0000 (12:31 +0100)]
documentation: fix alphabetic ordered list for git-rebase man page

An alphabetic ordered list (a.) is converted to numerical in
the man page (1.) so context comments naming 'a' were confusing,
fix that by not using ordered list notation for 'a' anb 'b' items.

Signed-off-by: Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation/gitweb: trivial English fixes
D Waitzman [Fri, 23 Mar 2012 15:02:43 +0000 (11:02 -0400)]
Documentation/gitweb: trivial English fixes

Change "it's" to "its" where a possessive is intended.  Also add two
missing "the" that were noticed by Ben Walton.

Signed-off-by: David Waitzman <djw@bbn.com>
12 years agoMerge branch 'maint-1.7.8' into maint
Junio C Hamano [Tue, 20 Mar 2012 22:53:30 +0000 (15:53 -0700)]
Merge branch 'maint-1.7.8' into maint

* maint-1.7.8:
  t/Makefile: Use $(sort ...) explicitly where needed
  gitweb: Fix actionless dispatch for non-existent objects
  i18n of multi-line advice messages

12 years agomerge: backport GIT_MERGE_AUTOEDIT support
Junio C Hamano [Tue, 20 Mar 2012 22:39:10 +0000 (15:39 -0700)]
merge: backport GIT_MERGE_AUTOEDIT support

Even though 1.7.9.x series does not open the editor by default
when merging in general, it does do so in one occassion: when
merging an annotated tag. And worse yet, there is no good way
for older scripts to decline this.

Backport the support for GIT_MERGE_AUTOEDIT environment variable
from 1.7.10 track to help those stuck on 1.7.9.x maintenance
track.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'ks/sort-wildcard-in-makefile' into maint-1.7.8
Junio C Hamano [Tue, 20 Mar 2012 22:26:19 +0000 (15:26 -0700)]
Merge branch 'ks/sort-wildcard-in-makefile' into maint-1.7.8

* ks/sort-wildcard-in-makefile:
  t/Makefile: Use $(sort ...) explicitly where needed

12 years agoMerge branch 'jc/advise-i18n' into maint-1.7.8
Junio C Hamano [Tue, 20 Mar 2012 22:25:38 +0000 (15:25 -0700)]
Merge branch 'jc/advise-i18n' into maint-1.7.8

* jc/advise-i18n:
  i18n of multi-line advice messages

12 years agoMerge branch 'jn/gitweb-unspecified-action' into maint-1.7.8
Junio C Hamano [Tue, 20 Mar 2012 22:24:23 +0000 (15:24 -0700)]
Merge branch 'jn/gitweb-unspecified-action' into maint-1.7.8

* jn/gitweb-unspecified-action:
  gitweb: Fix actionless dispatch for non-existent objects

12 years agofetch/receive: remove over-pessimistic connectivity check
Junio C Hamano [Thu, 15 Mar 2012 21:57:02 +0000 (14:57 -0700)]
fetch/receive: remove over-pessimistic connectivity check

Git 1.7.8 introduced an object and history re-validation step after
"fetch" or "push" causes new history to be added to a receiving
repository. This is to protect a malicious server or pushing client from
corrupting the repository by taking advantage of an existing corrupt
object that is unconnected to existing history.

But this check is way over-pessimistic.  During "fetch" or "receive-pack"
(the server side of "push"), unpack-objects and index-pack already
validate individual objects that are received, and the only thing we would
want to catch are corrupted objects that already happen to exist in our
repository but are not referenced from our refs.  Such objects must have
been written by an earlier run of our codepaths that write out loose
objects or packfiles, and they must have done the validation of individual
objects when they did so.  The only thing left to worry about is the
connectivity integrity, which can be checked with "rev-list --objects",
which is much cheaper.  We have been paying the 5x to 8x runtime overhead
the --verify-objects often adds for no real gain.

Revert check_everything_connected() not to use this over-pessimistic
check.

Credit goes to Nguyễn Thái Ngọc Duy, who originally identified the
performance regression and endured multiple rounds of reviews to fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.9.4 v1.7.9.4
Junio C Hamano [Mon, 12 Mar 2012 22:52:52 +0000 (15:52 -0700)]
Git 1.7.9.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'tr/maint-bundle-boundary' into maint
Junio C Hamano [Mon, 12 Mar 2012 22:46:53 +0000 (15:46 -0700)]
Merge branch 'tr/maint-bundle-boundary' into maint

"git bundle" did not record boundary commits correctly when there
are many of them.

By Thomas Rast
* tr/maint-bundle-boundary:
  bundle: keep around names passed to add_pending_object()
  t5510: ensure we stay in the toplevel test dir
  t5510: refactor bundle->pack conversion

12 years agoMerge branch 'jc/maint-diff-patch-header' into maint
Junio C Hamano [Mon, 12 Mar 2012 22:46:32 +0000 (15:46 -0700)]
Merge branch 'jc/maint-diff-patch-header' into maint

"git diff-index" and its friends at the plumbing level showed the
"diff --git" header and nothing else for a path whose cached stat
info is dirty without actual difference when asked to produce a
patch. This was a longstanding bug that we could have fixed long
time ago.

By Junio C Hamano
* jc/maint-diff-patch-header:
  diff -p: squelch "diff --git" header for stat-dirty paths
  t4011: illustrate "diff-index -p" on stat-dirty paths
  t4011: modernise style

12 years agoMerge branch 'jn/maint-do-not-match-with-unsanitized-searchtext' into maint
Junio C Hamano [Mon, 12 Mar 2012 22:45:57 +0000 (15:45 -0700)]
Merge branch 'jn/maint-do-not-match-with-unsanitized-searchtext' into maint

"gitweb" did use quotemeta() to prepare search string when asked to
do a fixed-string project search, but did not use it by mistake and
used the user-supplied string instead.

By Jakub Narebski
* jn/maint-do-not-match-with-unsanitized-searchtext:
  gitweb: Fix fixed string (non-regexp) project search

12 years agoMerge branch 'jc/am-3-nonstandard-popt' into maint
Junio C Hamano [Mon, 12 Mar 2012 22:43:06 +0000 (15:43 -0700)]
Merge branch 'jc/am-3-nonstandard-popt' into maint

The code to synthesize the fake ancestor tree used by 3-way merge
fallback in "git am" was not prepared to read a patch created with
a non-standard -p<num> value.

* jc/am-3-nonstandard-popt:
  test: "am -3" can accept non-standard -p<num>
  am -3: allow nonstandard -p<num> option

12 years agoconfig: report errors at the EOL with correct line number
Martin Stenberg [Fri, 9 Mar 2012 21:57:54 +0000 (22:57 +0100)]
config: report errors at the EOL with correct line number

A section in a config file with a missing "]" reports the next line
as bad, same goes to a value with a missing end quote.

This happens because the error is not detected until the end of the
line, when line number is already increased. Fix this by decreasing
line number by one for these cases.

Signed-off-by: Martin Stenberg <martin@gnutiken.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agofast-import: don't allow 'ls' of path with empty components
Jonathan Nieder [Sat, 10 Mar 2012 04:07:22 +0000 (22:07 -0600)]
fast-import: don't allow 'ls' of path with empty components

As the fast-import manual explains:

The value of <path> must be in canonical form. That is it must
not:
. contain an empty directory component (e.g. foo//bar is invalid),
. end with a directory separator (e.g. foo/ is invalid),
. start with a directory separator (e.g. /foo is invalid),

Unfortunately the "ls" command accepts these invalid syntaxes and
responds by declaring that the indicated path is missing.  This is too
subtle and causes importers to silently misbehave; better to error out
so the operator knows what's happening.

The C, R, and M commands already error out for such paths.

Reported-by: Andrew Sayers <andrew-git@pileofstuff.org>
Analysis-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agofast-import: leakfix for 'ls' of dirty trees
Jonathan Nieder [Sat, 10 Mar 2012 03:20:34 +0000 (21:20 -0600)]
fast-import: leakfix for 'ls' of dirty trees

When the chosen directory has changed since it was last written to
pack, "tree_content_get" makes a deep copy of its content to scribble
on while computing the tree name, which we forgot to free.

This leak has been present since the 'ls' command was introduced in
v1.7.5-rc0~3^2~33 (fast-import: add 'ls' command, 2010-12-02).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agorerere: Document 'rerere remaining'
Phil Hord [Thu, 8 Mar 2012 21:08:50 +0000 (16:08 -0500)]
rerere: Document 'rerere remaining'

This adds the 'remaining' command to the documentation of
'git rerere'. This command was added in ac49f5ca (Feb 16 2011;
Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>) but
it was never documented.

Touch up the other rerere commands to reduce noise.

First noticed by Vincent van Ravesteijn.

Signed-off-by: Phil Hord <phil.hord@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogitweb: Fix fixed string (non-regexp) project search
Jakub Narebski [Fri, 2 Mar 2012 22:34:24 +0000 (23:34 +0100)]
gitweb: Fix fixed string (non-regexp) project search

Use $search_regexp, where regex metacharacters are quoted, for
searching projects list, rather than $searchtext, which contains
original search term.

Reported-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot5704: fix nonportable sed/grep usages
Thomas Rast [Tue, 6 Mar 2012 14:50:37 +0000 (15:50 +0100)]
t5704: fix nonportable sed/grep usages

OS X's sed and grep would complain with (respectively)

  sed: 1: "/^-/{p;q}": extra characters at the end of q command
  grep: Regular expression too big

For sed, use an explicit ; to terminate the q command.

For grep, spell the "40 hex digits" explicitly in the regex, which
should be safe as other tests already use this and we haven't got
breakage reports on OS X about them.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint-1.7.8' into maint
Junio C Hamano [Tue, 6 Mar 2012 20:05:09 +0000 (12:05 -0800)]
Merge branch 'maint-1.7.8' into maint

By Thomas Rast
* maint-1.7.8:
  Document the --histogram diff option

12 years agoMerge branch 'maint-1.7.7' into maint-1.7.8
Junio C Hamano [Tue, 6 Mar 2012 20:04:48 +0000 (12:04 -0800)]
Merge branch 'maint-1.7.7' into maint-1.7.8

By Thomas Rast
* maint-1.7.7:
  Document the --histogram diff option

12 years agoDocument the --histogram diff option
Thomas Rast [Tue, 6 Mar 2012 13:15:02 +0000 (14:15 +0100)]
Document the --histogram diff option

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.9.3 v1.7.9.3
Junio C Hamano [Mon, 5 Mar 2012 22:29:07 +0000 (14:29 -0800)]
Git 1.7.9.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/doc-merge-options' into maint
Junio C Hamano [Mon, 5 Mar 2012 22:28:14 +0000 (14:28 -0800)]
Merge branch 'jc/doc-merge-options' into maint

* jc/doc-merge-options:
  Documentation/merge-options.txt: group "ff" related options together

12 years agoMerge branch 'cn/maint-rev-list-doc' into maint
Junio C Hamano [Mon, 5 Mar 2012 22:27:36 +0000 (14:27 -0800)]
Merge branch 'cn/maint-rev-list-doc' into maint

* cn/maint-rev-list-doc:
  Documentation: use {asterisk} in rev-list-options.txt when needed

12 years agofast-import: zero all of 'struct tag' to silence valgrind
Thomas Rast [Mon, 5 Mar 2012 13:48:49 +0000 (14:48 +0100)]
fast-import: zero all of 'struct tag' to silence valgrind

When running t9300, valgrind (correctly) complains about an
uninitialized value in write_crash_report:

  ==2971== Use of uninitialised value of size 8
  ==2971==    at 0x4164F4: sha1_to_hex (hex.c:70)
  ==2971==    by 0x4073E4: die_nicely (fast-import.c:468)
  ==2971==    by 0x43284C: die (usage.c:86)
  ==2971==    by 0x40420D: main (fast-import.c:2731)
  ==2971==  Uninitialised value was created by a heap allocation
  ==2971==    at 0x4C29B3D: malloc (vg_replace_malloc.c:263)
  ==2971==    by 0x433645: xmalloc (wrapper.c:35)
  ==2971==    by 0x405DF5: pool_alloc (fast-import.c:619)
  ==2971==    by 0x407755: pool_calloc.constprop.14 (fast-import.c:634)
  ==2971==    by 0x403F33: main (fast-import.c:3324)

Fix this by zeroing all of the 'struct tag'.  We would only need to
zero out the 'sha1' field, but this way seems more future-proof.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUpdate draft release notes to 1.7.9.3 for the last time
Junio C Hamano [Mon, 5 Mar 2012 06:21:30 +0000 (22:21 -0800)]
Update draft release notes to 1.7.9.3 for the last time

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'cn/maint-branch-with-bad' into maint
Junio C Hamano [Mon, 5 Mar 2012 06:17:52 +0000 (22:17 -0800)]
Merge branch 'cn/maint-branch-with-bad' into maint

* cn/maint-branch-with-bad:
  branch: don't assume the merge filter ref exists

Conflicts:
t/t3200-branch.sh

12 years agoMerge branch 'jn/maint-gitweb-invalid-regexp' into maint
Junio C Hamano [Mon, 5 Mar 2012 06:17:47 +0000 (22:17 -0800)]
Merge branch 'jn/maint-gitweb-invalid-regexp' into maint

* jn/maint-gitweb-invalid-regexp:
  gitweb: Handle invalid regexp in regexp search

12 years agoMerge branch 'nd/maint-verify-objects' into maint
Junio C Hamano [Mon, 5 Mar 2012 06:17:41 +0000 (22:17 -0800)]
Merge branch 'nd/maint-verify-objects' into maint

* nd/maint-verify-objects:
  rev-list: fix --verify-objects --quiet becoming --objects
  rev-list: remove BISECT_SHOW_TRIED flag

12 years agoMerge branch 'jk/maint-avoid-streaming-filtered-contents' into maint
Junio C Hamano [Mon, 5 Mar 2012 06:16:40 +0000 (22:16 -0800)]
Merge branch 'jk/maint-avoid-streaming-filtered-contents' into maint

* jk/maint-avoid-streaming-filtered-contents:
  do not stream large files to pack when filters are in use
  teach dry-run convert_to_git not to require a src buffer
  teach convert_to_git a "dry run" mode

12 years agoMerge branch 'jb/filter-ignore-sigpipe' into maint
Junio C Hamano [Mon, 5 Mar 2012 06:16:35 +0000 (22:16 -0800)]
Merge branch 'jb/filter-ignore-sigpipe' into maint

* jb/filter-ignore-sigpipe:
  Ignore SIGPIPE when running a filter driver

12 years agoMerge branch 'sp/smart-http-failure-to-push' into maint
Junio C Hamano [Mon, 5 Mar 2012 06:16:33 +0000 (22:16 -0800)]
Merge branch 'sp/smart-http-failure-to-push' into maint

* sp/smart-http-failure-to-push:
  : Mask SIGPIPE on the command channel going to a transport helper
  disconnect from remote helpers more gently

Conflicts:
transport-helper.c

12 years agoMerge branch 'tr/maint-bundle-long-subject' into maint
Junio C Hamano [Mon, 5 Mar 2012 06:16:30 +0000 (22:16 -0800)]
Merge branch 'tr/maint-bundle-long-subject' into maint

* tr/maint-bundle-long-subject:
  t5704: match tests to modern style
  strbuf: improve strbuf_get*line documentation
  bundle: use a strbuf to scan the log for boundary commits
  bundle: put strbuf_readline_fd in strbuf.c with adjustments

12 years agohttp.proxy: also mention https_proxy and all_proxy
Clemens Buchacher [Sun, 4 Mar 2012 16:50:43 +0000 (17:50 +0100)]
http.proxy: also mention https_proxy and all_proxy

The current wording of the http.proxy documentation suggests that
http_proxy is somehow equivalent to http.proxy. However, while
http.proxy (by the means of curl's CURLOPT_PROXY option) overrides the
proxy for both HTTP and HTTPS protocols, the http_proxy environment
variable is used only for HTTP. But since the docs mention only
http_proxy, a user might expect it to apply to all HTTP-like protocols.

Avoid any such misunderstanding by explicitly mentioning https_proxy and
all_proxy as well.

Also replace linkgit:curl[1] with a literal 'curl(1)', because the
former gets translated to a dead link in the HTML pages.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot0300: work around bug in dash 0.5.6
Michael J Gruber [Sat, 3 Mar 2012 00:37:35 +0000 (19:37 -0500)]
t0300: work around bug in dash 0.5.6

The construct 'while IFS== read' makes dash 0.5.6 execute
read without changing IFS, which results in test breakages
all over the place in t0300.  Neither dash 0.5.5.1 and older
nor dash 0.5.7 and newer are affected: The problem was
introduded resp. fixed by the commits

  55c46b7 ([BUILTIN] Honor tab as IFS whitespace when
           splitting fields in readcmd, 2009-08-11)

  1d806ac ([VAR] Do not poplocalvars prematurely on regular
           utilities, 2010-05-27)

in http://git.kernel.org/?p=utils/dash/dash.git

Putting 'IFS==' before that line makes all versions of dash
work.

This looks like a dash bug, not a misinterpretation of the
standard. However, it's worth working around for two
reasons. One, this version of dash was released in Fedora
14-16, so the bug is found in the wild. And two, at least
one other shell, Solaris /bin/sh, choked on this by
persisting IFS after the read invocation. That is not a
shell we usually care about, and I think this use of IFS is
acceptable by POSIX (which allows other behavior near
"special builtins", but "read" is not one of those). But it
seems that this may be a subtle, not-well-tested case for
some shells. Given that the workaround is so simple, it's
worth just being defensive.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot5512 (ls-remote): modernize style
Tom Grennan [Sat, 3 Mar 2012 02:15:34 +0000 (18:15 -0800)]
t5512 (ls-remote): modernize style

Prepare expected output inside test_expect_success that uses it.
Also remove excess blank lines.

Signed-off-by: Tom Grennan <tmgrennan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agotests: fix spurious error when run directly with Solaris /usr/xpg4/bin/sh
Stefano Lattarini [Fri, 2 Mar 2012 18:48:36 +0000 (19:48 +0100)]
tests: fix spurious error when run directly with Solaris /usr/xpg4/bin/sh

If any test script is run directly with Solaris 10 /usr/xpg4/bin/sh or
/bin/ksh, it fails spuriously with a message like:

  t0000-basic.sh[31]: unset: bad argument count

This happens because those shells bail out when encountering a call to
"unset" with no arguments, and such unset call could take place in
'test-lib.sh'.  Fix that issue, and add a proper comment to ensure we
don't regress in this respect.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: do not assume that n > 1 in <rev>~$n
Junio C Hamano [Wed, 29 Feb 2012 19:13:22 +0000 (11:13 -0800)]
Documentation: do not assume that n > 1 in <rev>~$n

We explained <rev>~<n> as <n>th generation grand-parent, but a reader got
confused by the "grand-" part when <n> is 1.

Reword it with "ancestor"; with the "generation" and "following only the
first parents" around there, what we try to describe should be clear
enough now.

Noticed-by: Luke Diamand <luke@diamand.org>
Helped-by: Thomas Rast <trast@inf.ethz.ch>
Helped-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agobundle: keep around names passed to add_pending_object()
Thomas Rast [Thu, 1 Mar 2012 21:40:51 +0000 (22:40 +0100)]
bundle: keep around names passed to add_pending_object()

The 'name' field passed to add_pending_object() is used to later
deduplicate in object_array_remove_duplicates().

git-bundle had a bug in this area since 18449ab (git-bundle: avoid
packing objects which are in the prerequisites, 2007-03-08): it passed
the name of each boundary object in a static buffer.  In other words,
all that object_array_remove_duplicates() saw was the name of the
*last* added boundary object.

The recent switch to a strbuf in bc2fed4 (bundle: use a strbuf to scan
the log for boundary commits, 2012-02-22) made this slightly worse: we
now free the buffer at the end, so it is not even guaranteed that it
still points into addressable memory by the time object_array_remove_
duplicates looks at it.  On the plus side however, it was now
detectable by valgrind.

The fix is easy: pass a copy of the string to add_pending_object.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot5510: ensure we stay in the toplevel test dir
Thomas Rast [Thu, 1 Mar 2012 21:40:49 +0000 (22:40 +0100)]
t5510: ensure we stay in the toplevel test dir

The last test descended into a subdir without ever re-emerging, which
is not so nice to the next test writer.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot5510: refactor bundle->pack conversion
Thomas Rast [Thu, 1 Mar 2012 21:40:48 +0000 (22:40 +0100)]
t5510: refactor bundle->pack conversion

It's not so much a conversion as a "strip everything up to and
including the first blank line", but it will come in handy again.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodiff -p: squelch "diff --git" header for stat-dirty paths
Junio C Hamano [Thu, 1 Mar 2012 02:14:16 +0000 (18:14 -0800)]
diff -p: squelch "diff --git" header for stat-dirty paths

The plumbing "diff" commands look at the working tree files without
refreshing the index themselves for performance reasons (the calling
script is expected to do that upfront just once, before calling one or
more of them).  In the early days of git, they showed the "diff --git"
header before they actually ask the xdiff machinery to produce patches,
and ended up showing only these headers if the real contents are the same
and the difference they noticed was only because the stat info cached in
the index did not match that of the working tree. It was too late for the
implementation to take the header that it already emitted back.

But 3e97c7c (No diff -b/-w output for all-whitespace changes, 2009-11-19)
introduced necessary logic to keep the meta-information headers in a
strbuf and delay their output until the xdiff machinery noticed actual
changes. This was primarily in order to generate patches that ignore
whitespaces. When operating under "-w" mode, we wouldn't know if the
header is needed until we actually look at the resulting patch, so it was
a sensible thing to do, but we did not realize that the same reasoning
applies to stat-dirty paths.

Later, 296c6bb (diff: fix "git show -C -C" output when renaming a binary
file, 2010-05-26) generalized this machinery and added must_show_header
toggle.  This is turned on when the header must be shown even when there
is no patch to be produced, e.g. only the mode was changed, or the path
was renamed, without changing the contents.  However, when it did so, it
still kept the special case for the "-w" mode, which meant that the
plumbing would keep showing these phantom changes.

This corrects this historical inconsistency by allowing the plumbing to
omit paths that are only stat-dirty from its output in the same way as it
handles whitespace only changes under "-w" option.

The change in the behaviour can be seen in the updated test.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot4011: illustrate "diff-index -p" on stat-dirty paths
Junio C Hamano [Thu, 1 Mar 2012 02:14:15 +0000 (18:14 -0800)]
t4011: illustrate "diff-index -p" on stat-dirty paths

The plumbing that looks at the working tree, i.e. "diff-index" and
"diff-files", always emit the "diff --git a/path b/path" header lines
without anything else for paths that are only stat-dirty (i.e. different
only because the cached stat information in the index no longer matches
that of the working tree, but the real contents are the same), when
these commands are run with "-p" option to produce patches.

Illustrate this current behaviour.  Also demonstrate that with the "-w"
option, we (correctly) hold off showing a "diff --git" header until actual
differences have been found.  This also suppresses the header for merely
stat-dirty files, which is inconsistent.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot4011: modernise style
Junio C Hamano [Thu, 1 Mar 2012 02:14:14 +0000 (18:14 -0800)]
t4011: modernise style

Match the style to more modern test scripts, namely:

 - The first line of each test has prereq, title and opening sq for the
   script body.  This makes the test shorter while reducing the need for
   backslashes.

 - Be prepared for the case in which the previous test may have failed.
   If a test wants to start from not having "frotz" that the previous test
   may have created, write "rm -f frotz", not "rm frotz".

 - Prepare the expected output inside your own test.

 - The order of comparison to check the result is "diff expected actual",
   so that the output will show how the output from the git you just broke
   is different from what is expected.

 - Write no SP between redirection '>' (or '<' for that matter) and the
   filename.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation fixes in git-config
Libor Pechacek [Thu, 1 Mar 2012 10:59:45 +0000 (11:59 +0100)]
Documentation fixes in git-config

Variable names must start with an alphabetic character, regexp config key
matching has its limits, sentence grammar.

Signed-off-by: Libor Pechacek <lpechacek@suse.cz>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: use {asterisk} in rev-list-options.txt when needed
Carlos Martín Nieto [Tue, 28 Feb 2012 15:35:48 +0000 (16:35 +0100)]
Documentation: use {asterisk} in rev-list-options.txt when needed

Text between two '*' is emphasized in AsciiDoc and makes explanations in
rev-list-options.txt on glob-related options very confusing, as the
rendered text would be missing two asterisks and the text between them
would be emphasized instead.

Use '{asterisk}' where needed to make them show up as asterisks in the
rendered text.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogitweb: Handle invalid regexp in regexp search
Jakub Narebski [Tue, 28 Feb 2012 18:41:47 +0000 (19:41 +0100)]
gitweb: Handle invalid regexp in regexp search

When using regexp search ('sr' parameter / $search_use_regexp variable
is true), check first that regexp is valid.

Without this patch we would get an error from Perl during search (if
searching is performed by gitweb), or highlighting matches substring
(if applicable), if user provided invalid regexp... which means broken
HTML, with error page (including HTTP headers) generated after gitweb
already produced some output.

Add test that illustrates such error: for example for regexp "*\.git"
we would get the following error:

  Quantifier follows nothing in regex; marked by <-- HERE in m/* <-- HERE \.git/
  at /var/www/cgi-bin/gitweb.cgi line 3084.

Reported-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorev-list: fix --verify-objects --quiet becoming --objects
Nguyễn Thái Ngọc Duy [Tue, 28 Feb 2012 14:00:00 +0000 (21:00 +0700)]
rev-list: fix --verify-objects --quiet becoming --objects

When --quiet is specified, finish_object() is called instead of
show_object(). The latter is in charge of --verify-objects and
will be skipped  if --quiet is specified.

Move the code up to finish_object(). Also pass the quiet flag along
and make it always call show_* functions to avoid similar problems in
future.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorev-list: remove BISECT_SHOW_TRIED flag
Nguyễn Thái Ngọc Duy [Tue, 28 Feb 2012 13:59:59 +0000 (20:59 +0700)]
rev-list: remove BISECT_SHOW_TRIED flag

Since c99f069 (bisect--helper: remove "--next-vars" option as it is
now useless - 2009-04-21), this flag has always been off. Remove the
flag and all related code.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUpdate draft release notes to 1.7.9.3
Junio C Hamano [Mon, 27 Feb 2012 23:36:08 +0000 (15:36 -0800)]
Update draft release notes to 1.7.9.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'pj/remote-set-branches-usage-fix' into maint
Junio C Hamano [Mon, 27 Feb 2012 23:33:33 +0000 (15:33 -0800)]
Merge branch 'pj/remote-set-branches-usage-fix' into maint

* pj/remote-set-branches-usage-fix:
  remote: fix set-branches usage and documentation

Conflicts:
builtin/remote.c

12 years agoMerge branch 'jn/gitweb-unborn-head' into maint
Junio C Hamano [Mon, 27 Feb 2012 23:33:26 +0000 (15:33 -0800)]
Merge branch 'jn/gitweb-unborn-head' into maint

* jn/gitweb-unborn-head:
  gitweb: Fix "heads" view when there is no current branch

12 years agoMerge branch 'jn/ancient-meld-support' into maint
Junio C Hamano [Mon, 27 Feb 2012 23:33:07 +0000 (15:33 -0800)]
Merge branch 'jn/ancient-meld-support' into maint

* jn/ancient-meld-support:
  mergetools/meld: Use --help output to detect --output support

12 years agoMerge branch 'tr/merge-edit-guidance' into maint
Junio C Hamano [Mon, 27 Feb 2012 23:31:50 +0000 (15:31 -0800)]
Merge branch 'tr/merge-edit-guidance' into maint

* tr/merge-edit-guidance:
  merge: add instructions to the commit message when editing

12 years agoCodingGuidelines: do not use 'which' in shell scripts
Tim Henigan [Fri, 24 Feb 2012 23:12:58 +0000 (18:12 -0500)]
CodingGuidelines: do not use 'which' in shell scripts

During the code review of a recent patch, it was noted that shell scripts
must not use 'which $cmd' to check the availability of the command $cmd.
The output of the command is not machine parseable and its exit code is
not reliable across platforms.

It is better to use 'type' to accomplish this task.

Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoCodingGuidelines: Add a note about spaces after redirection
Tim Henigan [Fri, 24 Feb 2012 23:12:57 +0000 (18:12 -0500)]
CodingGuidelines: Add a note about spaces after redirection

During code review of some patches, it was noted that redirection operators
should have space before, but no space after them.

Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agobranch: don't assume the merge filter ref exists
Carlos Martín Nieto [Mon, 27 Feb 2012 15:11:53 +0000 (16:11 +0100)]
branch: don't assume the merge filter ref exists

print_ref_list looks up the merge_filter_ref and assumes that a valid
pointer is returned. When the object doesn't exist, it tries to
dereference a NULL pointer. This can be the case when git branch
--merged is given an argument that isn't a valid commit name.

Check whether the lookup returns a NULL pointer and die with an error
if it does. Add a test, while we're at it.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agopost-receive-email: match up $LOGBEGIN..$LOGEND pairs correctly
Michael Haggerty [Mon, 27 Feb 2012 18:34:10 +0000 (19:34 +0100)]
post-receive-email: match up $LOGBEGIN..$LOGEND pairs correctly

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agopost-receive-email: remove unused variable
Michael Haggerty [Mon, 27 Feb 2012 18:34:09 +0000 (19:34 +0100)]
post-receive-email: remove unused variable

prep_for_email neither is passed a fourth argument nor uses it.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agotest: "am -3" can accept non-standard -p<num>
Junio C Hamano [Mon, 27 Feb 2012 07:00:47 +0000 (23:00 -0800)]
test: "am -3" can accept non-standard -p<num>

This adds a test for the previous one to make sure that "am -3 -p0" can
read patches created with the --no-prefix option.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocument accumulated fixes since 1.7.9.2
Junio C Hamano [Mon, 27 Feb 2012 01:08:59 +0000 (17:08 -0800)]
Document accumulated fixes since 1.7.9.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/add-refresh-unmerged' into maint
Junio C Hamano [Mon, 27 Feb 2012 01:06:23 +0000 (17:06 -0800)]
Merge branch 'jc/add-refresh-unmerged' into maint

* jc/add-refresh-unmerged:
  refresh_index: do not show unmerged path that is outside pathspec

12 years agoMerge branch 'js/configure-libintl' into maint
Junio C Hamano [Mon, 27 Feb 2012 01:04:53 +0000 (17:04 -0800)]
Merge branch 'js/configure-libintl' into maint

* js/configure-libintl:
  configure: don't use -lintl when there is no gettext support

12 years agoSync with 1.7.8.5
Junio C Hamano [Mon, 27 Feb 2012 00:42:35 +0000 (16:42 -0800)]
Sync with 1.7.8.5

12 years agoGit 1.7.8.5 v1.7.8.5
Junio C Hamano [Mon, 27 Feb 2012 00:40:20 +0000 (16:40 -0800)]
Git 1.7.8.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogrep -P: Fix matching ^ and $
Michał Kiedrowicz [Sat, 25 Feb 2012 09:24:28 +0000 (10:24 +0100)]
grep -P: Fix matching ^ and $

When "git grep" is run with -P/--perl-regexp, it doesn't match ^ and $ at
the beginning/end of the line.  This is because PCRE normally matches ^
and $ at the beginning/end of the whole text, not for each line, and "git
grep" passes a large chunk of text (possibly containing many lines) to
pcre_exec() and then splits the text into lines.

This makes "git grep -P" behave differently from "git grep -E" and also
from "grep -P" and "pcregrep":

$ cat file
a
 b
$ git grep --no-index -P '^ ' file
$ git grep --no-index -E '^ ' file
file: b
$ grep -c -P '^ ' file
 b
$ pcregrep -c '^ ' file
 b

Reported-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoam: don't infloop for an empty input file
Jim Meyering [Sat, 25 Feb 2012 17:34:26 +0000 (18:34 +0100)]
am: don't infloop for an empty input file

git-am.sh's check_patch_format function would attempt to preview
the patch to guess its format, but would go into an infinite loop
when the patch file happened to be empty.  The solution: exit the
loop when "read" fails, not when the line var, "$l1" becomes empty.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorebase -m: only call "notes copy" when rewritten exists and is non-empty
Andrew Wong [Sat, 25 Feb 2012 04:31:22 +0000 (23:31 -0500)]
rebase -m: only call "notes copy" when rewritten exists and is non-empty

This prevents a shell error complaining rebase-merge/rewritten doesn't exist.

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: remove bash-ism in t9800
Pete Wyckoff [Sun, 26 Feb 2012 15:37:27 +0000 (10:37 -0500)]
git-p4: remove bash-ism in t9800

This works in both bash and dash:

    $ bash -c 'VAR=1 env' | grep VAR
    VAR=1
    $ dash -c 'VAR=1 env' | grep VAR
    VAR=1

But environment variables assigned this way are not necessarily propagated
through a function in POSIX compliant shells:

    $ bash -c 'f() { "$@"
    }; VAR=1 f "env"' | grep VAR
    VAR=1
    $ dash -c 'f() { "$@"
    }; VAR=1 f "env"' | grep VAR

Fix constructs like this, in particular, setting variables through
test_must_fail.

Based-on-patch-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: remove bash-ism in t9809
Pete Wyckoff [Sun, 26 Feb 2012 15:37:26 +0000 (10:37 -0500)]
git-p4: remove bash-ism in t9809

Plain old $# works to count the number of arguments in
either bash or dash, even if the arguments have spaces.

Based-on-patch-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: fix submit regression with clientSpec and subdir clone
Pete Wyckoff [Sun, 26 Feb 2012 01:06:25 +0000 (20:06 -0500)]
git-p4: fix submit regression with clientSpec and subdir clone

When the --use-client-spec is given to clone, and the clone
path is a subset of the full tree as specified in the client,
future submits will go to the wrong place.

Factor out getClientSpec() so both clone/sync and submit can
use it.  Introduce getClientRoot() that is needed for the client
spec case, and use it instead of p4Where().

Test the five possible submit behaviors (add, modify, rename,
copy, delete).

Reported-by: Laurent Charrière <lcharriere@promptu.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: set useClientSpec variable on initial clone
Pete Wyckoff [Sun, 26 Feb 2012 01:06:24 +0000 (20:06 -0500)]
git-p4: set useClientSpec variable on initial clone

If --use-client-spec was given, set the matching configuration
variable.  This is necessary to ensure that future submits
work properly.

The alternatives of requiring the user to set it, or providing
a command-line option on every submit, are error prone.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMakefile: add thread-utils.h to LIB_H
Dmitry V. Levin [Fri, 24 Feb 2012 23:42:42 +0000 (03:42 +0400)]
Makefile: add thread-utils.h to LIB_H

Starting with commit v1.7.8-165-g0579f91, grep.h includes
thread-utils.h, so the latter has to be added to LIB_H.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Acked-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>