Commit graph

27944 commits

Author SHA1 Message Date
Jeff King e54501004a 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>
2012-07-29 15:04:32 -07:00
Junio C Hamano d0f1ea6003 Git 1.7.9.7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-26 10:23:15 -07:00
Junio C Hamano b2bab5b338 Sync with 1.7.8.6 2012-04-26 10:22:20 -07:00
Junio C Hamano d9f5ef7a4a Git 1.7.8.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-26 10:14:45 -07:00
Junio C Hamano aba5f57c8f Sync with 1.7.7.7 2012-04-26 09:52:33 -07:00
Junio C Hamano 8258858493 Git 1.7.7.7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-26 09:41:52 -07:00
Jonathan Nieder 97afde15f5 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>
2012-04-26 08:08:07 -07:00
Junio C Hamano 6eab5f2f14 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
2012-04-10 12:44:45 -07:00
Junio C Hamano b1bcfbe344 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
2012-04-09 13:43:16 -07:00
Junio C Hamano 795283c415 Merge branch 'dw/gitweb-doc-grammo' into maint-1.7.8
* dw/gitweb-doc-grammo:
  Documentation/gitweb: trivial English fixes
2012-04-09 13:42:56 -07:00
Junio C Hamano 6d5c16a90c 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
2012-04-09 13:40:32 -07:00
Junio C Hamano 00fb2d2563 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
2012-04-09 13:38:41 -07:00
Junio C Hamano fc2d99f1e9 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
2012-04-09 13:36:44 -07:00
Junio C Hamano 50c9403284 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
2012-04-09 13:36:26 -07:00
Junio C Hamano 8502a779da 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
2012-04-09 13:36:20 -07:00
Junio C Hamano dbdc07fcbe Merge branch 'ph/rerere-doc' into maint-1.7.8
* ph/rerere-doc:
  rerere: Document 'rerere remaining'
2012-04-09 13:34:09 -07:00
Junio C Hamano cb2ed324fc Git 1.7.9.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-02 13:07:58 -07:00
Junio C Hamano b52ab19d91 Merge branch 'jc/maint-merge-autoedit' into maint
* jc/maint-merge-autoedit:
  merge: backport GIT_MERGE_AUTOEDIT support
2012-04-02 12:56:35 -07:00
Heiko Voigt b8939b2b3a 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>
2012-03-30 09:06:04 -07:00
Junio C Hamano 8ced9c90a2 Git 1.7.9.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-26 12:29:25 -07:00
Junio C Hamano 79efeae69d 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
2012-03-26 12:10:25 -07:00
Junio C Hamano bda02ebc39 Merge branch 'ph/rerere-doc' into maint
* ph/rerere-doc:
  rerere: Document 'rerere remaining'
2012-03-26 12:10:12 -07:00
Junio C Hamano ed6ce4382b 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
2012-03-26 12:10:05 -07:00
Mark Lodato a12c6b0149 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>
2012-03-26 12:06:48 -07:00
Rodrigo Silva (MestreLion) 36384c979d 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>
2012-03-26 10:46:07 -07:00
Nelson Benitez Leon d3f2475c01 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>
2012-03-26 10:28:55 -07:00
D Waitzman c32c959165 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>
2012-03-23 11:22:04 -07:00
Junio C Hamano 0f360763c0 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
2012-03-20 15:53:30 -07:00
Junio C Hamano d387868a7d 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>
2012-03-20 15:39:10 -07:00
Junio C Hamano d4c813d47d Merge branch 'ks/sort-wildcard-in-makefile' into maint-1.7.8
* ks/sort-wildcard-in-makefile:
  t/Makefile: Use $(sort ...) explicitly where needed
2012-03-20 15:26:19 -07:00
Junio C Hamano 39af78961d Merge branch 'jc/advise-i18n' into maint-1.7.8
* jc/advise-i18n:
  i18n of multi-line advice messages
2012-03-20 15:25:38 -07:00
Junio C Hamano bd193f46b7 Merge branch 'jn/gitweb-unspecified-action' into maint-1.7.8
* jn/gitweb-unspecified-action:
  gitweb: Fix actionless dispatch for non-existent objects
2012-03-20 15:24:23 -07:00
Junio C Hamano d21c463d55 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>
2012-03-15 15:23:17 -07:00
Junio C Hamano a46034819e Git 1.7.9.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-12 15:52:52 -07:00
Junio C Hamano 92b7aacbbc 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
2012-03-12 15:46:54 -07:00
Junio C Hamano fce8b5d82f 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
2012-03-12 15:46:32 -07:00
Junio C Hamano f629c233e6 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
2012-03-12 15:45:58 -07:00
Junio C Hamano b91a13bbdc 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
2012-03-12 15:43:15 -07:00
Martin Stenberg 4b34059355 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>
2012-03-12 09:39:06 -07:00
Jonathan Nieder 178e1deaae 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>
2012-03-09 22:07:22 -06:00
Jonathan Nieder c27e559da5 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>
2012-03-09 22:02:44 -06:00
Phil Hord 3e7a1df84d 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>
2012-03-08 14:40:44 -08:00
Jakub Narebski e65ceb61cd 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>
2012-03-06 14:48:24 -08:00
Thomas Rast 0dbe6592cc 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>
2012-03-06 12:32:24 -08:00
Junio C Hamano 80a3f53424 Merge branch 'maint-1.7.8' into maint
By Thomas Rast
* maint-1.7.8:
  Document the --histogram diff option
2012-03-06 12:05:09 -08:00
Junio C Hamano e521850bfd Merge branch 'maint-1.7.7' into maint-1.7.8
By Thomas Rast
* maint-1.7.7:
  Document the --histogram diff option
2012-03-06 12:04:48 -08:00
Thomas Rast d909e0761c Document the --histogram diff option
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-06 11:53:29 -08:00
Junio C Hamano 69f4e08f53 Git 1.7.9.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-05 14:29:07 -08:00
Junio C Hamano bb8cbe7861 Merge branch 'jc/doc-merge-options' into maint
* jc/doc-merge-options:
  Documentation/merge-options.txt: group "ff" related options together
2012-03-05 14:28:14 -08:00
Junio C Hamano 0e20414f10 Merge branch 'cn/maint-rev-list-doc' into maint
* cn/maint-rev-list-doc:
  Documentation: use {asterisk} in rev-list-options.txt when needed
2012-03-05 14:27:36 -08:00