]> asedeno.scripts.mit.edu Git - git.git/log
git.git
13 years agoWork around EMFILE when there are too many pack files
Shawn O. Pearce [Mon, 1 Nov 2010 22:54:21 +0000 (15:54 -0700)]
Work around EMFILE when there are too many pack files

When opening any files in the object database, release unused pack
windows if the open(2) syscall fails due to EMFILE (too many open
files in this process).  This allows Git to degrade gracefully on
a repository with thousands of pack files, and a commit stored in
a loose object in the middle of the history.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUse git_open_noatime when accessing pack data
Shawn O. Pearce [Mon, 1 Nov 2010 22:54:20 +0000 (15:54 -0700)]
Use git_open_noatime when accessing pack data

This utility function avoids an unnecessary update of the access time
for a loose object file.  Just as the atime isn't useful on a loose
object, its not useful on the pack or the corresonding idx file.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoA loose object is not corrupt if it cannot be read due to EMFILE
Junio C Hamano [Thu, 28 Oct 2010 18:13:06 +0000 (11:13 -0700)]
A loose object is not corrupt if it cannot be read due to EMFILE

"git fsck" bails out with a claim that a loose object that cannot be
read but exists on the filesystem to be corrupt, which is wrong when
read_object() failed due to e.g. EMFILE.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoread_sha1_file(): report correct name of packfile with a corrupt object
Junio C Hamano [Thu, 28 Oct 2010 18:13:06 +0000 (11:13 -0700)]
read_sha1_file(): report correct name of packfile with a corrupt object

Clarify the error reporting logic by moving the normal codepath (i.e. we
read the object we wanted to read correctly) up and return early.

The logic to report the name of the packfile with a corrupt object,
introduced by e8b15e6 (sha1_file: Show the the type and path to corrupt
objects, 2010-06-10), was totally bogus.  The function that knows which
bad object came from what packfile is has_packed_and_bad(); make it report
which packfile the problem was found.

"Corrupt" is already an adjective, e.g. an object is "corrupt"; we do not
have to say "corrupted object".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-branch.txt: mention --set-upstream as a way to change upstream configuration
Matthieu Moy [Tue, 2 Nov 2010 15:31:28 +0000 (16:31 +0100)]
git-branch.txt: mention --set-upstream as a way to change upstream configuration

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agouser-manual: remote-tracking can be checked out, with detached HEAD
Jonathan Nieder [Tue, 2 Nov 2010 15:31:27 +0000 (16:31 +0100)]
user-manual: remote-tracking can be checked out, with detached HEAD

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agouser-manual.txt: explain better the remote(-tracking) branch terms
Matthieu Moy [Tue, 2 Nov 2010 21:06:20 +0000 (22:06 +0100)]
user-manual.txt: explain better the remote(-tracking) branch terms

Now that the documentation is mostly consistant in the use of "remote
branch" Vs "remote-tracking branch", let's make this distinction explicit
early in the user-manual.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoChange incorrect "remote branch" to "remote tracking branch" in C code
Matthieu Moy [Tue, 2 Nov 2010 15:31:25 +0000 (16:31 +0100)]
Change incorrect "remote branch" to "remote tracking branch" in C code

(Just like we did for documentation already)

In the process, we change "non-remote branch" to "branch outside the
refs/remotes/ hierarchy" to avoid the ugly "non-remote-tracking branch".
The new formulation actually corresponds to how the code detects this
case (i.e. prefixcmp(refname, "refs/remotes")).

Also, we use 'remote-tracking branch' in generated merge messages (by
merge an fmt-merge-msg).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoChange incorrect uses of "remote branch" meaning "remote-tracking"
Matthieu Moy [Tue, 2 Nov 2010 15:31:24 +0000 (16:31 +0100)]
Change incorrect uses of "remote branch" meaning "remote-tracking"

"remote branch" is a branch hosted in a remote repository, while
"remote-tracking branch" is a copy of such branch, hosted locally.
The distinction is subtle when the copy is up-to-date, but rather
fundamental to understand what "git fetch" and "git push" do.

This patch should fix all incorrect usages in Documentation/ directory.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoChange "tracking branch" to "remote-tracking branch"
Matthieu Moy [Tue, 2 Nov 2010 15:31:23 +0000 (16:31 +0100)]
Change "tracking branch" to "remote-tracking branch"

One more step towards consistancy. We change the documentation and the C
code in a single patch, since the only instances in the C code are in
comment and usage strings.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoeveryday.txt: change "tracking branch" to "remote-tracking branch"
Matthieu Moy [Tue, 2 Nov 2010 15:31:22 +0000 (16:31 +0100)]
everyday.txt: change "tracking branch" to "remote-tracking branch"

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoChange remote tracking to remote-tracking in non-trivial places
Matthieu Moy [Tue, 2 Nov 2010 15:31:21 +0000 (16:31 +0100)]
Change remote tracking to remote-tracking in non-trivial places

To complement the straightforward perl application in previous patch,
this adds a few manual changes.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoReplace "remote tracking" with "remote-tracking"
Matthieu Moy [Tue, 2 Nov 2010 15:31:20 +0000 (16:31 +0100)]
Replace "remote tracking" with "remote-tracking"

"remote-tracking" branch makes it explicit that the branch is "tracking a
remote", as opposed to "remote, and tracking something".

See discussion in e.g.
http://mid.gmane.org/8835ADF9-45E5-4A26-9F7F-A72ECC065BB2@gmail.com
for more details.

This patch is a straightforward application of

  perl -pi -e 's/remote tracking branch/remote-tracking branch/'

except in the RelNotes directory.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoBetter "Changed but not updated" message in git-status
Matthieu Moy [Tue, 2 Nov 2010 15:31:19 +0000 (16:31 +0100)]
Better "Changed but not updated" message in git-status

Older Gits talked about "updating" a file to add its content to the
index, but this terminology is confusing for new users. "to stage" is far
more intuitive and already used in e.g. the "git stage" command name.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoapply: don't segfault on binary files with missing data
Jeff King [Mon, 18 Oct 2010 18:39:17 +0000 (14:39 -0400)]
apply: don't segfault on binary files with missing data

Usually when applying a binary diff generated without
--binary, it will be rejected early, as we don't even have
the full sha1 of the pre- and post-images.

