Code

git.git
15 years agodo not segfault if make_cache_entry failed
Dmitry Potapov [Sun, 5 Oct 2008 02:14:40 +0000 (06:14 +0400)]
do not segfault if make_cache_entry failed

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agomake prefix_path() never return NULL
Dmitry Potapov [Sun, 5 Oct 2008 00:40:36 +0000 (04:40 +0400)]
make prefix_path() never return NULL

There are 9 places where prefix_path is called, and only in one of
them the returned pointer was checked to be non-zero and only to
call exit(128) as it is usually done by die(). In other 8 places,
the returned value was not checked and it caused SIGSEGV when a
path outside of the working tree was used. For instance, running
  git update-index --add /some/path/outside
caused SIGSEGV.

This patch changes prefix_path() to die if the path is outside of
the repository, so it never returns NULL.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agofix bogus "diff --git" header from "diff --no-index"
Linus Torvalds [Sun, 5 Oct 2008 19:35:15 +0000 (15:35 -0400)]
fix bogus "diff --git" header from "diff --no-index"

When "git diff --no-index" is given an absolute pathname, it
would generate a diff header with the absolute path
prepended by the prefix, like:

  diff --git a/dev/null b/foo

Not only is this nonsensical, and not only does it violate
the description of diffs given in git-diff(1), but it would
produce broken binary diffs. Unlike text diffs, the binary
diffs don't contain the filenames anywhere else, and so "git
apply" relies on this header to figure out the filename.

This patch just refuses to use an invalid name for anything
visible in the diff.

Now, this fixes the "git diff --no-index --binary a
/dev/null" kind of case (and we'll end up using "a" as the
basename), but some other insane cases are impossible to
handle. If you do

git diff --no-index --binary a /bin/echo

you'll still get a patch like

diff --git a/a b/bin/echo
old mode 100644
new mode 100755
index ...

and "git apply" will refuse to apply it for a couple of
reasons, and the diff is simply bogus.

And that, btw, is no longer a bug, I think. It's impossible
to know whethe the user meant for the patch to be a rename
or not. And as such, refusing to apply it because you don't
know what name you should use is probably _exactly_ the
right thing to do!

Original problem reported by Imre Deak. Test script and problem
description by Jeff King.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoFix fetch/clone --quiet when stdout is connected
Tuncer Ayaz [Sun, 5 Oct 2008 13:53:00 +0000 (15:53 +0200)]
Fix fetch/clone --quiet when stdout is connected

Fixes the `git clone --quiet` issue raised by Dave Jones in
http://marc.info/?l=git&m=121529226023180&w=2

With this simple patch applied we no longer see the following remote
messages as no-progress is correctly sent to the remote site:

  remote: Counting objects: 84102, done.
  remote: Compressing objects: 100% (24720/24720), done.
  remote: Total 84102 (delta 60949), reused 80810 (delta 57900)

Signed-off-by: Tuncer Ayaz <tuncer.ayaz@gmail.com>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agobuiltin-blame: Fix blame -C -C with submodules.
Alexander Gavrilov [Fri, 3 Oct 2008 16:23:50 +0000 (20:23 +0400)]
builtin-blame: Fix blame -C -C with submodules.

When performing copy detection, git-blame tries to
read gitlinks as blobs, which causes it to die.

This patch adds a check to skip them.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agobash: remove fetch, push, pull dashed form leftovers
SZEDER Gábor [Fri, 3 Oct 2008 19:34:49 +0000 (21:34 +0200)]
bash: remove fetch, push, pull dashed form leftovers

We don't provide complation for git-commands in dashed form anymore,
so there is no need to keep those cases.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Tested-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogitweb: Add path_info tests to t/t9500-gitweb-standalone-no-errors.sh
Jakub Narebski [Thu, 2 Oct 2008 14:52:20 +0000 (16:52 +0200)]
gitweb: Add path_info tests to t/t9500-gitweb-standalone-no-errors.sh

Note that those tests only check that there are no errors nor
warnings from Perl; they do not check for example if gitweb doesn't
use ARRAY(0x8e3cc20) instead of correct value in links, etc.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogitweb: Fix two 'uninitialized value' warnings in git_tree()
Jakub Narebski [Thu, 2 Oct 2008 14:50:04 +0000 (16:50 +0200)]
gitweb: Fix two 'uninitialized value' warnings in git_tree()

If we did try to access nonexistent directory or file, which means
that git_get_hash_by_path() returns `undef`, uninitialized $hash
variable was passed to 'open' call.  Now we fail early with "404 Not
Found - No such tree" error.  (If we try to access something which
does not resolve to tree-ish, for example a file / 'blob' object, the
error will be caught later, as "404 Not Found - Reading tree failed"
error).

If we tried to use 'tree' action without $file_name ('f' parameter)
set, which means either tree given by hash or a top tree (and we
currently cannot distinguish between those two cases), we cannot print
path breadcrumbs with git_print_page_path().  Fix this by moving call
to git_print_page_path() inside conditional.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoSolaris: Use OLD_ICONV to avoid compile warnings
David Soria Parra [Thu, 2 Oct 2008 00:08:47 +0000 (02:08 +0200)]
Solaris: Use OLD_ICONV to avoid compile warnings

Solaris systems use the old styled iconv(3) call and therefore
the OLD_ICONV variable should be set. Otherwise we get annoying compile
warnings.

Signed-off-by: David Soria Parra <dsp@php.net>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogitweb: remove PATH_INFO from $my_url and $my_uri
Giuseppe Bilotta [Mon, 29 Sep 2008 13:07:42 +0000 (15:07 +0200)]
gitweb: remove PATH_INFO from $my_url and $my_uri

