Code

git.git
15 years agoMerge branch 'gt/maint-1.6.1-utf8-width' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:46:35 +0000 (21:46 -0700)]
Merge branch 'gt/maint-1.6.1-utf8-width' into maint-1.6.1

* gt/maint-1.6.1-utf8-width:
  builtin-blame.c: Use utf8_strwidth for author's names
  utf8: add utf8_strwidth()

15 years agoMerge branch 'js/maint-1.6.1-remote-remove-mirror' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:56 +0000 (21:45 -0700)]
Merge branch 'js/maint-1.6.1-remote-remove-mirror' into maint-1.6.1

* js/maint-1.6.1-remote-remove-mirror:
  builtin-remote: make rm operation safer in mirrored repository
  builtin-remote: make rm() use properly named variable to hold return value

15 years agoMerge branch 'ek/maint-1.6.1-filter-branch-bare' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:21 +0000 (21:45 -0700)]
Merge branch 'ek/maint-1.6.1-filter-branch-bare' into maint-1.6.1

* ek/maint-1.6.1-filter-branch-bare:
  filter-branch: Fix fatal error on bare repositories

15 years agoMerge branch 'jc/maint-1.6.1-add-u-remove-conflicted' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:14 +0000 (21:45 -0700)]
Merge branch 'jc/maint-1.6.1-add-u-remove-conflicted' into maint-1.6.1

* jc/maint-1.6.1-add-u-remove-conflicted:
  add -u: do not fail to resolve a path as deleted

15 years agoMerge branch 'js/maint-1.6.1-rebase-i-submodule' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:02 +0000 (21:45 -0700)]
Merge branch 'js/maint-1.6.1-rebase-i-submodule' into maint-1.6.1

* js/maint-1.6.1-rebase-i-submodule:
  Fix submodule squashing into unrelated commit
  rebase -i squashes submodule changes into unrelated commit

15 years agoMerge branch 'jc/maint-1.6.1-allow-uninteresting-missing' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:44:48 +0000 (21:44 -0700)]
Merge branch 'jc/maint-1.6.1-allow-uninteresting-missing' into maint-1.6.1

* jc/maint-1.6.1-allow-uninteresting-missing:
  revision traversal: allow UNINTERESTING objects to be missing

15 years agoMerge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:44:00 +0000 (21:44 -0700)]
Merge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.1

* ks/maint-1.6.0-mailinfo-folded:
  mailinfo: tests for RFC2047 examples
  mailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'
  mailinfo: 'From:' header should be unfold as well
  mailinfo: correctly handle multiline 'Subject:' header

15 years agoMerge branch 'jk/maint-1.6.1-cleanup-after-exec-failure' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:43:38 +0000 (21:43 -0700)]
Merge branch 'jk/maint-1.6.1-cleanup-after-exec-failure' into maint-1.6.1

* jk/maint-1.6.1-cleanup-after-exec-failure:
  git: use run_command() to execute dashed externals
  run_command(): help callers distinguish errors
  run_command(): handle missing command errors more gracefully
  git: s/run_command/run_builtin/

15 years agobuiltin-revert.c: release index lock when cherry-picking an empty commit
Chris Johnsen [Sat, 7 Mar 2009 09:30:51 +0000 (03:30 -0600)]
builtin-revert.c: release index lock when cherry-picking an empty commit

When a cherry-pick of an empty commit is done, release the lock
held on the index.

The fix is the same as was applied to similar code in 4271666046.