However, if the diff is generated with --full-index (but not
--binary), then we will actually try to apply it. If we have
the postimage blob, then we can take a shortcut and never
even look at the binary diff at all (e.g., this can happen
when rebasing changes within a repository).

If we don't have the postimage blob, though, we try to look
at the actual fragments, of which there are none, and get a
segfault. This patch checks explicitly for that case and
complains to the user instead of segfaulting. We need to
keep the check at a low level so that the "shortcut" case
above continues to work.

We also add a test that demonstrates the segfault. While
we're at it, let's also explicitly test the shortcut case.

Reported-by: Rafaël Carré <rafael.carre@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot0003: properly quote $HOME
Thomas Rast [Mon, 18 Oct 2010 09:09:54 +0000 (11:09 +0200)]
t0003: properly quote $HOME

6df42ab (Add global and system-wide gitattributes, 2010-09-01) forgot
to quote one instance of $HOME in the tests.  This would be valid
according to POSIX, but bash 4 helpfully declines to execute the
command in question with an "ambiguous redirection" error.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocontrib/ciabot: git-describe commit instead of HEAD
Sven Eckelmann [Mon, 20 Sep 2010 09:31:22 +0000 (11:31 +0200)]
contrib/ciabot: git-describe commit instead of HEAD

For each commit a shorter version of the name will be generated. This is
either the truncated hash or the output of git-describe. The
call to git-describe was only made with an empty shell variable instead
of an actual commit hash. Thus it only described the current HEAD and
not each commit we want to submit to cia.vc.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix a formatting error in git-merge.txt
Nathan W. Panike [Fri, 29 Oct 2010 15:33:54 +0000 (10:33 -0500)]
Fix a formatting error in git-merge.txt

Inside an element of an enumerated list, the second and subsequent
paragraphs need to lose their indent and have to be strung together with a
line with a single '+' on it instead.  Otherwise the lines below are shown
in typewriter face, which just looks wrong.

Signed-off-by: Nathan W. Panike <nathan.panike@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoInterix: add configure checks
Markus Duft [Wed, 27 Oct 2010 08:39:53 +0000 (10:39 +0200)]
Interix: add configure checks

 * check for sys/poll.h. define NO_SYS_POLL_H otherwise.
 * check for inttypes.h, define NO_INTTYPES_H otherwise.
 * check for initgroups(), define NO_INITGROUPS otherwise.

Signed-off-by: Markus Duft <mduft@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoadd support for the SUA layer (interix; windows)
Markus Duft [Wed, 27 Oct 2010 08:39:52 +0000 (10:39 +0200)]
add support for the SUA layer (interix; windows)

* add required build options to Makefile.
* introduce new NO_INTTYPES_H for systems lacking inttypes; code
  includes stdint.h instead, if this is set.
* introduce new NO_SYS_POLL_H for systems lacking sys/poll.h; code
  includes poll.h instead, if this is set.
* introduce NO_INITGROUPS. initgroups() call is simply omitted.

Signed-off-by: Markus Duft <mduft@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocore.abbrevguard: Ensure short object names stay unique a bit longer
Junio C Hamano [Thu, 28 Oct 2010 21:39:13 +0000 (14:39 -0700)]
core.abbrevguard: Ensure short object names stay unique a bit longer

Even though git makes sure that it uses enough hexdigits to show an
abbreviated object name unambiguously, as more objects are added to the
repository over time, a short name that used to be unique will stop being
unique.  Git uses this many extra hexdigits that are more than necessary
to make the object name currently unique, in the hope that its output will
stay unique a bit longer.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoCorrect help blurb in checkout -p and friends
Jonathan "Duke" Leto [Thu, 28 Oct 2010 00:49:20 +0000 (17:49 -0700)]
Correct help blurb in checkout -p and friends

When git checkout -p from the index or HEAD is run in edit mode, the
help message about removing '-' and '+' lines was backwards. Because it
is reverse applying the patch, the meanings of '-' and '+' are reversed.

Signed-off-by: Jonathan "Duke" Leto <jonathan@leto.net>
Acked-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoPorcelain scripts: Rewrite cryptic "needs update" error message
Ramkumar Ramachandra [Tue, 19 Oct 2010 14:39:28 +0000 (20:09 +0530)]
Porcelain scripts: Rewrite cryptic "needs update" error message

Although Git interally has the facility to differentiate between
porcelain and plubmbing commands and appropriately print errors,
several shell scripts invoke plubming commands triggering cryptic
plumbing errors to be displayed on a porcelain interface. This patch
replaces the "needs update" message in git-pull and git-rebase, when
`git update-index` is run, with a more friendly message.

Reported-by: Joshua Jensen <jjensen@workspacewhiz.com>
Reported-by: Thore Husfeldt <thore.husfeldt@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocompletion: fix zsh check under bash with 'set -u'
Mark Lodato [Thu, 28 Oct 2010 01:08:21 +0000 (21:08 -0400)]
completion: fix zsh check under bash with 'set -u'

Commit 06f44c3 (completion: make compatible with zsh) broke bash
compatibility with 'set -u': a warning was generated when checking
$ZSH_VERSION.  The solution is to supply a default value, using
${ZSH_VERSION-}.  Thanks to SZEDER Gábor for the fix.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-gui: apply color information from git diff output
Pat Thoyts [Fri, 22 Oct 2010 15:14:38 +0000 (16:14 +0100)]
git-gui: apply color information from git diff output

This patch extracts the ANSI color sequences from git diff output and
applies these to the diff view window. This ensures that the gui view
makes use of the current git configuration for whitespace display.

ANSI codes may include attributes, foreground and background in a single
sequence. Handle this and support bold and reverse attributes. Ignore
all other attributes.

Suggested-by: Tor Arvid Lund <torarvid@gmail.com>
Suggested-by: Junio C Hamano <gitster@pobox.com>
Tested-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
13 years agogit-gui: use wordprocessor tab style to ensure tabs work as expected
Pat Thoyts [Wed, 27 Oct 2010 22:37:31 +0000 (23:37 +0100)]
git-gui: use wordprocessor tab style to ensure tabs work as expected

The Tk text widget tab style is tabular where the first tab will align to
the first tabstop and if that position is left of the current location
then just a single character space is used. With the wordprocessor style
a tab moves the next character position to the next rightmost tabstop
as expected for viewing code.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
13 years agoMerge branch 'ab/send-email-perl'
Junio C Hamano [Wed, 27 Oct 2010 05:02:52 +0000 (22:02 -0700)]
Merge branch 'ab/send-email-perl'