This patch fixes PATH_INFO handling by removing the relevant part from
$my_url and $my_uri, thus making it unnecessary to specify them by hand
in the gitweb configuration.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoImprove git-log documentation wrt file filters
martin f. krafft [Tue, 30 Sep 2008 19:57:50 +0000 (21:57 +0200)]
Improve git-log documentation wrt file filters

The need for "--" in the git-log synopsis was previously unclear and
confusing. This patch makes it a little clearer.

Thanks to hyy <yiyihu@gmail.com> for his help.

[sp: Changed -- to \-- per prior commit e1ccf53.]

Signed-off-by: martin f. krafft <madduck@madduck.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoDocumentation: remove '\' in front of short options
SZEDER Gábor [Tue, 30 Sep 2008 17:27:10 +0000 (19:27 +0200)]
Documentation: remove '\' in front of short options

... because they show up in the man and html outputs.

This escaping is only needed for double dashes to be compatible with
older asciidoc versions;  see commit e1ccf53 ([PATCH] Escape asciidoc's
built-in em-dash replacement, 2005-09-12).

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogit-svn: call 'fatal' correctly in set-tree
Luc Heinrich [Mon, 29 Sep 2008 13:58:18 +0000 (15:58 +0200)]
git-svn: call 'fatal' correctly in set-tree

When doing a set-tree and there is no revision to commit to, the following unrelated error message is displayed: "Undefined subroutine &Git::SVN::fatal called at /opt/local/libexec/git-core/git-svn line 2575." The following patch fixes the problem and allows the real error message to be shown.

Signed-off-by: Luc Heinrich <luc@honk-honk.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoReplace svn.foo.org with svn.example.com in git-svn docs (RFC 2606)
Michael Prokop [Mon, 29 Sep 2008 23:01:34 +0000 (01:01 +0200)]
Replace svn.foo.org with svn.example.com in git-svn docs (RFC 2606)

foo.org is an existing domain, use RFC 2606 complying example.com instead
as used in other docs as well.

Signed-off-by: Michael Prokop <mika@grml.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agot0024: add executable permission
SZEDER Gábor [Tue, 30 Sep 2008 13:32:47 +0000 (15:32 +0200)]
t0024: add executable permission

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoMerge branch 'bc/maint-diff-hunk-header-fix' into maint
Shawn O. Pearce [Mon, 29 Sep 2008 17:23:19 +0000 (10:23 -0700)]
Merge branch 'bc/maint-diff-hunk-header-fix' into maint

* bc/maint-diff-hunk-header-fix:
  t4018-diff-funcname: test syntax of builtin xfuncname patterns
  diff hunk pattern: fix misconverted "\{" tex macro introducers
  diff: use extended regexp to find hunk headers
  diff.*.xfuncname which uses "extended" regex's for hunk header selection
  diff.c: associate a flag with each pattern and use it for compiling regex
  diff.c: return pattern entry pointer rather than just the hunk header pattern

Conflicts:
Documentation/gitattributes.txt

15 years agoMerge branch 'mg/maint-remote-fix' into maint
Shawn O. Pearce [Mon, 29 Sep 2008 16:39:53 +0000 (09:39 -0700)]
Merge branch 'mg/maint-remote-fix' into maint

* mg/maint-remote-fix:
  make "git remote" report multiple URLs

15 years agoClarify commit error message for unmerged files
Rafael Garcia-Suarez [Mon, 29 Sep 2008 16:04:41 +0000 (18:04 +0200)]
Clarify commit error message for unmerged files

Currently, trying to use git-commit with unmerged files in the index
will show the message "Error building trees", which can be a bit
obscure to the end user. This patch makes the error message clearer, and
consistent with what git-write-tree reports in a similar situation.

Signed-off-by: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoUse strchrnul() instead of strchr() plus manual workaround
Johan Herland [Sat, 27 Sep 2008 22:24:36 +0000 (00:24 +0200)]
Use strchrnul() instead of strchr() plus manual workaround

Also gets rid of a C++ comment.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoUse remove_path from dir.c instead of own implementation
Alex Riesen [Fri, 26 Sep 2008 22:59:14 +0000 (00:59 +0200)]
Use remove_path from dir.c instead of own implementation

Besides, it fixes a memleak (builtin-rm.c) and accidental change of
the input const argument (builtin-merge-recursive.c).

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoAdd remove_path: a function to remove as much as possible of a path
Alex Riesen [Fri, 26 Sep 2008 22:56:46 +0000 (00:56 +0200)]
Add remove_path: a function to remove as much as possible of a path

The function has two potential users which both managed to get wrong
their implementations (the one in builtin-rm.c one has a memleak, and
builtin-merge-recursive.c scribles over its const argument).

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogit-submodule: Fix "Unable to checkout" for the initial 'update'
Ping Yin [Fri, 26 Sep 2008 15:33:23 +0000 (23:33 +0800)]
git-submodule: Fix "Unable to checkout" for the initial 'update'

Since commit 55218("checkout: do not lose staged removal"), in
cmd_add/cmd_update, "git checkout <commit>" following
"git clone -n" may fail if <commit> is different from HEAD.

So Use "git checkout -f <commit>" to fix this.

Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoClarify how the user can satisfy stash's 'dirty state' check.
Stephen Haberman [Mon, 29 Sep 2008 09:12:04 +0000 (04:12 -0500)]
Clarify how the user can satisfy stash's 'dirty state' check.

Signed-off-by: Stephen Haberman <stephen@exigencecorp.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoRemove empty directories in recursive merge
Alex Riesen [Thu, 25 Sep 2008 20:12:45 +0000 (22:12 +0200)]
Remove empty directories in recursive merge

The code was actually supposed to do that, but was accidentally broken.
Noticed by Anders Melchiorsen.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoDocumentation: clarify the details of overriding LESS via core.pager
Chris Frey [Wed, 24 Sep 2008 23:21:28 +0000 (19:21 -0400)]
Documentation: clarify the details of overriding LESS via core.pager