Signed-off-by: Chris Johnsen <chris_johnsen@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: minor grammatical fixes.
David J. Mellor [Sat, 28 Feb 2009 21:12:59 +0000 (13:12 -0800)]
Documentation: minor grammatical fixes.

Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Sat, 28 Feb 2009 22:05:09 +0000 (14:05 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  added missing backtick in git-apply.txt

15 years agoadded missing backtick in git-apply.txt
Danijel Tasov [Sat, 28 Feb 2009 20:03:54 +0000 (21:03 +0100)]
added missing backtick in git-apply.txt

Signed-off-by: Danijel Tasov <dt@korn.shell.la>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMore friendly message when locking the index fails.
Matthieu Moy [Thu, 19 Feb 2009 12:54:18 +0000 (13:54 +0100)]
More friendly message when locking the index fails.

Just saying that index.lock exists doesn't tell the user _what_ to do
to fix the problem. We should give an indication that it's normally
safe to delete index.lock after making sure git isn't running here.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocument git blame --reverse.
Matthieu Moy [Thu, 19 Feb 2009 12:34:48 +0000 (13:34 +0100)]
Document git blame --reverse.

This was introduced in 85af7929ee125385c2771fa4eaccfa2f29dc63c9 but
not documented outside the commit message.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: Note file formats send-email accepts
Todd Zullinger [Thu, 19 Feb 2009 03:51:06 +0000 (22:51 -0500)]
Documentation: Note file formats send-email accepts

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: fix "export var=val"
Junio C Hamano [Wed, 18 Feb 2009 19:17:27 +0000 (11:17 -0800)]
tests: fix "export var=val"

Some shells do not like "export var=val"; the right way to write
it is to do an assignment and then export just the variable name.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSkip timestamp differences for diff --no-index
Michael Spang [Wed, 18 Feb 2009 06:48:06 +0000 (01:48 -0500)]
Skip timestamp differences for diff --no-index

We display empty diffs for files whose timestamps have changed.
Usually, refreshing the index makes those empty diffs go away.
However, when not using the index they are not very useful and
there is no option to suppress them.

This forces on the skip_stat_unmatch option for diff --no-index,
suppressing any empty diffs. This option is also used for diffs
against the index when "diff.autorefreshindex" is set, but that
option does not apply to diff --no-index.

Signed-off-by: Michael Spang <mspang@uwaterloo.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation/git-push: --all, --mirror, --tags can not be combined
Gerrit Pape [Tue, 17 Feb 2009 09:25:02 +0000 (09:25 +0000)]
Documentation/git-push: --all, --mirror, --tags can not be combined

While b259f09 made git-push output a better error message for 'git-push
--all --tags', this commit fixes the synopsis in the documentation.

Inconsistency spotted and fix suggested by Jari Aalto through
 http://bugs.debian.org/502567

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoPrepare for 1.6.1.4.
Junio C Hamano [Thu, 12 Feb 2009 02:44:03 +0000 (18:44 -0800)]
Prepare for 1.6.1.4.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Thu, 12 Feb 2009 02:32:37 +0000 (18:32 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  Make repack less likely to corrupt repository
  fast-export: ensure we traverse commits in topological order
  Clear the delta base cache if a pack is rebuilt

15 years agoMake repack less likely to corrupt repository
Junio C Hamano [Tue, 10 Feb 2009 20:16:31 +0000 (12:16 -0800)]
Make repack less likely to corrupt repository

Some platforms refuse to rename a file that is open.  When repacking an
already packed repository without adding any new object, the resulting
pack will contain the same set of objects as an existing pack, and on such
platforms, a newly created packfile cannot replace the existing one.

The logic detected this issue but did not try hard enough to recover from
it.  Especially because the files that needs renaming come in pairs, there
potentially are different failure modes that one can be renamed but the
others cannot.  Asking manual recovery to end users were error prone.

This patch tries to make it more robust by first making sure all the
existing files that need to be renamed have been renamed before
continuing, and attempts to roll back if some failed to rename.

This is based on an initial patch by Robin Rosenberg.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofast-export: ensure we traverse commits in topological order
Elijah Newren [Wed, 11 Feb 2009 06:03:53 +0000 (23:03 -0700)]
fast-export: ensure we traverse commits in topological order

fast-export will only list as parents those commits which have already
been traversed (making it appear as if merges have been squashed if not
all parents have been traversed).  To avoid this silent squashing of
merge commits, we request commits in topological order.

Signed-off-by: Elijah Newren <newren@gmail.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoClear the delta base cache if a pack is rebuilt
Shawn O. Pearce [Wed, 11 Feb 2009 18:15:30 +0000 (10:15 -0800)]
Clear the delta base cache if a pack is rebuilt

There is some risk that re-opening a regenerated pack file with
different offsets could leave stale entries within the delta base
cache that could be matched up against other objects using the same
"struct packed_git*" and pack offset.

Throwing away the entire delta base cache in this case is safer,
as we don't have to worry about a recycled "struct packed_git*"
matching to the wrong base object, resulting in delta apply
errors while unpacking an object.

Suggested-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.5.6' into maint
Junio C Hamano [Wed, 11 Feb 2009 10:00:07 +0000 (02:00 -0800)]
Merge branch 'maint-1.5.6' into maint

* maint-1.5.6:
  revision traversal and pack: notice and die on missing commit

15 years agoMerge branch 'maint-1.5.5' into maint-1.5.6
Junio C Hamano [Wed, 11 Feb 2009 09:41:22 +0000 (01:41 -0800)]
Merge branch 'maint-1.5.5' into maint-1.5.6

* maint-1.5.5:
  revision traversal and pack: notice and die on missing commit

Conflicts:
revision.c

15 years agoMerge branch 'maint-1.5.4' into maint-1.5.5
Junio C Hamano [Wed, 11 Feb 2009 09:40:12 +0000 (01:40 -0800)]
Merge branch 'maint-1.5.4' into maint-1.5.5

* maint-1.5.4:
  revision traversal and pack: notice and die on missing commit

15 years agorevision traversal and pack: notice and die on missing commit
Junio C Hamano [Wed, 11 Feb 2009 09:27:43 +0000 (01:27 -0800)]
revision traversal and pack: notice and die on missing commit

cc0e6c5 (Handle return code of parse_commit in revision machinery,
2007-05-04) attempted to tighten error checking in the revision machinery,
but it wasn't enough.  When get_revision_1() was asked for the next commit
to return, it tries to read and simplify the parents of the commit to be
returned, but an error while doing so was silently ignored and reported as
a truncated history to the caller instead.

This resulted in an early end of "git log" output or a pack that lacks
older commits from "git pack-objects", without any error indication in the
exit status from these commands, even though the underlying parse_commit()
issues an error message to the end user.

Note that the codepath in add_parents_list() that paints parents of an
UNINTERESTING commit UNINTERESTING silently ignores the error when
parse_commit() fails; this is deliberate and in line with aeeae1b
(revision traversal: allow UNINTERESTING objects to be missing,
2009-01-27).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Tue, 10 Feb 2009 23:32:26 +0000 (15:32 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  Clear the delta base cache during fast-import checkpoint

15 years agoClear the delta base cache during fast-import checkpoint
Shawn O. Pearce [Tue, 10 Feb 2009 21:36:12 +0000 (13:36 -0800)]
Clear the delta base cache during fast-import checkpoint

Otherwise we may reuse the same memory address for a totally
different "struct packed_git", and a previously cached object from
the prior occupant might be returned when trying to unpack an object
from the new pack.

Found-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: add $prevent_xss option to prevent XSS by repository content
Matt McCutchen [Sun, 8 Feb 2009 00:00:09 +0000 (19:00 -0500)]
gitweb: add $prevent_xss option to prevent XSS by repository content

Add a gitweb configuration variable $prevent_xss that disables features
to prevent content in repositories from launching cross-site scripting
(XSS) attacks in the gitweb domain.  Currently, this option makes gitweb
ignore README.html (a better solution may be worked out in the future)
and serve a blob_plain file of an untrusted type with
"Content-Disposition: attachment", which tells the browser not to show
the file at its original URL.

The XSS prevention is currently off by default.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorev-list: fix showing distance when using --bisect-all
Christian Couder [Sun, 8 Feb 2009 14:54:47 +0000 (15:54 +0100)]
rev-list: fix showing distance when using --bisect-all

Before d467a52 ("Make '--decorate' set an explicit 'show_decorations'
flag", Nov 3 2008), commit decorations were shown whenever they exist, and
distances stored in them by "git rev-list --bisect-all" were automatically
shown.  d467a52 changed the rule so that commit decorations are not shown
unless rev_info explicitly asks to, with its show_decorations bit, but
forgot that the ones "git rev-list --bisect-all" adds need to be shown.

This patch fixes this old breakage.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.1.3 v1.6.1.3
Junio C Hamano [Sat, 7 Feb 2009 08:51:47 +0000 (00:51 -0800)]
GIT 1.6.1.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Fri, 6 Feb 2009 03:38:58 +0000 (19:38 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  Fixed broken git help -w when installing from RPM

15 years agoMerge branch 'jc/maint-apply-fix' into maint
Junio C Hamano [Fri, 6 Feb 2009 02:06:11 +0000 (18:06 -0800)]
Merge branch 'jc/maint-apply-fix' into maint

* jc/maint-apply-fix:
  builtin-apply.c: do not set bogus mode in check_preimage() for deleted path

15 years agoMerge branch 'am/maint-push-doc' into maint
Junio C Hamano [Fri, 6 Feb 2009 02:06:03 +0000 (18:06 -0800)]
Merge branch 'am/maint-push-doc' into maint

* am/maint-push-doc:
  Documentation: rework src/dst description in git push
  Documentation: more git push examples
  Documentation: simplify refspec format description

15 years agoMerge branch 'sg/maint-gitdir-in-subdir' into maint
Junio C Hamano [Fri, 6 Feb 2009 02:05:43 +0000 (18:05 -0800)]
Merge branch 'sg/maint-gitdir-in-subdir' into maint

* sg/maint-gitdir-in-subdir:
  Fix gitdir detection when in subdir of gitdir

15 years agoMerge branch 'lt/maint-wrap-zlib' into maint
Junio C Hamano [Fri, 6 Feb 2009 02:01:00 +0000 (18:01 -0800)]
Merge branch 'lt/maint-wrap-zlib' into maint

* lt/maint-wrap-zlib:
  Wrap inflate and other zlib routines for better error reporting

Conflicts:
http-push.c
http-walker.c
sha1_file.c

15 years agoMerge branch 'jc/maint-split-diff-metainfo' into maint
Junio C Hamano [Fri, 6 Feb 2009 01:54:17 +0000 (17:54 -0800)]
Merge branch 'jc/maint-split-diff-metainfo' into maint

* jc/maint-split-diff-metainfo:
  diff.c: output correct index lines for a split diff

15 years agoMerge branch 'js/maint-all-implies-HEAD' into maint
Junio C Hamano [Fri, 6 Feb 2009 01:54:12 +0000 (17:54 -0800)]
Merge branch 'js/maint-all-implies-HEAD' into maint

* js/maint-all-implies-HEAD:
  bundle: allow the same ref to be given more than once
  revision walker: include a detached HEAD in --all

15 years agoMerge branch 'kc/maint-diff-bwi-fix' into maint
Junio C Hamano [Fri, 6 Feb 2009 01:52:22 +0000 (17:52 -0800)]
Merge branch 'kc/maint-diff-bwi-fix' into maint

* kc/maint-diff-bwi-fix:
  Fix combined use of whitespace ignore options to diff
  test more combinations of ignore-whitespace options to diff

15 years agoFixed broken git help -w when installing from RPM
David J. Mellor [Thu, 5 Feb 2009 04:14:29 +0000 (20:14 -0800)]
Fixed broken git help -w when installing from RPM

After the git-core package was renamed to git, git help -w was still looking
for files in /usr/share/doc/git-core-$VERSION instead of
/usr/share/doc/git-$VERSION.

Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-blame.c: Use utf8_strwidth for author's names
Geoffrey Thomas [Fri, 30 Jan 2009 09:41:29 +0000 (04:41 -0500)]
builtin-blame.c: Use utf8_strwidth for author's names

git blame misaligns output if a author's name has a differing display width and
strlen; for instance, an accented Latin letter that takes two bytes to encode
will cause the rest of the line to be shifted to the left by one. To fix this,
use utf8_strwidth instead of strlen (and compute the padding ourselves, since
printf doesn't know about UTF-8).

Signed-off-by: Geoffrey Thomas <geofft@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoutf8: add utf8_strwidth()
Geoffrey Thomas [Fri, 30 Jan 2009 09:41:28 +0000 (04:41 -0500)]
utf8: add utf8_strwidth()

I'm about to use this pattern more than once, so make it a common function.

Signed-off-by: Geoffrey Thomas <geofft@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agourls.txt: document optional port specification in git URLS
Stefan Naewe [Wed, 4 Feb 2009 20:49:35 +0000 (21:49 +0100)]
urls.txt: document optional port specification in git URLS

Signed-off-by: Stefan Naewe <stefan.naewe+git@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Wed, 4 Feb 2009 19:49:07 +0000 (11:49 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  builtin-mv.c: check for unversionned files before looking at the destination.
  Add a testcase for "git mv -f" on untracked files.
  Missing && in t/t7001.sh.

15 years agobuiltin-mv.c: check for unversionned files before looking at the destination.
Matthieu Moy [Wed, 4 Feb 2009 09:32:08 +0000 (10:32 +0100)]
builtin-mv.c: check for unversionned files before looking at the destination.

The previous code was failing in the case where one moves an
unversionned file to an existing destination, with mv -f: the
"existing destination" was checked first, and the error was cancelled
by the force flag.

We now check the unrecoverable error first, which fixes the bug.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd a testcase for "git mv -f" on untracked files.
Matthieu Moy [Wed, 4 Feb 2009 09:32:07 +0000 (10:32 +0100)]
Add a testcase for "git mv -f" on untracked files.

This currently fails with:
git: builtin-mv.c:217: cmd_mv: Assertion `pos >= 0' failed.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMissing && in t/t7001.sh.
Matthieu Moy [Wed, 4 Feb 2009 09:32:06 +0000 (10:32 +0100)]
Missing && in t/t7001.sh.

Without this, the exit status is only the one of the last line.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: make rm operation safer in mirrored repository
Jay Soffian [Wed, 4 Feb 2009 16:06:07 +0000 (11:06 -0500)]
builtin-remote: make rm operation safer in mirrored repository

"git remote rm <repo>" happily removes non-remote refs and their reflogs.
This may be okay if the repository truely is a mirror, but if the user
had done "git remote add --mirror <repo>" by accident and was just
undoing their mistake, then they are left in a situation that is
difficult to recover from.

After this commit, "git remote rm" skips over non-remote refs. The user
is advised on how remove branches using "git branch -d", which itself
has nice safety checks wrt to branch removal lacking from "git remote rm".
Non-remote non-branch refs are skipped silently.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Wed, 4 Feb 2009 07:50:09 +0000 (23:50 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  User-manual: "git stash <comment>" form is long gone
  add test-dump-cache-tree in Makefile
  fix typo in Documentation
  apply: fix access to an uninitialized mode variable, found by valgrind

15 years agoUser-manual: "git stash <comment>" form is long gone
William Pursell [Tue, 3 Feb 2009 22:41:14 +0000 (22:41 +0000)]
User-manual: "git stash <comment>" form is long gone

These days you must explicitly say "git stash save <comment>".

Signed-off-by: William Pursell <bill.pursell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd test-dump-cache-tree in Makefile
Guanqun Lu [Wed, 4 Feb 2009 21:00:41 +0000 (05:00 +0800)]
add test-dump-cache-tree in Makefile

5c5ba73 (Makefile: Use generic rule to build test programs,
2007-05-31) tried to use generic rule to build test programs, but it
misses the file 'dump-cache-tree.c', since its name is not prefixed by
'test-'.  This commit solves this little problem by renaming this file
instead of carrying out an explicit rule in Makefile.

Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofix typo in Documentation
Guanqun Lu [Wed, 4 Feb 2009 21:00:40 +0000 (05:00 +0800)]
fix typo in Documentation

Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoapply: fix access to an uninitialized mode variable, found by valgrind
Johannes Schindelin [Wed, 4 Feb 2009 01:50:15 +0000 (02:50 +0100)]
apply: fix access to an uninitialized mode variable, found by valgrind

When 'tpatch' was initialized successfully, st_mode was already taken
from the previous diff.  We should not try to override it with data
from an lstat() that was never called.

This is a companion patch to 7a07841(git-apply: handle a patch that
touches the same path more than once better).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofilter-branch: Fix fatal error on bare repositories
Eric Kidd [Tue, 3 Feb 2009 18:27:03 +0000 (13:27 -0500)]
filter-branch: Fix fatal error on bare repositories

When git filter-branch is run on a bare repository, it prints out a fatal
error message:

  $ git filter-branch branch
  Rewrite 476c4839280c219c2317376b661d9d95c1727fc3 (9/9)
  WARNING: Ref 'refs/heads/branch' is unchanged
  fatal: This operation must be run in a work tree

Note that this fatal error message doesn't prevent git filter-branch from
exiting successfully. (Why doesn't git filter-branch actually exit with an
error when a shell command fails? I'm not sure why it was designed this
way.)

This error message is caused by the following section of code at the end of
git-filter-branch.sh:

  if [ "$(is_bare_repository)" = false ]; then
          unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
          test -z "$ORIG_GIT_DIR" || {
                  GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR
          }
          ... elided ...
          git read-tree -u -m HEAD
  fi

The problem is the call to $(is_bare_repository), which is made before
GIT_DIR and GIT_WORK_TREE are restored.  This call always returns "false",
even when we're running in a bare repository.  But this means that we will
attempt to call 'git read-tree' even in a bare repository, which will fail
and print an error.

This patch modifies git-filter-branch.sh to restore the original
environment variables before trying to call is_bare_repository.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: make rm() use properly named variable to hold return value
Jay Soffian [Tue, 3 Feb 2009 17:51:12 +0000 (12:51 -0500)]
builtin-remote: make rm() use properly named variable to hold return value

"i" is a loop counter and should not be used to hold a return value; use
"result" instead which is consistent with the rest of builtin-remote.c.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Tue, 3 Feb 2009 08:32:29 +0000 (00:32 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  grep: pass -I (ignore binary) down to external grep

15 years agogrep: pass -I (ignore binary) down to external grep
Junio C Hamano [Mon, 2 Feb 2009 18:58:20 +0000 (10:58 -0800)]
grep: pass -I (ignore binary) down to external grep

We forgot to pass this option to the external grep process.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Sun, 1 Feb 2009 01:42:17 +0000 (17:42 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  merge: fix out-of-bounds memory access

15 years agomerge: fix out-of-bounds memory access
René Scharfe [Sat, 31 Jan 2009 14:39:10 +0000 (15:39 +0100)]
merge: fix out-of-bounds memory access

The parameter n of unpack_callback() can have a value of up to
MAX_UNPACK_TREES.  The check at the top of unpack_trees() (its only
(indirect) caller) makes sure it cannot exceed this limit.

unpack_callback() passes it and the array src to unpack_nondirectories(),
which has this loop:

for (i = 0; i < n; i++) {
/* ... */
src[i + o->merge] = o->df_conflict_entry;

o->merge can be 0 or 1, so unpack_nondirectories() potentially accesses
the array src at index MAX_UNPACK_TREES.  This patch makes it big enough.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.1.2 v1.6.1.2
Junio C Hamano [Thu, 29 Jan 2009 08:12:52 +0000 (00:12 -0800)]
GIT 1.6.1.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/maint-format-patch-o-relative' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:56:13 +0000 (23:56 -0800)]
Merge branch 'jc/maint-format-patch-o-relative' into maint

* jc/maint-format-patch-o-relative:
  Teach format-patch to handle output directory relative to cwd

Conflicts:
t/t4014-format-patch.sh

15 years agoMerge branch 'bs/maint-rename-populate-filespec' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:42:57 +0000 (23:42 -0800)]
Merge branch 'bs/maint-rename-populate-filespec' into maint

* bs/maint-rename-populate-filespec:
  Rename detection: Avoid repeated filespec population

15 years agoMerge branch 'mh/maint-commit-color-status' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:42:53 +0000 (23:42 -0800)]
Merge branch 'mh/maint-commit-color-status' into maint

* mh/maint-commit-color-status:
  git-status -v: color diff output when color.ui is set
  git-commit: color status output when color.ui is set

15 years agoMerge branch 'nd/grep-assume-unchanged' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:42:41 +0000 (23:42 -0800)]
Merge branch 'nd/grep-assume-unchanged' into maint

* nd/grep-assume-unchanged:
  grep: grep cache entries if they are "assume unchanged"
  grep: support --no-ext-grep to test builtin grep

15 years agoMerge branch 'jc/maint-ls-tree' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:42:15 +0000 (23:42 -0800)]
Merge branch 'jc/maint-ls-tree' into maint

* jc/maint-ls-tree:
  Document git-ls-tree --full-tree
  ls-tree: add --full-tree option

15 years agoMerge branch 'np/no-loosen-prune-expire-now' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:42:10 +0000 (23:42 -0800)]
Merge branch 'np/no-loosen-prune-expire-now' into maint

* np/no-loosen-prune-expire-now:
  objects to be pruned immediately don't have to be loosened

15 years agoMerge branch 'mc/cd-p-pwd' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:41:56 +0000 (23:41 -0800)]
Merge branch 'mc/cd-p-pwd' into maint

* mc/cd-p-pwd:
  git-sh-setup: Fix scripts whose PWD is a symlink to a work-dir on OS X

15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Thu, 29 Jan 2009 07:41:28 +0000 (23:41 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  avoid 31-bit truncation in write_loose_object

15 years agoavoid 31-bit truncation in write_loose_object
Jeff King [Thu, 29 Jan 2009 05:56:34 +0000 (00:56 -0500)]
avoid 31-bit truncation in write_loose_object

The size of the content we are adding may be larger than
2.1G (i.e., "git add gigantic-file"). Most of the code-path
to do so uses size_t or unsigned long to record the size,
but write_loose_object uses a signed int.

On platforms where "int" is 32-bits (which includes x86_64
Linux platforms), we end up passing malloc a negative size.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd -u: do not fail to resolve a path as deleted
Junio C Hamano [Wed, 28 Jan 2009 22:24:53 +0000 (14:24 -0800)]
add -u: do not fail to resolve a path as deleted

After you resolve a conflicted merge to remove the path, "git add -u"
failed to record the removal.  Instead it errored out by saying that the
removed path is not found in the work tree, but that is what the user
already knows, and the wanted to record the removal as the resolution,
so the error does not make sense.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-apply.c: do not set bogus mode in check_preimage() for deleted path
Junio C Hamano [Mon, 26 Jan 2009 07:41:26 +0000 (23:41 -0800)]
builtin-apply.c: do not set bogus mode in check_preimage() for deleted path

If it is deleted, it is deleted.  Do not set the current mode to it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomailinfo: tests for RFC2047 examples
Kirill Smelkov [Mon, 12 Jan 2009 22:21:04 +0000 (01:21 +0300)]
mailinfo: tests for RFC2047 examples

Also as suggested by Junio, in order to try to catch other MIME
problems, test cases from the "8. Examples" section of RFC2047 are added
to t5100 testsuite as well.

Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
15 years agomailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'
Kirill Smelkov [Tue, 13 Jan 2009 09:33:48 +0000 (12:33 +0300)]
mailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
15 years agoFix submodule squashing into unrelated commit
Johannes Schindelin [Tue, 27 Jan 2009 11:42:31 +0000 (12:42 +0100)]
Fix submodule squashing into unrelated commit

Actually, I think the issue is pretty independent of submodules; when
"git commit" gets an empty parameter, it misinterprets it as a file.

So avoid passing an empty parameter to "git commit".

Actually, this is a nice cleanup, as MSG_FILE and EDIT_COMMIT were mutually
exclusive; use one variable instead

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorebase -i squashes submodule changes into unrelated commit
Junio C Hamano [Tue, 27 Jan 2009 09:07:31 +0000 (01:07 -0800)]
rebase -i squashes submodule changes into unrelated commit

Attempting to rebase three-commit series (two regular changes, followed by
one commit that changes what commit is bound for a submodule path) to
squash the first two results in a failure; not just the first two commits
squashed, but the change to the submodule is also included in the result.

This failure causes the subsequent step to "pick" the change that actually
changes the submodule to be applied, because there is no change left to be
applied.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit: use run_command() to execute dashed externals
Jeff King [Wed, 28 Jan 2009 07:38:14 +0000 (02:38 -0500)]
git: use run_command() to execute dashed externals

We used to simply try calling execvp(); if it succeeded, then we were done
and the new program was running. If it didn't, then we knew that it wasn't
a valid command.

Unfortunately, this interacted badly with the new pager handling. Now that
git remains the parent process and the pager is spawned, git has to hang
around until the pager is finished. We install an atexit handler to do
this, but that handler never gets called if we successfully run execvp.

You could see this behavior by running any dashed external using a pager
(e.g., "git -p stash list"). The command finishes running, but the pager
is still going. In the case of less, it then gets an error reading from
the terminal and exits, potentially leaving the terminal in a broken state
(and not showing the output).

This patch just uses run_command() to try running the dashed external. The
parent git process then waits for the external process to complete and
then handles the pager cleanup as it would for an internal command.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorun_command(): help callers distinguish errors
Jeff King [Wed, 28 Jan 2009 07:36:39 +0000 (02:36 -0500)]
run_command(): help callers distinguish errors

run_command() returns a single integer specifying either an
error code or the exit status of the spawned program. The
only way to tell the difference is that the error codes are
outside of the allowed range of exit status values.

Rather than make each caller implement the test against a
magic limit, let's provide a macro.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorun_command(): handle missing command errors more gracefully
Jeff King [Wed, 28 Jan 2009 07:35:33 +0000 (02:35 -0500)]
run_command(): handle missing command errors more gracefully

When run_command() was asked to run a non-existant command, its behavior
varied depending on the platform:

  - on POSIX systems, we would fork, and then after the execvp call
    failed, we could call die(), which prints a message to stderr and
    exits with code 128.

  - on Windows, we do a PATH lookup, realize the program isn't there, and
    then return ERR_RUN_COMMAND_FORK

The goal of this patch is to make it clear to callers that the specific
error was a missing command. To do this, we will return the error code
ERR_RUN_COMMAND_EXEC, which is already defined in run-command.h, checked
for in several places, but never actually gets set.

The new behavior is:

  - on POSIX systems, we exit the forked process with code 127 (the same
    as the shell uses to report missing commands). The parent process
    recognizes this code and returns an EXEC error. The stderr message is
    silenced, since the caller may be speculatively trying to run a
    command. Instead, we use trace_printf so that somebody interested in
    debugging can see the error that occured.

  - on Windows, we check errno, which is already set correctly by
    mingw_spawnvpe, and report an EXEC error instead of a FORK error

Thus it is safe to speculatively run a command:

  int r = run_command_v_opt(argv, 0);
  if (r == -ERR_RUN_COMMAND_EXEC)
  /* oops, it wasn't found; try something else */
  else
  /* we failed for some other reason, error is in r */

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit: s/run_command/run_builtin/
Jeff King [Wed, 28 Jan 2009 07:33:53 +0000 (02:33 -0500)]
git: s/run_command/run_builtin/

There is a static function called run_command which
conflicts with the library function in run-command.c; this
isn't a problem currently, but prevents including
run-command.h in git.c.

This patch just renames the static function to something
more specific and non-conflicting.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorevision traversal: allow UNINTERESTING objects to be missing
Junio C Hamano [Wed, 28 Jan 2009 07:19:30 +0000 (23:19 -0800)]
revision traversal: allow UNINTERESTING objects to be missing

Most of the existing codepaths were meant to treat missing uninteresting
objects to be a silently ignored non-error, but there were a few places
in handle_commit() and add_parents_to_list(), which are two key functions
in the revision traversal machinery, that cared:

 - When a tag refers to an object that we do not have, we barfed.  We
   ignore such a tag if it is painted as UNINTERESTING with this change.

 - When digging deeper into the ancestry chain of a commit that is already
   painted as UNINTERESTING, in order to paint its parents UNINTERESTING,
   we barfed if parse_parent() for a parent commit object failed.  We can
   ignore such a parent commit object.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosend-pack: do not send unknown object name from ".have" to pack-objects
Junio C Hamano [Wed, 28 Jan 2009 04:21:31 +0000 (20:21 -0800)]
send-pack: do not send unknown object name from ".have" to pack-objects

v1.6.1 introduced ".have" extension to the protocol to allow the receiving
side to advertise objects that are reachable from refs in the repositories
it borrows from.  This was meant to be used by the sending side to avoid
sending such objects; they are already available through the alternates
mechanism.

The client side implementation in v1.6.1, which was introduced with
40c155f (push: prepare sender to receive extended ref information from the
receiver, 2008-09-09) aka v1.6.1-rc1~203^2~1, were faulty in that it did
not consider the possiblity that the repository receiver borrows from
might have objects it does not know about.

This fixes it by refraining from passing missing commits to underlying
pack-objects.  Revision machinery may need to be tightened further to
treat missing uninteresting objects as non-error events, but this is an
obvious and safe fix for a maintenance release that is almost good enough.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Tue, 27 Jan 2009 23:23:46 +0000 (15:23 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  test-path-utils: Fix off by one, found by valgrind
  get_sha1_basic(): fix invalid memory access, found by valgrind

15 years agotest-path-utils: Fix off by one, found by valgrind
Johannes Schindelin [Tue, 27 Jan 2009 23:07:36 +0000 (00:07 +0100)]
test-path-utils: Fix off by one, found by valgrind

When normalizing an absolute path, we might have to add a slash _and_ a
NUL to the buffer, so the buffer was one too small.

Let's just future proof the code and alloc PATH_MAX + 1 bytes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoget_sha1_basic(): fix invalid memory access, found by valgrind
Johannes Schindelin [Tue, 27 Jan 2009 23:07:46 +0000 (00:07 +0100)]
get_sha1_basic(): fix invalid memory access, found by valgrind

When get_sha1_basic() is passed a buffer of len 0, it should not
check if buf[len-1] is a curly bracket.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/maint-1.6.0-split-diff-metainfo' into jc/maint-split-diff-metainfo
Junio C Hamano [Tue, 27 Jan 2009 09:08:02 +0000 (01:08 -0800)]
Merge branch 'jc/maint-1.6.0-split-diff-metainfo' into jc/maint-split-diff-metainfo

This is an evil merge, as a test added since 1.6.0 expects an incorrect
behaviour the merged commit fixes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff.c: output correct index lines for a split diff
Junio C Hamano [Mon, 26 Jan 2009 08:08:24 +0000 (00:08 -0800)]
diff.c: output correct index lines for a split diff

A patch that changes the filetype (e.g. regular file to symlink) of a path
must be split into a deletion event followed by a creation event, which
means that we need to have two independent metainfo lines for each.
However, the code reused the single set of metainfo lines.

As the blob object names recorded on the index lines are usually not used
nor validated on the receiving end, this is not an issue with normal use
of the resulting patch.  However, when accepting a binary patch to delete
a blob, git-apply verified that the postimage blob object name on the
index line is 0{40}, hence a patch that deletes a regular file blob that
records binary contents to create a blob with different filetype (e.g. a
symbolic link) failed to apply.  "git am -3" also uses the blob object
names recorded on the index line, so it would also misbehave when
synthesizing a preimage tree.

This moves the code to generate metainfo lines around, so that two
independent sets of metainfo lines are used for the split halves.

Additional tests by Jeff King.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: rework src/dst description in git push
Anders Melchiorsen [Sun, 25 Jan 2009 23:45:33 +0000 (00:45 +0100)]
Documentation: rework src/dst description in git push

This tries to make the description of ref matching in git push easier
to read. Beauty is in the eye of the beholder, though.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: more git push examples
Anders Melchiorsen [Sun, 25 Jan 2009 23:45:32 +0000 (00:45 +0100)]
Documentation: more git push examples

Include examples of using HEAD. The order of examples
introduces new concepts one by one. This pushes the
example of deleting a ref to the end of the list.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: simplify refspec format description
Junio C Hamano [Mon, 26 Jan 2009 06:25:20 +0000 (22:25 -0800)]
Documentation: simplify refspec format description

The refspec format description was a mix of regexp and BNF, making it
very difficult to read. The format was also wrong: it did not show
that each part of a refspec is optional in different situations.

Rather than having a confusing grammar, just present the format in
informal prose.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.1.1 v1.6.1.1
Junio C Hamano [Sun, 25 Jan 2009 20:41:09 +0000 (12:41 -0800)]
GIT 1.6.1.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'cb/maint-unpack-trees-absense' into maint
Junio C Hamano [Sat, 24 Jan 2009 03:06:38 +0000 (19:06 -0800)]
Merge branch 'cb/maint-unpack-trees-absense' into maint

* cb/maint-unpack-trees-absense:
  unpack-trees: remove redundant path search in verify_absent
  unpack-trees: fix path search bug in verify_absent
  unpack-trees: handle failure in verify_absent

15 years agoMerge branch 'tr/maint-no-index-fixes' into maint
Junio C Hamano [Sat, 24 Jan 2009 03:04:48 +0000 (19:04 -0800)]
Merge branch 'tr/maint-no-index-fixes' into maint

* tr/maint-no-index-fixes:
  diff --no-index -q: fix endless loop
  diff --no-index: test for pager after option parsing
  diff: accept -- when using --no-index

15 years agoMerge branch 'rs/maint-shortlog-foldline' into maint
Junio C Hamano [Sat, 24 Jan 2009 03:03:50 +0000 (19:03 -0800)]
Merge branch 'rs/maint-shortlog-foldline' into maint

* rs/maint-shortlog-foldline:
  shortlog: handle multi-line subjects like log --pretty=oneline et. al. do

15 years agoMerge branch 'pj/maint-ldflags' into maint
Junio C Hamano [Sat, 24 Jan 2009 03:02:58 +0000 (19:02 -0800)]
Merge branch 'pj/maint-ldflags' into maint

* pj/maint-ldflags:
  configure clobbers LDFLAGS

15 years agoMerge branch 'pb/maint-git-pm-false-dir' into maint
Junio C Hamano [Sat, 24 Jan 2009 03:02:41 +0000 (19:02 -0800)]
Merge branch 'pb/maint-git-pm-false-dir' into maint

* pb/maint-git-pm-false-dir:
  Git.pm: correctly handle directory name that evaluates to "false"

15 years agoMerge branch 'js/maint-bisect-gitk' into maint
Junio C Hamano [Sat, 24 Jan 2009 03:01:32 +0000 (19:01 -0800)]
Merge branch 'js/maint-bisect-gitk' into maint

* js/maint-bisect-gitk:
  bisect view: call gitk if Cygwin's SESSIONNAME variable is set

15 years agoMerge branch 'js/add-not-submodule' into maint
Junio C Hamano [Sat, 24 Jan 2009 03:00:43 +0000 (19:00 -0800)]
Merge branch 'js/add-not-submodule' into maint

* js/add-not-submodule:
  git add: do not add files from a submodule

15 years agoMerge branch 'jc/maint-format-patch' into maint
Junio C Hamano [Sat, 24 Jan 2009 02:59:59 +0000 (18:59 -0800)]
Merge branch 'jc/maint-format-patch' into maint

* jc/maint-format-patch:
  format-patch: show patch text for the root commit

15 years agoMerge branch 'am/maint-push-doc' into maint
Junio C Hamano [Sat, 24 Jan 2009 02:59:26 +0000 (18:59 -0800)]
Merge branch 'am/maint-push-doc' into maint

* am/maint-push-doc:
  Documentation: avoid using undefined parameters
  Documentation: mention branches rather than heads
  Documentation: remove a redundant elaboration
  Documentation: git push repository can also be a remote