* ab/send-email-perl:
  send-email: extract_valid_address use qr// regexes
  send-email: is_rfc2047_quoted use qr// regexes
  send-email: use Perl idioms in while loop
  send-email: make_message_id use "require" instead of "use"
  send-email: send_message die on $!, not $?
  send-email: use (?:) instead of () if no match variables are needed
  send-email: sanitize_address use qq["foo"], not "\"foo\""
  send-email: sanitize_address use $foo, not "$foo"
  send-email: use \E***\Q instead of \*\*\*
  send-email: cleanup_compose_files doesn't need a prototype
  send-email: unique_email_list doesn't need a prototype
  send-email: file_declares_8bit_cte doesn't need a prototype
  send-email: get_patch_subject doesn't need a prototype
  send-email: use lexical filehandles during sending
  send-email: use lexical filehandles for $compose
  send-email: use lexical filehandle for opendir

Conflicts:
git-send-email.perl

13 years agoMerge branch 'sb/send-email-use-to-from-input'
Junio C Hamano [Wed, 27 Oct 2010 05:02:03 +0000 (22:02 -0700)]
Merge branch 'sb/send-email-use-to-from-input'

* sb/send-email-use-to-from-input:
  send-email: Don't leak To: headers between patches
  send-email: Use To: headers in patch files

Conflicts:
git-send-email.perl

13 years agoMerge branch 'ab/require-perl-5.8'
Junio C Hamano [Wed, 27 Oct 2010 04:57:31 +0000 (21:57 -0700)]
Merge branch 'ab/require-perl-5.8'

* ab/require-perl-5.8:
  perl: use "use warnings" instead of -w
  perl: bump the required Perl version to 5.8 from 5.6.[21]

13 years agoMerge branch 'kb/merge-recursive-rename-threshold'
Junio C Hamano [Wed, 27 Oct 2010 04:54:04 +0000 (21:54 -0700)]
Merge branch 'kb/merge-recursive-rename-threshold'

* kb/merge-recursive-rename-threshold:
  diff: add synonyms for -M, -C, -B
  merge-recursive: option to specify rename threshold

Conflicts:
Documentation/diff-options.txt
Documentation/merge-strategies.txt

13 years agoMerge branch 'jp/send-email-to-cmd'
Junio C Hamano [Wed, 27 Oct 2010 04:52:26 +0000 (21:52 -0700)]
Merge branch 'jp/send-email-to-cmd'

* jp/send-email-to-cmd:
  git-send-email.perl: Add --to-cmd

Conflicts:
git-send-email.perl

13 years agoMerge branch 'as/daemon-multi-listen'
Junio C Hamano [Wed, 27 Oct 2010 04:50:03 +0000 (21:50 -0700)]
Merge branch 'as/daemon-multi-listen'

* as/daemon-multi-listen:
  daemon: allow more than one host address given via --listen
  daemon: add helper function named_sock_setup

13 years agoMerge branch 'dm/mergetool-vimdiff'
Junio C Hamano [Wed, 27 Oct 2010 04:47:11 +0000 (21:47 -0700)]
Merge branch 'dm/mergetool-vimdiff'

* dm/mergetool-vimdiff:
  mergetool-lib: make the three-way diff the default for vim/gvim
  mergetool-lib: add a three-way diff view for vim/gvim
  mergetool-lib: combine vimdiff and gvimdiff run blocks

13 years agoMerge branch 'kf/post-receive-sample-hook'
Junio C Hamano [Wed, 27 Oct 2010 04:41:18 +0000 (21:41 -0700)]
Merge branch 'kf/post-receive-sample-hook'

* kf/post-receive-sample-hook:
  post-receive-email: ensure sent messages are not empty

13 years agoMerge branch 'jf/merge-ignore-ws'
Junio C Hamano [Wed, 27 Oct 2010 04:40:54 +0000 (21:40 -0700)]
Merge branch 'jf/merge-ignore-ws'

* jf/merge-ignore-ws:
  merge-recursive: options to ignore whitespace changes
  merge-recursive --patience
  ll-merge: replace flag argument with options struct
  merge-recursive: expose merge options for builtin merge

13 years agoMerge branch 'ml/completion-zsh'
Junio C Hamano [Wed, 27 Oct 2010 04:39:03 +0000 (21:39 -0700)]
Merge branch 'ml/completion-zsh'

* ml/completion-zsh:
  completion: make compatible with zsh

13 years agoMerge branch 'po/sendemail'
Junio C Hamano [Wed, 27 Oct 2010 04:37:54 +0000 (21:37 -0700)]
Merge branch 'po/sendemail'

* po/sendemail:
  New send-email option smtpserveroption.
  Remove @smtp_host_parts variable as not used.
  Minor indentation fix.

13 years agoMerge branch 'en/tree-walk-optim'
Junio C Hamano [Wed, 27 Oct 2010 04:37:49 +0000 (21:37 -0700)]
Merge branch 'en/tree-walk-optim'

* en/tree-walk-optim:
  diff_tree(): Skip skip_uninteresting() when all remaining paths interesting
  tree_entry_interesting(): Make return value more specific
  tree-walk: Correct bitrotted comment about tree_entry()
  Document pre-condition for tree_entry_interesting

13 years agoMerge branch 'maint'
Junio C Hamano [Tue, 26 Oct 2010 22:04:05 +0000 (15:04 -0700)]
Merge branch 'maint'

* maint:
  Fix copy-pasted comments related to tree diff handling.

13 years agotest: allow running the tests under "prove"
Michael J Gruber [Thu, 14 Oct 2010 08:53:36 +0000 (10:53 +0200)]
test: allow running the tests under "prove"

You can run "make DEFAULT_TEST_TARGET=prove test" to run the test under
"prove" (or $(PROVE) if set).  The output is a bit easier to read when
running many tests in parallel.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Liked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Liked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix copy-pasted comments related to tree diff handling.
Yann Dirson [Sun, 24 Oct 2010 21:03:10 +0000 (23:03 +0200)]
Fix copy-pasted comments related to tree diff handling.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomake pack-objects a bit more resilient to repo corruption
Nicolas Pitre [Fri, 22 Oct 2010 20:26:23 +0000 (16:26 -0400)]
make pack-objects a bit more resilient to repo corruption