The process of overriding the default LESS options using only
git-specific methods is rather obscure.  Show the end user how
to do it in a step-by-step manner.

Signed-off-by: Chris Frey <cdfrey@foursquare.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoUpdate release notes for 1.6.0.3
Shawn O. Pearce [Thu, 25 Sep 2008 15:27:41 +0000 (08:27 -0700)]
Update release notes for 1.6.0.3

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agocheckout: Do not show local changes when in quiet mode
Jonas Fonseca [Thu, 25 Sep 2008 08:35:38 +0000 (10:35 +0200)]
checkout: Do not show local changes when in quiet mode

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agofor-each-ref: Fix --format=%(subject) for log message without newlines
Johan Herland [Wed, 24 Sep 2008 23:10:54 +0000 (01:10 +0200)]
for-each-ref: Fix --format=%(subject) for log message without newlines

'git for-each-ref --format=%(subject)' currently returns an empty string
if the log message does not contain a newline.

This patch teaches 'git for-each-ref' to return the entire log message
(instead of an empty string) if there is no newline in the log message.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogit-stash.sh: don't default to refs/stash if invalid ref supplied
Brandon Casey [Tue, 23 Sep 2008 23:57:09 +0000 (18:57 -0500)]
git-stash.sh: don't default to refs/stash if invalid ref supplied

apply_stash() and show_stash() each call rev-parse with
'--default refs/stash' as an argument. This option causes rev-parse to
operate on refs/stash if it is not able to successfully operate on any
element of the command line. This includes failure to supply a "valid"
revision. This has the effect of causing 'stash apply' and 'stash show'
to operate as if stash@{0} had been supplied when an invalid revision is
supplied.

e.g. 'git stash apply stash@{1}' would fall back to
     'git stash apply stash@{0}'

This patch modifies these two functions so that they avoid using the
--default option of rev-parse.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agomaint: check return of split_cmdline to avoid bad config strings
Deskin Miller [Mon, 22 Sep 2008 15:06:41 +0000 (11:06 -0400)]
maint: check return of split_cmdline to avoid bad config strings

As the testcase demonstrates, it's possible for split_cmdline to return -1 and
deallocate any memory it's allocated, if the config string is missing an end
quote.  In both the cases below, which are the only calling sites, the return
isn't checked, and using the pointer causes a pretty immediate segfault.

Signed-off-by: Deskin Miller <deskinm@umich.edu>
Acked-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agobuiltin-prune.c: prune temporary packs in <object_dir>/pack directory
Brandon Casey [Mon, 22 Sep 2008 23:34:26 +0000 (18:34 -0500)]
builtin-prune.c: prune temporary packs in <object_dir>/pack directory

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot4018-diff-funcname: test syntax of builtin xfuncname patterns
Brandon Casey [Mon, 22 Sep 2008 23:19:05 +0000 (18:19 -0500)]
t4018-diff-funcname: test syntax of builtin xfuncname patterns

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDo not perform cross-directory renames when creating packs
Petr Baudis [Mon, 22 Sep 2008 17:20:21 +0000 (19:20 +0200)]
Do not perform cross-directory renames when creating packs