Right now, packing valid objects could fail when creating a thin pack
simply because a pack edge object used as a preferred base is corrupted.
Since preferred base objects are not strictly needed to produce a valid
pack, let's not consider the inability to read them as a fatal error.
Delta compression may well be attempted against other objects in the
search window.  To avoid warning storms (we are in the inner loop of
the delta search window) a warning is emitted only on the first
occurrence.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix handling of git-p4 on deleted files
Andrew Waters [Fri, 22 Oct 2010 12:26:02 +0000 (13:26 +0100)]
Fix handling of git-p4 on deleted files

Signed-off-by: Andrew Waters <apwaters@googlemail.com>
Tested-by: Thomas Berg <merlin66b@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff: don't presume empty file when corresponding object is missing
Nicolas Pitre [Fri, 22 Oct 2010 04:02:27 +0000 (00:02 -0400)]
diff: don't presume empty file when corresponding object is missing

The low-level diff code will happily produce totally bogus diff output
with a broken repository via format-patch and friends by treating missing
objects as empty files.  Let's prevent that from happening any longer.

Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoSync with 1.7.3.2
Junio C Hamano [Fri, 22 Oct 2010 00:16:04 +0000 (17:16 -0700)]
Sync with 1.7.3.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.3.2 v1.7.3.2
Junio C Hamano [Fri, 22 Oct 2010 00:14:32 +0000 (17:14 -0700)]
Git 1.7.3.2

13 years agoMerge branch 'sn/doc-opt-notation' into maint
Junio C Hamano [Thu, 21 Oct 2010 23:26:42 +0000 (16:26 -0700)]
Merge branch 'sn/doc-opt-notation' into maint

* sn/doc-opt-notation:
  Fix {update,checkout}-index usage strings
  Put a space between `<' and argument in pack-objects usage string
  Remove stray quotes in --pretty and --format documentation
  Use parentheses and `...' where appropriate
  Fix odd markup in --diff-filter documentation
  Use angles for placeholders consistently

13 years agoMerge branch 'mg/fix-build-remote-helpers' into maint
Junio C Hamano [Thu, 21 Oct 2010 23:26:38 +0000 (16:26 -0700)]
Merge branch 'mg/fix-build-remote-helpers' into maint

* mg/fix-build-remote-helpers:
  remote-helpers: build in platform independent directory

13 years agoconfig: treat non-existent config files as empty
Jeff King [Thu, 21 Oct 2010 14:45:44 +0000 (10:45 -0400)]
config: treat non-existent config files as empty

The git_config() function signals error by returning -1 in
two instances:

  1. An actual error occurs in opening a config file (parse
     errors cause an immediate die).

  2. Of the three possible config files, none was found.

However, this second case is often not an error at all; it
simply means that the user has no configuration (they are
outside a repo, and they have no ~/.gitconfig file). This
can lead to confusing errors, such as when the bash
completion calls "git config --list" outside of a repo. If
the user has a ~/.gitconfig, the command completes
succesfully; if they do not, it complains to stderr.

This patch allows callers of git_config to distinguish
between the two cases. Error is signaled by -1, and
otherwise the return value is the number of files parsed.
This means that the traditional "git_config(...) < 0" check
for error should work, but callers who want to know whether
we parsed any files or not can still do so.

[jc: with tests from Jonathan]

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodocs: give more hints about how "add -e" works
Jeff King [Thu, 21 Oct 2010 14:30:35 +0000 (10:30 -0400)]
docs: give more hints about how "add -e" works

The previous text was not exactly accurate; it is OK to
change space and minus lines, but only in certain ways. This
patch attempts to cover explicitly what can be done at the
individual line level, and cautions the user that
conceptually larger changes (like modifying a line) require
some understanding of the patch format.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge-recursive:make_room_for_directories - work around dumb compilers
Junio C Hamano [Thu, 21 Oct 2010 14:34:33 +0000 (07:34 -0700)]
merge-recursive:make_room_for_directories - work around dumb compilers

Some vintage of gcc does not seem to notice last_len is only used when
last_file is already set to non-NULL at which point last_len is also
set.

Noticed on FreeBSD 8

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff: handle lines containing only whitespace and tabs better
Kevin Ballard [Wed, 20 Oct 2010 22:17:26 +0000 (15:17 -0700)]
diff: handle lines containing only whitespace and tabs better

When a line contains nothing but whitespace with at least one tab
and the core.whitespace config option contains blank-at-eol, the
whitespace on the line is being printed twice, once unhighlighted
(unless otherwise matched by one of the other core.whitespace values),
and a second time highlighted for blank-at-eol.

Update the leading indentation check to stop checking when it reaches
the trailing whitespace.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotest-lib: extend test_decode_color to handle more color codes
Kevin Ballard [Wed, 20 Oct 2010 22:17:25 +0000 (15:17 -0700)]
test-lib: extend test_decode_color to handle more color codes

Enhance the test_decode_color function to handle all common color codes,
including background colors and escapes that contain multiple codes.
This change necessitates changing <WHITE> to <BOLD>, so update t4034
as well.

This change is necessary for the next commit in order to test
background colors properly.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofast-import: do not clear notes in do_change_note_fanout()
Jonathan Nieder [Wed, 20 Oct 2010 20:25:58 +0000 (15:25 -0500)]
fast-import: do not clear notes in do_change_note_fanout()

Commit 5edde51 (fast-import: filemodify after M 040000 <tree> ""
crashes, 2010-10-17) taught fast-import to load trees from the
object db as needed when it is time to access them.

But it went too far.  In change_note_fanout(), an empty,
not-loaded tree is not meant to destroy notes, so calling
load_tree() at that point is exactly the wrong thing to do.

Kudos to Johan Herland for t9301, which caught this failure.

Reported-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/gitweb-lib: Don't pass constant to decode_utf8
Brian Gernhardt [Wed, 20 Oct 2010 05:57:11 +0000 (01:57 -0400)]
t/gitweb-lib: Don't pass constant to decode_utf8

Encode.pm started updating the string to decode in-place when a second
argument is passed in version 2.40.

This causes 'decode_utf8("", Encode::FB_CROAK)' to die with a message
like:

  Modification of a read-only value attempted at .../Encode.pm line 216.

Work around this by passing an empty variable instead of a constant
string.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-gui: correct assignment of work-tree
Pat Thoyts [Wed, 20 Oct 2010 13:29:56 +0000 (14:29 +0100)]
git-gui: correct assignment of work-tree

git-gui currently uses its own logic to determine the work-tree setting
but 'git rev-parse --toplevel' directly returns git's work-tree value
by calling get_git_work_tree() and is therefore always correct.

This fixes an inability to handle some repository configurations. In
particular where .git is a file containing a path to the real directory
(a cross-platform symbolic link).
To continue to support older versions than 1.7.0, setting the work-tree
by normalizing the --show-cdup value is more reliable as git-dir might be
outside the work-tree entirely.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
13 years agot4203: do not let "git shortlog" DWIM based on tty
Junio C Hamano [Wed, 20 Oct 2010 06:32:06 +0000 (23:32 -0700)]
t4203: do not let "git shortlog" DWIM based on tty

The "shortlog" command defaults to HEAD only when its standard input is
connected to a terminal; otherwise it acts in the traditional "filter"
mode to read and summarize the "git log" output.

Two new tests added to t4203 assumed that the command always default to
HEAD, but when the standard input is closed (or connected to /dev/null),
it output empty, which is a summary of its empty input, causing the test
to break.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot9300 (fast-import): another test for the "replace root" feature
Jonathan Nieder [Mon, 18 Oct 2010 01:44:04 +0000 (20:44 -0500)]
t9300 (fast-import): another test for the "replace root" feature

Another test for the replace root feature.  One can imagine an
implementation for which R "some/subdir" "" would free some state
associated to the subdir and leave fast-import confused.

Luckily, git's is not such an implementation.

While at it, change the previous test to use C "some/subdir" ""
instead of R (i.e., test both syntaxes).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years ago{cvs,svn}import: use the new 'git read-tree --empty'
Thomas Rast [Mon, 18 Oct 2010 13:11:25 +0000 (15:11 +0200)]
{cvs,svn}import: use the new 'git read-tree --empty'

Since fb1bb96 (read-tree: deprecate syntax without tree-ish args,
2010-09-10) not passing --empty caused a spurious warning that was
shown to the user.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Tue, 19 Oct 2010 21:15:51 +0000 (14:15 -0700)]
Merge branch 'maint'

* maint:
  t/t9001-send-email.sh: fix stderr redirection in 'Invalid In-Reply-To'
  Clarify and extend the "git diff" format documentation
  git-show-ref.txt: clarify the pattern matching
  documentation: git-config minor cleanups
  Update test script annotate-tests.sh to handle missing/extra authors

13 years agot/t9001-send-email.sh: fix stderr redirection in 'Invalid In-Reply-To'
Antonio Ospite [Tue, 19 Oct 2010 09:50:39 +0000 (11:50 +0200)]
t/t9001-send-email.sh: fix stderr redirection in 'Invalid In-Reply-To'

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoClarify and extend the "git diff" format documentation
Andreas Gruenbacher [Thu, 14 Oct 2010 10:53:11 +0000 (12:53 +0200)]
Clarify and extend the "git diff" format documentation

Move the similarity and dissimilarity index header description closer to
where those extended headers are described.

Describe and/or clarify the format used for file modes, pathnames, and
the index header.

Document that all "old" files refer to the state before applying the
*entire* output, and all "new" files refer to the state thereafter.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-show-ref.txt: clarify the pattern matching
Michael J Gruber [Mon, 18 Oct 2010 11:33:32 +0000 (13:33 +0200)]
git-show-ref.txt: clarify the pattern matching

git-show-ref really does not do what one would expect under the name
pattern matching, so describe it.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodocumentation: git-config minor cleanups
Cliff Frey [Mon, 18 Oct 2010 03:10:45 +0000 (20:10 -0700)]
documentation: git-config minor cleanups

Change push.default's description to add hyphens between values and
descriptions to make the manpage easier to read.  The html version is
readable either way.

Change status.showUntrackedFiles to make item descriptions be
sentences and to use the same asciidoc format as push.default.  The
only visual change is the additions of "."

Signed-off-by: Cliff Frey <cliff@meraki.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUpdate test script annotate-tests.sh to handle missing/extra authors
Kevin Ballard [Sat, 16 Oct 2010 11:09:20 +0000 (04:09 -0700)]
Update test script annotate-tests.sh to handle missing/extra authors

The current script used by annotate-tests.sh (used by t8001 and t8002) fails
to emit a warning if any of the expected authors never show up in the output
or if authors that show up in the output were never specified as expected.
Update the script to fail in both of these scenarios.

Helped-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoblame: Add option to show author email instead of name
Kevin Ballard [Sat, 16 Oct 2010 06:57:51 +0000 (23:57 -0700)]
blame: Add option to show author email instead of name

Add a new option -e (or --show-email) to git-blame that will display
the author's email instead of name on each line. This option works
for both git-blame and git-annotate.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorepack: place temporary packs under .git/objects/pack/
Thomas Rast [Tue, 19 Oct 2010 09:50:43 +0000 (11:50 +0200)]
repack: place temporary packs under .git/objects/pack/

git-pack-objects is already careful to start out its temporary packs
under .git/objects/pack/ (cf. 8b4eb6b, Do not perform cross-directory
renames when creating packs, 2008-09-22), but git-repack did not
respond in kind so the effort was lost when the filesystem boundary is
exactly at that directory.

Let git-repack pass a path under .git/objects/pack/ as the base for
its temporary packs.

This means we might need the $PACKDIR sooner (before the pack-objects
invocation), so move the mkdir up just to be safe.

Also note that the only use of *.pack is in the find invocation way
before the pack-objects call, so the temporary packs will not suddenly
show up in any wildcards because of the directory change.

Reported-by: Marat Radchenko <marat@slonopotamus.org>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofast-import: tighten M 040000 syntax
Jonathan Nieder [Mon, 18 Oct 2010 01:08:53 +0000 (20:08 -0500)]
fast-import: tighten M 040000 syntax

When tree_content_set() is asked to modify the path "foo/bar/",
it first recurses like so:

tree_content_set(root, "foo/bar/", sha1, S_IFDIR) ->
 tree_content_set(root:foo, "bar/", ...) ->
  tree_content_set(root:foo/bar, "", ...)