A comment on top of create_tmpfile() describes caveats ('can have
problems on various systems (FAT, NFS, Coda)') that should apply
in this situation as well.  This in the end did not end up solving
any of my personal problems, but it might be a useful cleanup patch
nevertheless.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUse dashless git commands in setgitperms.perl
Todd Zullinger [Mon, 22 Sep 2008 11:30:08 +0000 (07:30 -0400)]
Use dashless git commands in setgitperms.perl

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-remote: do not use user input in a printf format string
Johannes Sixt [Mon, 22 Sep 2008 11:03:25 +0000 (13:03 +0200)]
git-remote: do not use user input in a printf format string

'git remote show' substituted the remote name into a string that was later
used as a printf format string. If a remote name contains a printf format
specifier like this:

   $ git remote add foo%sbar .

then the command

   $ git remote show foo%sbar

would print garbage (if you are lucky) or crash. This fixes it.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomake "git remote" report multiple URLs
Michael J Gruber [Mon, 22 Sep 2008 08:57:51 +0000 (10:57 +0200)]
make "git remote" report multiple URLs

This patch makes "git remote -v" and "git remote show" report multiple URLs
rather than warn about them. Multiple URLs are OK for pushing into
multiple repos simultaneously. Without "-v" each repo is shown once only.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff hunk pattern: fix misconverted "\{" tex macro introducers
Junio C Hamano [Sat, 20 Sep 2008 22:30:12 +0000 (15:30 -0700)]
diff hunk pattern: fix misconverted "\{" tex macro introducers

Pointed out by Brandon Casey.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff: use extended regexp to find hunk headers
Junio C Hamano [Sat, 20 Sep 2008 06:45:04 +0000 (23:45 -0700)]
diff: use extended regexp to find hunk headers

Using ERE elements such as "|" (alternation) by backquoting in BRE
is a GNU extension and should not be done in portable programs.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoStart draft release notes for 1.6.0.3
Junio C Hamano [Sat, 20 Sep 2008 06:15:13 +0000 (23:15 -0700)]
Start draft release notes for 1.6.0.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-repack uses --no-repack-object, not --no-repack-delta.
Mikael Magnusson [Fri, 19 Sep 2008 13:43:48 +0000 (15:43 +0200)]
git-repack uses --no-repack-object, not --no-repack-delta.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoTypo "bogos" in format-patch error message.
Mikael Magnusson [Fri, 19 Sep 2008 13:42:30 +0000 (15:42 +0200)]
Typo "bogos" in format-patch error message.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-clone: fix typo
Fabrizio Chiarello [Fri, 19 Sep 2008 12:07:26 +0000 (14:07 +0200)]
builtin-clone: fix typo

Signed-off-by: Fabrizio Chiarello <ponch@autistici.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoBust the ghost of long-defunct diffcore-pathspec.
Yann Dirson [Fri, 19 Sep 2008 20:12:53 +0000 (22:12 +0200)]
Bust the ghost of long-defunct diffcore-pathspec.

This concept was retired by 77882f6 (Retire diffcore-pathspec.,
2006-04-10), more than 2 years ago.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompletion: git commit should list --interactive
Eric Raible [Thu, 11 Sep 2008 00:40:20 +0000 (17:40 -0700)]
completion: git commit should list --interactive

Signed-off-by: Eric Raible <raible@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff.*.xfuncname which uses "extended" regex's for hunk header selection
Brandon Casey [Thu, 18 Sep 2008 22:44:33 +0000 (17:44 -0500)]
diff.*.xfuncname which uses "extended" regex's for hunk header selection

Currently, the hunk headers produced by 'diff -p' are customizable by
setting the diff.*.funcname option in the config file. The 'funcname' option
takes a basic regular expression. This functionality was designed using the
GNU regex library which, by default, allows using backslashed versions of
some extended regular expression operators, even in Basic Regular Expression
mode. For example, the following characters, when backslashed, are
interpreted according to the extended regular expression rules: ?, +, and |.
As such, the builtin funcname patterns were created using some extended
regular expression operators.

Other platforms which adhere more strictly to the POSIX spec do not
interpret the backslashed extended RE operators in Basic Regular Expression
mode. This causes the pattern matching for the builtin funcname patterns to
fail on those platforms.

Introduce a new option 'xfuncname' which uses extended regular expressions,
and advertise it _instead_ of funcname. Since most users are on GNU
platforms, the majority of funcname patterns are created and tested there.
Advertising only xfuncname should help to avoid the creation of non-portable
patterns which work with GNU regex but not elsewhere.

Additionally, the extended regular expressions may be less ugly and
complicated compared to the basic RE since many common special operators do
not need to be backslashed.

For example, the GNU Basic RE:

    ^[  ]*\\(\\(public\\|static\\).*\\)$

becomes the following Extended RE:

    ^[  ]*((public|static).*)$

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff.c: associate a flag with each pattern and use it for compiling regex
Brandon Casey [Thu, 18 Sep 2008 22:42:48 +0000 (17:42 -0500)]
diff.c: associate a flag with each pattern and use it for compiling regex

This is in preparation for allowing extended regular expression patterns.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff.c: return pattern entry pointer rather than just the hunk header pattern
Brandon Casey [Thu, 18 Sep 2008 22:40:48 +0000 (17:40 -0500)]
diff.c: return pattern entry pointer rather than just the hunk header pattern

This is in preparation for associating a flag with each pattern which will
control how the pattern is interpreted. For example, as a basic or extended
regular expression.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'dp/maint-rebase-fix' into maint
Junio C Hamano [Fri, 19 Sep 2008 02:53:25 +0000 (19:53 -0700)]
Merge branch 'dp/maint-rebase-fix' into maint

* dp/maint-rebase-fix:
  git-rebase--interactive: auto amend only edited commit
  git-rebase-interactive: do not squash commits on abort

15 years agoMerge branch 'jc/maint-checkout-keep-remove' into maint
Junio C Hamano [Fri, 19 Sep 2008 02:53:22 +0000 (19:53 -0700)]
Merge branch 'jc/maint-checkout-keep-remove' into maint

* jc/maint-checkout-keep-remove:
  checkout: do not lose staged removal

15 years agoMerge branch 'jc/maint-diff-quiet' into maint
Junio C Hamano [Fri, 19 Sep 2008 02:53:12 +0000 (19:53 -0700)]
Merge branch 'jc/maint-diff-quiet' into maint

* jc/maint-diff-quiet:
  diff --quiet: make it synonym to --exit-code >/dev/null
  diff Porcelain: do not disable auto index refreshing on -C -C

15 years agoMerge branch 'jc/maint-name-hash-clear' into maint
Junio C Hamano [Fri, 19 Sep 2008 02:53:06 +0000 (19:53 -0700)]
Merge branch 'jc/maint-name-hash-clear' into maint

* jc/maint-name-hash-clear:
  discard_cache: reset lazy name_hash bit

15 years agoMerge branch 'jc/maint-template-permbits' into maint
Junio C Hamano [Fri, 19 Sep 2008 02:53:01 +0000 (19:53 -0700)]
Merge branch 'jc/maint-template-permbits' into maint

* jc/maint-template-permbits:
  Fix permission bits on sources checked out with an overtight umask

15 years agoMerge branch 'mh/maint-honor-no-ssl-verify' into maint
Junio C Hamano [Fri, 19 Sep 2008 02:52:57 +0000 (19:52 -0700)]
Merge branch 'mh/maint-honor-no-ssl-verify' into maint

* mh/maint-honor-no-ssl-verify:
  Don't verify host name in SSL certs when GIT_SSL_NO_VERIFY is set

15 years agosha1_file: link() returns -1 on failure, not errno
Thomas Rast [Thu, 18 Sep 2008 22:24:46 +0000 (00:24 +0200)]
sha1_file: link() returns -1 on failure, not errno

5723fe7 (Avoid cross-directory renames and linking on object creation,
2008-06-14) changed the call to use link() directly instead of through a
custom wrapper, but forgot that it returns 0 or -1, not 0 or errno.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMake git archive respect core.autocrlf when creating zip format archives
Charles Bailey [Thu, 18 Sep 2008 20:01:20 +0000 (21:01 +0100)]
Make git archive respect core.autocrlf when creating zip format archives

There is currently no call to git_config at the start of cmd_archive.
When creating tar archives the core config is read as a side-effect of
reading the tar specific config, but this doesn't happen for zip
archives.

The consequence is that in a configuration with core.autocrlf set,
although files in a tar archive are created with crlf line endings,
files in a zip archive retain unix line endings.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Acked-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd new test to demonstrate git archive core.autocrlf inconsistency
Charles Bailey [Thu, 18 Sep 2008 20:01:13 +0000 (21:01 +0100)]
Add new test to demonstrate git archive core.autocrlf inconsistency

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: avoid warnings for commits without body
Joey Hess [Fri, 5 Sep 2008 18:26:29 +0000 (14:26 -0400)]
gitweb: avoid warnings for commits without body

In the unusual case when there is no commit message, gitweb would
output an uninitialized value warning.

Signed-off-by: Joey Hess <joey@kitenet.net>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoClarified gitattributes documentation regarding custom hunk header.
Garry Dolley [Wed, 17 Sep 2008 06:20:39 +0000 (23:20 -0700)]
Clarified gitattributes documentation regarding custom hunk header.

The only part of the hunk header that we can change is the "TEXT"
portion.  Additionally, a few grammatical errors have been corrected.

Signed-off-by: Garry Dolley <gdolley@ucla.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: fix handling of even funkier branch names
Eric Wong [Sun, 7 Sep 2008 03:18:18 +0000 (20:18 -0700)]
git-svn: fix handling of even funkier branch names

Apparently do_switch() tolerates the lack of escaping in less
funky branch names.  For the really strange and scary ones, we
need to escape them properly.  It strangely maintains compatible
with the existing handling of branch names with spaces and
exclamation marks.

Reported-by: m.skoric@web.de ($gmane/94677)
Signed-off-by: Eric Wong <normalperson@yhbt.net>
15 years agogit-svn: Always create a new RA when calling do_switch for svn://
Alec Berryman [Sun, 14 Sep 2008 21:14:16 +0000 (17:14 -0400)]
git-svn: Always create a new RA when calling do_switch for svn://

Not doing so caused the "Malformed network data" error when a directoy
was deleted and replaced with a copy from an older version.

Signed-off-by: Alec Berryman <alec@thened.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: factor out svnserve test code for later use
Alec Berryman [Sun, 14 Sep 2008 21:14:15 +0000 (17:14 -0400)]
git-svn: factor out svnserve test code for later use

Signed-off-by: Alec Berryman <alec@thened.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff/diff-files: do not use --cc too aggressively
Junio C Hamano [Thu, 18 Sep 2008 07:32:37 +0000 (00:32 -0700)]
diff/diff-files: do not use --cc too aggressively

Textual diff output for unmerged paths was too eager to give condensed
combined diff.  Even though "diff -c" (and "diff-files -c -p") is a
request to view combined diff without condensing (otherwise the user would
have explicitly asked for --cc, not -c), we showed "--cc" output anyway.

0fe7c1d (built-in diff: assorted updates, 2006-04-29) claimed to be
careful about doing this, but its breakage was hidden because back then
"git diff" was still a shell script that did not use the codepath it
introduced fully.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoCosmetical command name fix
Heikki Orsila [Sat, 13 Sep 2008 16:31:31 +0000 (19:31 +0300)]
Cosmetical command name fix

If we came from git.c the first arg would be "archive".
"git-archive" isn't a bug because cmd_archive() doesn't check
the first arg.

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoStart conforming code to "git subcmd" style part 3
Heikki Orsila [Sat, 13 Sep 2008 17:18:36 +0000 (20:18 +0300)]
Start conforming code to "git subcmd" style part 3

User notifications are presented as 'git cmd', and code comments
are presented as '"cmd"' or 'git's cmd', rather than 'git-cmd'.

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot9700/test.pl: remove File::Temp requirement
Brandon Casey [Mon, 15 Sep 2008 16:25:22 +0000 (11:25 -0500)]
t9700/test.pl: remove File::Temp requirement

The object oriented version of File::Temp is a rather new incarnation it
seems. The File::Temp man page for v5.8.0 says "(NOT YET IMPLEMENTED)" in
the 'Objects' section. Instead of creating a file with a unique name in
the system TMPDIR, we can create our own temporary file with a static
name and use that instead.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Tested-by: Tom G. Christensen <tgc@statsbiblioteket.dk> on RHEL 3, Perl 5.8.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot9700/test.pl: avoid bareword 'STDERR' in 3-argument open()
Brandon Casey [Mon, 15 Sep 2008 16:23:24 +0000 (11:23 -0500)]
t9700/test.pl: avoid bareword 'STDERR' in 3-argument open()

Some versions of perl complain when 'STDERR' is used as the third argument
in the 3-argument form of open(). Convert to the 2-argument form which is
described for duping STDERR in my second edition camel book.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Tested-by: Tom G. Christensen <tgc@statsbiblioteket.dk> on RHEL 3, Perl 5.8.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.0.2 v1.6.0.2
Junio C Hamano [Fri, 12 Sep 2008 23:18:47 +0000 (16:18 -0700)]
GIT 1.6.0.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'ho/maint-dashless' into maint
Junio C Hamano [Fri, 12 Sep 2008 23:15:23 +0000 (16:15 -0700)]
Merge branch 'ho/maint-dashless' into maint

* ho/maint-dashless:
  Start conforming code to "git subcmd" style part 2

15 years agoFix some manual typos.
Ralf Wildenhues [Fri, 12 Sep 2008 19:10:26 +0000 (21:10 +0200)]
Fix some manual typos.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUse compatibility regex library also on FreeBSD
Jeff King [Thu, 11 Sep 2008 12:12:16 +0000 (08:12 -0400)]
Use compatibility regex library also on FreeBSD

Commit 3632cfc24 makes the same change for Darwin; however, the problem
also exists on FreeBSD.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUse compatibility regex library also on AIX
Johannes Sixt [Thu, 11 Sep 2008 08:14:44 +0000 (10:14 +0200)]
Use compatibility regex library also on AIX

This augments 3632cfc24 (Use compatibility regex library on Darwin,
2008-09-07), which already carries a "Tested-by" statement for AIX,
but that test was actually done with this patch included.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Tested-by: Mike Ralphson <mike@abacus.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate draft release notes for 1.6.0.2
Junio C Hamano [Wed, 10 Sep 2008 19:45:02 +0000 (12:45 -0700)]
Update draft release notes for 1.6.0.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUse compatibility regex library for OSX/Darwin
Arjen Laarhoven [Sun, 7 Sep 2008 18:45:37 +0000 (20:45 +0200)]
Use compatibility regex library for OSX/Darwin

The standard libc regex library on OSX does not support alternation
in POSIX Basic Regular Expression mode.  This breaks the diff.funcname
functionality on OSX.

To fix this, we use the GNU regex library which is already present in
the compat/ diretory for the MinGW port.  However, simply adding compat/
to the COMPAT_CFLAGS variable causes a conflict between the system
fnmatch.h and the one present in compat/.  To remedy this, move the
regex and fnmatch functionality to their own subdirectories in compat/
so they can be included seperately.

Signed-off-by: Arjen Laarhoven <arjen@yaph.org>
Tested-by: Mike Ralphson <mike@abacus.co.uk> (AIX)
Tested-by: Johannes Sixt <johannes.sixt@telecom.at> (MinGW)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: Fixes my() parameter list syntax error in pre-5.8 Perl
Marcus Griep [Wed, 10 Sep 2008 15:09:46 +0000 (11:09 -0400)]
git-svn: Fixes my() parameter list syntax error in pre-5.8 Perl

Signed-off-by: Marcus Griep <marcus@griep.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGit.pm: Use File::Temp->tempfile instead of ->new
Marcus Griep [Mon, 8 Sep 2008 16:53:01 +0000 (12:53 -0400)]
Git.pm: Use File::Temp->tempfile instead of ->new

Perl 5.8.0 ships with File::Temp 0.13, which does not have the new()
interface introduced in 0.14, as pointed out by Tom G. Christensen.

This modifies Git.pm to use the more established tempfile() interface
and updates 'git svn' to match.

Signed-off-by: Marcus Griep <marcus@griep.us>
Acked-by: Eric Wong <normalperson@yhbt.net>
Tested-by: Tom G. Christensen <tgc@statsbiblioteket.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot7501: always use test_cmp instead of diff
Miklos Vajna [Wed, 10 Sep 2008 17:32:44 +0000 (19:32 +0200)]
t7501: always use test_cmp instead of diff

This should make the output more readable (by default using diff -u)
when some tests fail.

Also changed the diff order from "current expected" to "expected
current".

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/maint-log-grep' into maint
Junio C Hamano [Wed, 10 Sep 2008 09:15:08 +0000 (02:15 -0700)]
Merge branch 'jc/maint-log-grep' into maint

* jc/maint-log-grep:
  log --author/--committer: really match only with name part

15 years agoMerge branch 'jc/maint-hide-cr-in-diff-from-less' into maint
Junio C Hamano [Wed, 10 Sep 2008 09:14:18 +0000 (02:14 -0700)]
Merge branch 'jc/maint-hide-cr-in-diff-from-less' into maint

* jc/maint-hide-cr-in-diff-from-less:
  diff: Help "less" hide ^M from the output

15 years agoMerge branch 'jc/maint-checkout-fix' into maint
Junio C Hamano [Wed, 10 Sep 2008 09:13:41 +0000 (02:13 -0700)]
Merge branch 'jc/maint-checkout-fix' into maint

* jc/maint-checkout-fix:
  checkout: do not check out unmerged higher stages randomly

15 years agoMerge branch 'np/maint-safer-pack' into maint
Junio C Hamano [Wed, 10 Sep 2008 09:12:47 +0000 (02:12 -0700)]
Merge branch 'np/maint-safer-pack' into maint

* np/maint-safer-pack:
  fixup_pack_header_footer(): use nicely aligned buffer sizes
  index-pack: use fixup_pack_header_footer()'s validation mode
  pack-objects: use fixup_pack_header_footer()'s validation mode
  improve reliability of fixup_pack_header_footer()
  pack-objects: improve returned information from write_one()

15 years agocheckout: do not lose staged removal
Junio C Hamano [Mon, 8 Sep 2008 02:49:25 +0000 (19:49 -0700)]
checkout: do not lose staged removal

The logic to checkout a different commit implements the safety to never
lose user's local changes.  For example, switching from a commit to
another commit, when you have changed a path that is different between
them, need to merge your changes to the version from the switched-to
commit, which you may not necessarily be able to resolve easily.  By
default, "git checkout" refused to switch branches, to give you a chance
to stash your local changes (or use "-m" to merge, accepting the risks of
getting conflicts).

This safety, however, had one deliberate hole since early June 2005.  When
your local change was to remove a path (and optionally to stage that
removal), the command checked out the path from the switched-to commit
nevertheless.

This was to allow an initial checkout to happen smoothly (e.g. an initial
checkout is done by starting with an empty index and switching from the
commit at the HEAD to the same commit).  We can tighten the rule slightly
to allow this special case to pass, without losing sight of removal
explicitly done by the user, by noticing if the index is truly empty when
the operation begins.

For historical background, see:

    http://thread.gmane.org/gmane.comp.version-control.git/4641/focus=4646

This case is marked as *0* in the message, which both Linus and I said "it
feels somewhat wrong but otherwise we cannot start from an empty index".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix permission bits on sources checked out with an overtight umask
Junio C Hamano [Fri, 22 Aug 2008 00:31:50 +0000 (19:31 -0500)]
Fix permission bits on sources checked out with an overtight umask

Two patches 9907721 (templates/Makefile: don't depend on local umask
setting, 2008-02-28) and 96cda0b (templates/Makefile: install is
unnecessary, just use mkdir -p, 2008-08-21) tried to prevent an overtight
umask the builder/installer might have from screwing over the installation
procedure, but we forgot there was another source of trouble.  If the
person who checked out the source tree had an overtight umask, it will
leak out to the built products, which is propagated to the installation
destination.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-rebase--interactive: auto amend only edited commit
Dmitry Potapov [Tue, 9 Sep 2008 12:05:26 +0000 (16:05 +0400)]
git-rebase--interactive: auto amend only edited commit

"git rebase --continue" issued after git rebase being stop by "edit"
command is trying to amend the last commit using stage changes. However,
if the last commit is not the commit that was marked as "edit" then it
can produce unexpected results.

For instance, after being stop by "edit", I have made some changes to
commit message using "git commit --amend". After that I realized that
I forgot to add some changes to some file. So, I said "git add file"
and the "git rebase --continue". Unfortunately, it caused that the new
commit message was lost.

Another problem is that after being stopped at "edit", the user adds new
commits. In this case, automatic amend behavior of git rebase triggered
by some stage changes causes that not only that the log message of the
last commit is lost but that it will contain also wrong Author and Date
information.

Therefore, this patch restrict automatic amend only to the situation
where HEAD is the commit at which git rebase stop by "edit" command.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoStart conforming code to "git subcmd" style part 2
Heikki Orsila [Tue, 9 Sep 2008 10:28:30 +0000 (13:28 +0300)]
Start conforming code to "git subcmd" style part 2

User notifications are presented as 'git cmd', and code comments
are presented as '"cmd"' or 'git's cmd', rather than 'git-cmd'.

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-rebase-interactive: do not squash commits on abort
Dmitry Potapov [Mon, 8 Sep 2008 20:42:48 +0000 (00:42 +0400)]
git-rebase-interactive: do not squash commits on abort

If git rebase interactive is stopped by "edit" command and then the user
said "git rebase --continue" while having some stage changes, git rebase
interactive is trying to amend the last commit by doing:
  git --soft reset && git commit

However, the user can abort commit for some reason by providing an empty
log message, and that would leave the last commit undone, while the user
being completely unaware about what happened. Now if the user tries to
continue, by issuing "git rebase --continue" that squashes two previous
commits.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDon't verify host name in SSL certs when GIT_SSL_NO_VERIFY is set
Junio C Hamano [Thu, 21 Feb 2008 23:10:37 +0000 (15:10 -0800)]
Don't verify host name in SSL certs when GIT_SSL_NO_VERIFY is set

Originally from Mike Hommey; earlier we were disabling SSL_VERIFYPEER
but SSL_VERIFYHOST was in effect even when the user asked not to with
the environment variable.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff --quiet: make it synonym to --exit-code >/dev/null
Junio C Hamano [Tue, 2 Sep 2008 06:20:26 +0000 (23:20 -0700)]
diff --quiet: make it synonym to --exit-code >/dev/null

The point of --quiet was to return the status as early as possible without
doing any extra processing.  Well behaved scripts, when they expect to run
many diff operations inside, are supposed to run "update-index --refresh"
upfront; we do not want them to pay the price of iterating over the index
and comparing the contents to fix the stat dirtiness, and we avoided most
of the processing in diffcore_std() when --quiet is in effect.

But scripts that adhere to the good practice won't have to pay any more
price than the necessary lstat(2) that will report stat cleanliness, as
long as only -q is given without any fancier diff options.

More importantly, users who do ask for "--quiet -M --filter=D" (in order
to notice only the deletion, not paths that disappeared only because they
have been renamed away) deserve to get the result they asked for, even it
means they have to pay the extra price; the alternative is to get a cheap
early return that gives a result they did not ask for, which is much
worse.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff Porcelain: do not disable auto index refreshing on -C -C
Junio C Hamano [Sun, 7 Sep 2008 02:09:16 +0000 (19:09 -0700)]
diff Porcelain: do not disable auto index refreshing on -C -C

When we enabled the automatic refreshing of the index to "diff" Porcelain,
we disabled it when --find-copies-harder was asked, but there is no good
reason to do so.  In the following command sequence, the first "diff"
shows an "empty" diff exposing stat dirtyness, while the second one does
not.

    $ >foo
    $ git add foo
    $ touch foo
    $ git diff -C -C
    $ git diff -C

This fixes the inconsistency.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate draft release notes for 1.6.0.2
Junio C Hamano [Sat, 6 Sep 2008 23:18:31 +0000 (16:18 -0700)]
Update draft release notes for 1.6.0.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agostash: refresh the index before deciding if the work tree is dirty
Junio C Hamano [Thu, 4 Sep 2008 09:41:22 +0000 (02:41 -0700)]
stash: refresh the index before deciding if the work tree is dirty

Unlike the case where the user does have a real change in the work tree,
refusing to work because of unclean stat information is not very helpful.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Nanako Shiraishi <nanako3@lavabit.com>
15 years agoMerge branch 'maint' of git://repo.or.cz/git-gui into maint
Junio C Hamano [Sat, 6 Sep 2008 23:03:22 +0000 (16:03 -0700)]
Merge branch 'maint' of git://repo.or.cz/git-gui into maint

* 'maint' of git://repo.or.cz/git-gui:
  git-gui: Fix diff parsing for lines starting with "--" or "++"
  git-gui: Fix string escaping in po2msg.sh
  git gui: show diffs with a minimum of 1 context line
  git-gui: update all remaining translations to French.
  git-gui: Update french translation

15 years agoMention the fact that 'git annotate' is only for backward compatibility.
Junio C Hamano [Fri, 5 Sep 2008 07:29:51 +0000 (00:29 -0700)]
Mention the fact that 'git annotate' is only for backward compatibility.

When somebody is reading git-blame.txt (or git-annotate.txt) for the first
time, the message we would like to send is:

 (1) Here is why you would want to use this command, what it can do
     (perhaps more than what you would have expected from "$scm blame"),
     and how you tell it to do what it does.

     This is obvious.

 (2) You might have heard of the command with the other name.  There is no
     difference between the two, except they differ in their default
     output formats.

     This is essential to answer: "git has both?  how are they different?"

 (3) We tend to encourage blame over annotate for new scripts and new
     people, but there is no reason to choose one over the other.

     This is not as important as (2), but would be useful to avoid
     repeated questions about "when will we start deprecating this?"

As long as we describe (2) on git-annotate page clearly enough, people who
read git-blame page first and get curious can refer to git-annotate page.
While at it, subtly hint (3) without being overly explicit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years ago"blame -c" should be compatible with "annotate"
Junio C Hamano [Fri, 5 Sep 2008 07:57:35 +0000 (00:57 -0700)]
"blame -c" should be compatible with "annotate"

There is no reason to have a separate variable cmd_is_annotate;
OUTPUT_ANNOTATE_COMPAT option is supposed to produce the compatibility
output, and we should produce the same output even when the command was
not invoked as "annotate" but as "blame -c".

Noticed by Pasky.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agolog --author/--committer: really match only with name part
Junio C Hamano [Fri, 5 Sep 2008 05:15:02 +0000 (22:15 -0700)]
log --author/--committer: really match only with name part

When we tried to find commits done by AUTHOR, the first implementation
tried to pattern match a line with "^author .*AUTHOR", which later was
enhanced to strip leading caret and look for "^author AUTHOR" when the
search pattern was anchored at the left end (i.e. --author="^AUTHOR").

This had a few problems:

 * When looking for fixed strings (e.g. "git log -F --author=x --grep=y"),
   the regexp internally used "^author .*x" would never match anything;

 * To match at the end (e.g. "git log --author='google.com>$'"), the
   generated regexp has to also match the trailing timestamp part the
   commit header lines have.  Also, in order to determine if the '$' at
   the end means "match at the end of the line" or just a literal dollar
   sign (probably backslash-quoted), we would need to parse the regexp
   ourselves.

An earlier alternative tried to make sure that a line matches "^author "
(to limit by field name) and the user supplied pattern at the same time.
While it solved the -F problem by introducing a special override for
matching the "^author ", it did not solve the trailing timestamp nor tail
match problem.  It also would have matched every commit if --author=author
was asked for, not because the author's email part had this string, but
because every commit header line that talks about the author begins with
that field name, regardleses of who wrote it.

Instead of piling more hacks on top of hacks, this rethinks the grep
machinery that is used to look for strings in the commit header, and makes
sure that (1) field name matches literally at the beginning of the line,
followed by a SP, and (2) the user supplied pattern is matched against the
remainder of the line, excluding the trailing timestamp data.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-gui: Fix diff parsing for lines starting with "--" or "++"
Shawn O. Pearce [Fri, 5 Sep 2008 04:46:56 +0000 (21:46 -0700)]
git-gui: Fix diff parsing for lines starting with "--" or "++"

Languages like Lua and SQL use "--" to mark a line as commented out.
If this appears at column 0 and is part of the pre-image we may see
"--- foo" in the diff, indicating that the line whose content is
 "-- foo" has been removed from the new version.

git-gui was incorrectly parsing "--- foo" as the old file name
in the file header, causing it to generate a bad patch file when
the user tried to stage or unstage a hunk or the selected line.
We need to keep track of where we are in the parsing so that we do
not misread a deletion or addition record as part of the header.

Reported-by: Alexander Gladysh <agladysh@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agodiff --cumulative is a sub-option of --dirstat
Junio C Hamano [Wed, 3 Sep 2008 00:28:59 +0000 (17:28 -0700)]
diff --cumulative is a sub-option of --dirstat

The option used to be implemented as if it is a totally independent one,
but "git diff --cumulative" would not mean anything without "--dirstat".

This makes --cumulative imply --dirstat.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: Hide more plumbing commands
Petr Baudis [Tue, 26 Aug 2008 17:11:44 +0000 (19:11 +0200)]
bash completion: Hide more plumbing commands

git <tab><tab> still shows way too many commands, some of them
are clearly plumbing. This patch hides the plumbing commands
liberally (that is, in special cases, users still might want to
call one of the hidden commands, a *normal* workflow should never
involve these, though - and if it does, we have a UI problem anyway).

Signed-off-by: Petr Baudis <pasky@suse.cz>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoStart 1.6.0.2 maintenance cycle
Junio C Hamano [Wed, 3 Sep 2008 22:39:19 +0000 (15:39 -0700)]
Start 1.6.0.2 maintenance cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'nd/worktree' into maint
Junio C Hamano [Wed, 3 Sep 2008 22:35:37 +0000 (15:35 -0700)]
Merge branch 'nd/worktree' into maint

* nd/worktree:
  setup_git_directory(): fix move to worktree toplevel directory
  update-index: fix worktree setup
  read-tree: setup worktree if merge is required
  grep: fix worktree setup
  diff*: fix worktree setup

15 years agoMerge branch 'ho/dashless' into maint
Junio C Hamano [Wed, 3 Sep 2008 21:51:56 +0000 (14:51 -0700)]
Merge branch 'ho/dashless' into maint

* ho/dashless:
  tests: use "git xyzzy" form (t7200 - t9001)
  tests: use "git xyzzy" form (t7000 - t7199)
  tests: use "git xyzzy" form (t3600 - t6999)
  tests: use "git xyzzy" form (t0000 - t3599)
  'git foo' program identifies itself without dash in die() messages
  Start conforming code to "git subcmd" style