And as a side-effect of 2794ad5 (fast-import: Allow filemodify to set
the root, 2010-10-10), this last call is accepted and changes
the tree entry for root:foo/bar to refer to the specified tree.

That seems safe enough but let's reject the new syntax (we never meant
to support it) and make it harder for frontends to introduce pointless
incompatibilities with git fast-import 1.7.3.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofast-import: filemodify after M 040000 <tree> "" crashes
Jonathan Nieder [Mon, 18 Oct 2010 01:03:38 +0000 (20:03 -0500)]
fast-import: filemodify after M 040000 <tree> "" crashes

Until M 040000 <tree> "" syntax was introduced in commit 2794ad5
(fast-import: Allow filemodify to set the root, 2010-10-10), it
was impossible for the root entry to refer to an unloaded tree.
Update various functions to take that possibility into account.
Otherwise

M 040000 <tree> ""
M 100644 :1 "foo"

and similar commands (using D, C, or R after resetting the root
tree) segfault.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agopush: pass --progress down to git-pack-objects
Jeff King [Sat, 16 Oct 2010 18:37:03 +0000 (02:37 +0800)]
push: pass --progress down to git-pack-objects

When pushing via builtin transports (like file://, git://), the
underlying transport helper (in this case, git-pack-objects) did not get
the --progress option, even if it was passed to git push.

Fix this, and update the tests to reflect this.

Note that according to the git-pack-objects documentation, we can safely
apply the usual --progress semantics for the transport commands like
clone and fetch (and for pushing over other smart transports).

Reported-by: Chase Brammer <cbrammer@gmail.com>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot5523-push-upstream: test progress messages
Tay Ray Chuan [Sat, 16 Oct 2010 18:37:02 +0000 (02:37 +0800)]
t5523-push-upstream: test progress messages

Reported-by: Chase Brammer <cbrammer@gmail.com>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot5523-push-upstream: add function to ensure fresh upstream repo
Tay Ray Chuan [Sat, 16 Oct 2010 18:37:01 +0000 (02:37 +0800)]
t5523-push-upstream: add function to ensure fresh upstream repo

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotest_terminal: ensure redirections work reliably
Jonathan Nieder [Sun, 17 Oct 2010 00:38:07 +0000 (19:38 -0500)]
test_terminal: ensure redirections work reliably

For terminal tests that capture output/stderr, the TTY prerequisite
warning does not quite work for commands like

test_terminal foo >out 2>err

because the warning gets "swallowed" up by the redirection that's
supposed only to be done by the subcommand.

Even worse, the outcome depends on whether stdout was already a
terminal (in which case test_terminal is a noop) or not (in which case
test_terminal introduces a pseudo-tty in the middle of the pipeline).

$ test_terminal.perl sh -c 'test -t 1 && echo >&2 YES' >out
YES
$ sh -c 'test -t 1 && echo >&2 YES' >out
$

So:

 - use the test_terminal script even when running with "-v".

 - skip tests that require a terminal when the test_terminal
   script is unusable because IO::Pty is not installed.

 - write the "need to declare TTY prerequisite" message to fd 4,
   where it will be printed when running tests with -v, rather
   than being swallowed up by an unrelated redireciton.

Noticed-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotest_terminal: catch use without TTY prerequisite
Jonathan Nieder [Sat, 16 Oct 2010 18:36:59 +0000 (02:36 +0800)]
test_terminal: catch use without TTY prerequisite

It is easy to forget to declare the TTY prerequisite when
writing tests on a system where it would always be satisfied
(because IO::Pty is installed; see v1.7.3-rc0~33^2, 2010-08-16
for example).  Automatically detect this problem so there is
no need to remember.

test_terminal: need to declare TTY prerequisite
test_must_fail: command not found: test_terminal echo hi

test_terminal returns status 127 in this case to simulate
not being available.

Also replace the SIMPLEPAGERTTY prerequisite on one test with
"SIMPLEPAGER,TTY", since (1) the latter is supported now and
(2) the prerequisite detection relies on the TTY prereq being
explicitly declared.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotest-lib: allow test code to check the list of declared prerequisites
Jonathan Nieder [Sat, 16 Oct 2010 18:36:58 +0000 (02:36 +0800)]
test-lib: allow test code to check the list of declared prerequisites

This is plumbing to prepare helpers like test_terminal to notice buggy
test scripts that do not declare all of the necessary prerequisites.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotests: test terminal output to both stdout and stderr
Jeff King [Sat, 16 Oct 2010 18:36:57 +0000 (02:36 +0800)]
tests: test terminal output to both stdout and stderr

Some outputs (like the pager) care whether stdout is a
terminal. Others (like progress meters) care about stderr.

This patch sets up both. Technically speaking, we could go
further and set up just one (because either the other goes
to a terminal, or because our tests are only interested in
one). This patch does both to keep the interface to
lib-terminal simple.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotests: factor out terminal handling from t7006
Jeff King [Sat, 16 Oct 2010 18:36:56 +0000 (02:36 +0800)]
tests: factor out terminal handling from t7006

Other tests besides the pager ones may want to check how we handle
output to a terminal. This patch makes the code reusable.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosend-pack: avoid redundant "pack-objects died with strange error"
Jonathan Nieder [Sat, 16 Oct 2010 17:09:54 +0000 (12:09 -0500)]
send-pack: avoid redundant "pack-objects died with strange error"

Saying "pack-objects died with strange error" after "pack-objects died
of signal 13" seems kind of redundant.  The latter message was
introduced when the run-command API changed to report abnormal exits
on behalf of the caller (v1.6.5-rc0~86^2~5, 2009-07-04).

Similarly, after a controlled pack-objects failure (detectable as a
normal exit with nonzero status), a "died with strange error" message
would be redundant next to the message from pack-objects itself.

So leave off the "strange error" messages.

The result should look something like this:

$ git push sf master
Counting objects: 21542, done.
Compressing objects: 100% (4179/4179), done.
fatal: Unable to create temporary file: Permission denied
error: pack-objects died of signal 13
error: failed to push some refs to 'ssh://sf.net/gitroot/project/project'
$

Or in the "controlled exit" case (contrived example):

[...]
fatal: delta size changed
error: failed to push some refs to 'ssh://example.com/foo/bar'
$

Improved-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge-file: correctly find files when called in subdir
Thomas Rast [Sun, 17 Oct 2010 19:23:22 +0000 (21:23 +0200)]
merge-file: correctly find files when called in subdir

Since b541248 (merge.conflictstyle: choose between "merge" and "diff3
-m" styles, 2008-08-29), git-merge-file uses setup_directory_gently(),
thus cd'ing around to find any possible config files to use.

This broke merge-file when it is called from within a subdirectory of
a repository, and the arguments are all relative paths.

Fix by prepending the prefix, as passed down from the main git
setup code, if there is any.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoprefix_filename(): safely handle the case where pfx_len=0
Thomas Rast [Sun, 17 Oct 2010 19:23:21 +0000 (21:23 +0200)]
prefix_filename(): safely handle the case where pfx_len=0

Current prefix_filename() is proofed against the case where the prefix
'pfx' is NULL or a 0-length string, _except on Windows_.

Change the behaviour to work the same on both platforms, and only
check pfx_len so that callers passing a NULL prefix with a nonzero
pfx_len segfault early on both.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot4203 (mailmap): stop hardcoding commit ids and dates
Jonathan Nieder [Fri, 15 Oct 2010 17:12:19 +0000 (12:12 -0500)]
t4203 (mailmap): stop hardcoding commit ids and dates

A seemingly innocuous change like adding test_tick somewhere can
completely upset the final mailmap test, since it checks commit
hashes and dates.  Make the test less fragile by fuzzing away the
unpredictable parts and leaving in the authors (which is what the
test is about, anyway).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff --check: correct line numbers of new blank lines at EOF
Christoph Mallon [Sun, 10 Oct 2010 17:24:06 +0000 (19:24 +0200)]
diff --check: correct line numbers of new blank lines at EOF

The whitespace check printed the value of the wrong variable, i.e. the
beginning of the block of blank lines at the EOF (possibly absent) in the
old file.

As "git diff --check" is used by users to check their changes before
making a commit, we should point at the line number in the file after
the change.

Signed-off-by: Christoph Mallon <christoph.mallon@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Thu, 14 Oct 2010 03:20:09 +0000 (20:20 -0700)]
Merge branch 'maint'

* maint:
  Better advice on using topic branches for kernel development
  Documentation: update implicit "--no-index" behavior in "git diff"
  Documentation: expand 'git diff' SEE ALSO section
  Documentation: diff can compare blobs
  Documentation: gitrevisions is in section 7
  shell portability: no "export VAR=VAL"
  CodingGuidelines: reword parameter expansion section
  Documentation: update-index: -z applies also to --index-info
  Documentation: No argument of ALLOC_GROW should have side-effects

13 years agomailmap: fix use of freed memory
Jim Meyering [Mon, 11 Oct 2010 15:41:16 +0000 (17:41 +0200)]
mailmap: fix use of freed memory

On an x86_64 system (F13-based), I ran these commands in an empty directory:

    git init
    printf '%s\n' \
      '<jdoe@example.com> <jdoe@example.COM>' \
      'John <jdoe@example.com>' > .mailmap
    git shortlog < /dev/null

Here's the result:

    (reading log message from standard input)
    *** glibc detected *** git: free(): invalid pointer: 0x0000000000f53730 ***
    ======= Backtrace: =========
    /lib64/libc.so.6[0x31ba875676]
    git[0x48c2a5]
    git[0x4b9858]
    ...
    zsh: abort (core dumped)  git shortlog

What happened?

Some .mailmap entry is of the <email1> <email2> form,
while a subsequent one looks like "User Name <Email2>,
and the two email addresses on the right are not identical
but are "equal" when using a case-insensitive comparator.

Then, when add_mapping is processing the latter line, new_email is NULL
and we free me->email, yet do not replace it with a new strdup'd string.
Thus, when later we attempt to use the buffer behind that ->email pointer,
we reference freed memory.

The solution is to free ->email and ->name only if we're about to replace them.

[jc: squashed in the tests from Jonathan]

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoBetter advice on using topic branches for kernel development
Luck, Tony [Fri, 1 Oct 2010 18:57:52 +0000 (11:57 -0700)]
Better advice on using topic branches for kernel development

Linus Torvalds wrote:
> The real problem is that maintainers often pick random - and not at
> all stable - points for their development to begin with. They just
> pick some random "this is where Linus -git tree is today", and do
> their development on top of that. THAT is the problem - they are
> unaware that there's some nasty bug in that version.

Maybe they do this because they read it in the Git user-manual.

Fix the manual to give them better guidance.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: update implicit "--no-index" behavior in "git diff"
Jonathan Nieder [Mon, 11 Oct 2010 16:06:18 +0000 (11:06 -0500)]
Documentation: update implicit "--no-index" behavior in "git diff"

Originally "--no-index" mode triggered for untracked files within the
tracked tree, but with v1.5.6-rc1~41 (Merge branch 'jc/diff-no-no-index,
2008-05-26) the command was fixed to only implicitly trigger when paths
outside the tracked tree are mentioned.

Reported-by: Yann Dirson <dirson@bertin.fr>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: expand 'git diff' SEE ALSO section
Jonathan Nieder [Mon, 11 Oct 2010 16:05:32 +0000 (11:05 -0500)]
Documentation: expand 'git diff' SEE ALSO section

Point in many directions in the hope of helping the reader find what
is needed more quickly.

This commit also removes the summary attached to the SEE ALSO entry
for difftool, to avoid making the SEE ALSO list too verbose.  If the
reader wants a summary of the commands referred to, she can always
look to the top of the named pages or to the table of contents on the
main git(1) page.

Suggested-by: Goswin von Brederlow <goswin-v-b@web.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: diff can compare blobs
Jonathan Nieder [Mon, 11 Oct 2010 16:04:08 +0000 (11:04 -0500)]
Documentation: diff can compare blobs

Meanwhile, there is no plumbing command to compare two blobs.
Strange.

Reported-by: Yann Dirson <dirson@bertin.fr>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: gitrevisions is in section 7
Jonathan Nieder [Mon, 11 Oct 2010 16:03:32 +0000 (11:03 -0500)]
Documentation: gitrevisions is in section 7

Fix references to gitrevisions(1) in the manual pages and HTML
documentation.

In practice, this will not matter much unless someone tries to use a
hard copy of the git reference manual.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorev-list: handle %x00 NUL in user format
Jeff King [Thu, 7 Oct 2010 18:25:43 +0000 (14:25 -0400)]
rev-list: handle %x00 NUL in user format

The code paths for showing commits in "git log" and "git
rev-list --graph" correctly handle embedded NULs by looking
only at the resulting strbuf's length, and never treating it
as a C string. The code path for regular rev-list, however,
used printf("%s"), which resulted in truncated output. This
patch uses fwrite instead, like the --graph code path.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosubmodule sync: Update "submodule.<name>.url" for empty directories
Andreas Köhler [Fri, 8 Oct 2010 01:07:48 +0000 (03:07 +0200)]
submodule sync: Update "submodule.<name>.url" for empty directories

If a submodule directory has not been filled by "git submodule update"
yet, then "git submodule sync" must still update the super-project's
configuration for submodule.<name>.url.

This situation occurs when switching between branches with a module from
different urls and other branches without the submodule.

Signed-off-by: Andreas Köhler <andi5.py@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoapply: Recognize epoch timestamps with : in the timezone
Anders Kaseorg [Wed, 29 Sep 2010 20:49:49 +0000 (16:49 -0400)]
apply: Recognize epoch timestamps with : in the timezone

Some patches have a timezone formatted like ‘-08:00’ instead of
‘-0800’ (e.g. http://lwn.net/Articles/131729/), so git apply would
fail to recognize the epoch timestamp of deleted files and would
create empty files instead.  Teach it to support both formats, and add
a test case.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocompletion: Support the DWIM mode for git checkout
Kevin Ballard [Tue, 12 Oct 2010 21:38:12 +0000 (14:38 -0700)]
completion: Support the DWIM mode for git checkout

Ever since commit 70c9ac2 (DWIM: "git checkout frotz" to "git checkout
-b frotz origin/frotz"), git checkout has supported a DWIM mode where
it creates a local tracking branch for a remote branch if just the name
of the remote branch is specified on the command-line and only one remote
has a branch with that name. Teach the bash completion script to understand
this DWIM mode and provide such remote-tracking branch names as possible
completions.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofast-import: Allow filemodify to set the root
David Barr [Sun, 10 Oct 2010 03:30:15 +0000 (14:30 +1100)]
fast-import: Allow filemodify to set the root

v1.7.3-rc0~75^2 (Teach fast-import to import subtrees named by tree id,
2010-06-30) has a shortcoming - it doesn't allow the root to be set.
Extend this behaviour by allowing the root to be referenced as the
empty path, "".

For a command (like filter-branch --subdirectory-filter) that wants
to commit a lot of trees that already exist in the object db, writing
undeltified objects as loose files only to repack them later can
involve a significant amount of overhead.
(23% slow-down observed on Linux 2.6.35, worse on Mac OS X 10.6)

Fortunately we have fast-import (which is one of the only git commands
that will write to a pack directly) but there is not an advertised way
to tell fast-import to commit a given tree without unpacking it.

This patch changes that, by allowing

M 040000 <tree id> ""

as a filemodify line in a commit to reset to a particular tree without
any need to parse it.  For example,

M 040000 4b825dc642cb6eb9a060e54bf8d69288fbee4904 ""

is a synonym for the deleteall command and the fast-import equivalent of

git read-tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904

Signed-off-by: David Barr <david.barr@cordelta.com>
Commit-message-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Tested-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobash: support pretty format aliases
SZEDER Gábor [Sun, 10 Oct 2010 22:06:22 +0000 (00:06 +0200)]
bash: support pretty format aliases

Users can have their own pretty format aliases since 8028184 (pretty:
add aliases for pretty formats, 2010-05-02), so let's offer those
after '--pretty=' and '--format=' for 'log' and 'show', too.

Similar to the completion of aliases, this will invoke 'git config'
each time pretty aliases needs to be completed, so changes in pretty.*
configuration will be reflected immediately.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobash: support more 'git notes' subcommands and their options
SZEDER Gábor [Sun, 10 Oct 2010 21:43:33 +0000 (23:43 +0200)]
bash: support more 'git notes' subcommands and their options

The current completion function for 'git notes' only supported the
'edit' and 'show' subcommands and none of their options.  This patch
adds support for all missing subcommands, options, and their arguments
(files or refs), if any.

The code responsible for completing subcommand looks different
compared to the completion functions of other git commands with
subcommands.  This is because of the '--ref <notes-ref>' option which
comes before the subcommand (i.e. git notes --ref <notes-ref> add).

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobash: not all 'git bisect' subcommands make sense when not bisecting
SZEDER Gábor [Sun, 10 Oct 2010 21:39:34 +0000 (23:39 +0200)]
bash: not all 'git bisect' subcommands make sense when not bisecting

... but only 'start' and 'replay'.  The other commands will either
error out or offer to start bisecting for the user.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobash: offer refs for 'git bisect start'
SZEDER Gábor [Sun, 10 Oct 2010 21:39:33 +0000 (23:39 +0200)]
bash: offer refs for 'git bisect start'

The completion script only offered path completion after 'git bisect
start', although bad and good refs could also be specified before the
doubledash.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobisect: check for mandatory argument of 'bisect replay'
SZEDER Gábor [Sun, 10 Oct 2010 21:48:58 +0000 (23:48 +0200)]
bisect: check for mandatory argument of 'bisect replay'

'git bisect replay' has a mandatory logfile argument, but the current
implementation doesn't check whether the user has specified one.  When
the user omits the logfile argument, this leads to the following
unhelpful error message:

  cannot read  for replaying

So, check for the mandatory argument first, and provide a more
meaningful error message when it is omitted.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobisect: improve error msg of 'bisect reset' when original HEAD is deleted
SZEDER Gábor [Sun, 10 Oct 2010 21:48:57 +0000 (23:48 +0200)]
bisect: improve error msg of 'bisect reset' when original HEAD is deleted

'git bisect reset' (without the optional <commit> argument) returns to
the original HEAD from where the bisection was started.  However,
when, for whatever reason, the user deleted the original HEAD before
invoking 'git bisect reset', then all he gets is an error message from
'git checkout':

  fatal: invalid reference: somebranch

Let's try to be more helpful with an error message better describing
what went wrong and a suggestion about how to resolve the situation:

  Could not check out original HEAD 'somebranch'. Try 'git bisect reset <commit>'.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>