Code

git.git
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 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 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

15 years agotests: use "git xyzzy" form (t7200 - t9001)
Nanako Shiraishi [Wed, 3 Sep 2008 08:59:33 +0000 (17:59 +0900)]
tests: use "git xyzzy" form (t7200 - t9001)

Converts tests between t7201-t9001.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: use "git xyzzy" form (t7000 - t7199)
Nanako Shiraishi [Wed, 3 Sep 2008 08:59:31 +0000 (17:59 +0900)]
tests: use "git xyzzy" form (t7000 - t7199)

Converts tests between t7001-t7103.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix passwd(5) ref and reflect that commit doens't use commit-tree
Jonas Fonseca [Wed, 3 Sep 2008 08:50:43 +0000 (10:50 +0200)]
Fix passwd(5) ref and reflect that commit doens't use commit-tree

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoimprove handling of sideband message display
Nicolas Pitre [Wed, 3 Sep 2008 19:13:42 +0000 (15:13 -0400)]
improve handling of sideband message display

Currently the code looks for line break characters in order to prepend
"remote: " to every line received as many lines can be sent in a single
chunk.  However the opposite might happen too, i.e. a single message
line split amongst multiple chunks.  This patch adds support for the
later case to avoid displays like:

remote: Compressing objeremote: cts: 100% (313/313), done.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: use "git xyzzy" form (t3600 - t6999)
Nanako Shiraishi [Wed, 3 Sep 2008 08:59:29 +0000 (17:59 +0900)]
tests: use "git xyzzy" form (t3600 - t6999)

Converts tests between t3600-t6300.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: use "git xyzzy" form (t0000 - t3599)
Nanako Shiraishi [Wed, 3 Sep 2008 08:59:27 +0000 (17:59 +0900)]
tests: use "git xyzzy" form (t0000 - t3599)

Converts tests between t0050-t3903.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocheckout: fix message when leaving detached HEAD
Jeff King [Wed, 3 Sep 2008 18:07:26 +0000 (14:07 -0400)]
checkout: fix message when leaving detached HEAD

The shell version of git checkout would print:

  Previous HEAD position was 1234abcd... commit subject line

when leaving a detached HEAD for another commit. Ths C
version attempted to implement this, but got the condition
wrong such that the behavior never triggered.

This patch simplifies the conditions for showing the message
to the ones used by the shell version: any time we are
leaving a detached HEAD and the new and old commits are not
the same (this suppresses it for the "git checkout -b new"
case recommended when you enter the detached state).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoclone: fix creation of explicitly named target directory
Clemens Buchacher [Wed, 3 Sep 2008 18:55:55 +0000 (20:55 +0200)]
clone: fix creation of explicitly named target directory

'git clone <repo> path/' (note the trailing slash) fails, because the
entire path is interpreted as leading directories. So when mkdir tries to
create the actual path, it already exists.

This makes sure trailing slashes are removed.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: add merge_recursive.h to LIB_H
Miklos Vajna [Tue, 2 Sep 2008 23:49:05 +0000 (01:49 +0200)]
Makefile: add merge_recursive.h to LIB_H

When modifying merge-recursive.h, for example builtin-merge-recursive.c
have to be recompiled which was not true till now, causing various
runtime errors using an incremental build.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoImprove documentation for --dirstat diff option
Heikki Orsila [Mon, 1 Sep 2008 00:50:28 +0000 (03:50 +0300)]
Improve documentation for --dirstat diff option

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoBring local clone's origin URL in line with that of a remote clone
Johan Herland [Mon, 1 Sep 2008 19:07:33 +0000 (21:07 +0200)]
Bring local clone's origin URL in line with that of a remote clone

On a local clone, "git clone" would use the fully DWIMmed path as the origin
URL in the resulting repo. This was slightly inconsistent with the case of a
remote clone where the _given_ URL was used as the origin URL (because the
DWIMming was done remotely, and was therefore not available to "git clone").

This behaviour caused problems when cloning a local non-bare repo with
relative submodule URLs, because these submodule URLs would then be resolved
against the DWIMmed URL (e.g. "/repo/.git") instead of the given URL (e.g.
"/repo").

This patch teaches "git clone" to use the _given_ URL - instead of the
DWIMmed path - as the origin URL. This causes relative submodule URLs to be
resolved correctly, as long the _given_ URL indicates the correct directory
against which the submodule URLs should be resolved.

The patch also updates a testcase that contained the old-style origin URLs.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: minor cleanup in a use case in 'git stash' manual
SZEDER Gábor [Tue, 2 Sep 2008 01:45:01 +0000 (03:45 +0200)]
Documentation: minor cleanup in a use case in 'git stash' manual

There is no need to explicitly pass the file to be committed to 'git
commit', because it's contents is already in the index.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: fix disappeared lines in 'git stash' manpage
SZEDER Gábor [Tue, 2 Sep 2008 01:35:24 +0000 (03:35 +0200)]
Documentation: fix disappeared lines in 'git stash' manpage

Asciidoc removes lines starting with a dot when creating manpages.
Since those lines were comments in use case examples showing shell
commands, preceed those lines with a hash sign.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: fix reference to a for-each-ref option
SZEDER Gábor [Mon, 1 Sep 2008 21:02:09 +0000 (23:02 +0200)]
Documentation: fix reference to a for-each-ref option

... to match the synopsis section

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-gui: Fix string escaping in po2msg.sh
Alexander Gavrilov [Sat, 30 Aug 2008 21:12:26 +0000 (01:12 +0400)]
git-gui: Fix string escaping in po2msg.sh

Escape '$', because otherwise git-gui crashes while
trying to load malformed Japanese localization strings.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogit gui: show diffs with a minimum of 1 context line
Clemens Buchacher [Sat, 30 Aug 2008 16:45:27 +0000 (18:45 +0200)]
git gui: show diffs with a minimum of 1 context line

Staging hunks without context does not work, because line number
information would have to be recomputed for individual hunks.

Since it is already possible to stage individual lines using
'Stage Line for Commit', zero context diffs are not really
necessary for git gui.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoDocument sendemail.envelopesender configuration
Ask Bjørn Hansen [Sun, 31 Aug 2008 20:32:43 +0000 (13:32 -0700)]
Document sendemail.envelopesender configuration

Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocument clarification: gitmodules, gitattributes
Gustaf Hendeby [Sun, 31 Aug 2008 16:00:27 +0000 (18:00 +0200)]
Document clarification: gitmodules, gitattributes

The SYNOPSIS section of gitattibutes and gitmodule fail to clearly
specify the name of the in tree files used.  This patch brings in the
initial `.' and the fact that the `.gitmodules' file should reside at
the top-level of the working tree.

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years ago'git foo' program identifies itself without dash in die() messages
Junio C Hamano [Sun, 31 Aug 2008 16:39:19 +0000 (09:39 -0700)]
'git foo' program identifies itself without dash in die() messages

This is a mechanical conversion of all '*.c' files with:

s/((?:die|error|warning)\("git)-(\S+:)/$1 $2/;

The result was manually inspected and no false positive was found.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosetup_git_directory(): fix move to worktree toplevel directory
Nguyễn Thái Ngọc Duy [Sat, 30 Aug 2008 09:15:32 +0000 (16:15 +0700)]
setup_git_directory(): fix move to worktree toplevel directory

When setup_git_directory() returns successfully, it is supposed to move
current working directory to worktree toplevel directory.

However, the code recomputing prefix inside setup_git_directory() has
to move cwd back to original working directory, in order to get new
prefix.  After that, it should move cwd back to worktree toplevel
directory as expected.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoupdate-index: fix worktree setup
Nguyễn Thái Ngọc Duy [Sat, 30 Aug 2008 09:13:58 +0000 (16:13 +0700)]
update-index: fix worktree setup

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoconfig.txt: Add missing colons after option name
Teemu Likonen [Fri, 29 Aug 2008 07:29:42 +0000 (10:29 +0300)]
config.txt: Add missing colons after option name

gitcvs.usecrlfattr --> gitcvs.usecrlfattr::

This fixes an asciidoc markup issue.

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff: Help "less" hide ^M from the output
Junio C Hamano [Thu, 28 Aug 2008 02:48:01 +0000 (19:48 -0700)]
diff: Help "less" hide ^M from the output

When the tracked contents have CRLF line endings, colored diff output
shows "^M" at the end of output lines, which is distracting, even though
the pager we use by default ("less") knows to hide them.

The problem is that "less" hides a carriage-return only at the end of the
line, immediately before a line feed.  The colored diff output does not
take this into account, and emits four element sequence for each line:

   - force this color;
   - the line up to but not including the terminating line feed;
   - reset color
   - line feed.

By including the carriage return at the end of the line in the second
item, we are breaking the smart our pager has in order not to show "^M".
This can be fixed by changing the sequence to:

   - force this color;
   - the line up to but not including the terminating end-of-line;
   - reset color
   - end-of-line.

where end-of-line is either a single linefeed or a CRLF pair.  When the
output is not colored, "force this color" and "reset color" sequences are
both empty, so we won't have this problem with or without this patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitattributes: -crlf is not binary
Junio C Hamano [Sat, 30 Aug 2008 21:35:15 +0000 (14:35 -0700)]
gitattributes: -crlf is not binary

The description of crlf attribute incorrectly said that "-crlf" means
binary.  It is true that for binary files you would want "-crlf", but
that is not the same thing.

We also have supported attribute macros and via that mechanism a handy
"binary" to specify "-crlf -diff" at the same time.  It was not documented
anywhere as far as I can tell, even though the support was there from
the very beginning.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocheckout: do not check out unmerged higher stages randomly
Junio C Hamano [Fri, 29 Aug 2008 20:40:36 +0000 (13:40 -0700)]
checkout: do not check out unmerged higher stages randomly

During a conflicted merge when you have unmerged stages for a
path F in the index, if you said:

    $ git checkout F

we rewrote F as many times as we have stages for it, and the
last one (typically "theirs") was left in the work tree, without
resolving the conflict.

This fixes it by noticing that a specified pathspec pattern
matches an unmerged path, and by erroring out.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoStart conforming code to "git subcmd" style
Heikki Orsila [Sat, 30 Aug 2008 11:12:53 +0000 (14:12 +0300)]
Start conforming code to "git subcmd" style

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-apply: Loosen "match_beginning" logic
Junio C Hamano [Sat, 30 Aug 2008 20:20:31 +0000 (13:20 -0700)]
git-apply: Loosen "match_beginning" logic

Even after a handfle attempts, match_beginning logic still has corner
cases:

    1bf1a85 (apply: treat EOF as proper context., 2006-05-23)
    65aadb9 (apply: force matching at the beginning., 2006-05-24)
    4be6096 (apply --unidiff-zero: loosen sanity checks ..., 2006-09-17)
    ee5a317 (Fix "git apply" to correctly enforce "match ..., 2008-04-06)

This is a tricky piece of code.

We still incorrectly enforce "match_beginning" for -U0 matches.
I noticed this while trying out an example sequence from Clemens Buchacher:

    $ echo a >victim
    $ git add victim
    $ echo b >>victim
    $ git diff -U0 >patch
    $ cat patch
    diff --git i/victim w/victim
    index 7898192..422c2b7 100644
    --- i/victim
    +++ w/victim
    @@ -1,0 +2 @@ a
    +b
    $ git apply --cached --unidiff-zero <patch
    $ git show :victim
    b
    a

The change inserts a new line before the second line, but we insist it to
be applied at the beginning.  As the result, the code refuses to apply it
at the original offset, and we end up adding the line at the beginning.

Updates to the test script are by Clemens Buchacher.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix example in git-name-rev documentation
Junio C Hamano [Sat, 30 Aug 2008 20:08:50 +0000 (13:08 -0700)]
Fix example in git-name-rev documentation

Since 59d3f54 (name-rev: avoid "^0" when unneeded, 2007-02-20), name-rev
stopped showing an unnecessary "^0" to dereference a tag down to a commit.
The patch should have made a matching update to the documentation, but we
forgot.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'sp/missing-thin-base' into maint
Junio C Hamano [Sat, 30 Aug 2008 15:38:19 +0000 (08:38 -0700)]
Merge branch 'sp/missing-thin-base' into maint

* sp/missing-thin-base:
  pack-objects: Allow missing base objects when creating thin packs

15 years agoMerge branch 'af/maint-install-no-handlink' into maint
Junio C Hamano [Sat, 30 Aug 2008 05:39:25 +0000 (22:39 -0700)]
Merge branch 'af/maint-install-no-handlink' into maint

* af/maint-install-no-handlink:
  Fix use of hardlinks in "make install"
  Makefile: always provide a fallback when hardlinks fail

15 years agoshell: do not play duplicated definition games to shrink the executable
Junio C Hamano [Wed, 20 Aug 2008 01:05:39 +0000 (18:05 -0700)]
shell: do not play duplicated definition games to shrink the executable

Playing with linker games to shrink git-shell did not go well with various
other platforms and compilers.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix use of hardlinks in "make install"
Alex Riesen [Thu, 28 Aug 2008 13:57:32 +0000 (15:57 +0200)]
Fix use of hardlinks in "make install"

The code failed to filter-out git-add properly on platforms were $X is
not empty (ATM there is only one such a platform).

Than it tried to create a hardlink to the file ($execdir/git-add) it just
removed (because git-add is first in the BUILT_INS), so ln failed (but
because stderr was redirected into /dev/null the error was never seen), and
the whole install ended up using "ln -s" instead.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofixup_pack_header_footer(): use nicely aligned buffer sizes
Nicolas Pitre [Fri, 29 Aug 2008 20:08:02 +0000 (16:08 -0400)]
fixup_pack_header_footer(): use nicely aligned buffer sizes

It should be more efficient to use nicely aligned buffer sizes, either
for filesystem operations or SHA1 checksums.  Also, using a relatively
small nominal size might allow for the data to remain in L1 cache
between both SHA1_Update() calls.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoindex-pack: use fixup_pack_header_footer()'s validation mode
Nicolas Pitre [Fri, 29 Aug 2008 20:08:01 +0000 (16:08 -0400)]
index-pack: use fixup_pack_header_footer()'s validation mode

When completing a thin pack, a new header has to be written to
the pack and a new SHA1 computed.  Make sure that the SHA1 of what
is being read back matches the SHA1 of what was written for both:
the original pack and the appended objects.

To do so, a couple write_or_die() calls were converted to sha1write()
which has the advantage of doing some buffering as well as handling
SHA1 and CRC32 checksum already.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agopack-objects: use fixup_pack_header_footer()'s validation mode
Nicolas Pitre [Fri, 29 Aug 2008 20:08:00 +0000 (16:08 -0400)]
pack-objects: use fixup_pack_header_footer()'s validation mode

When limiting the pack size, a new header has to be written to the
pack and a new SHA1 computed.  Make sure that the SHA1 of what is being
read back matches the SHA1 of what was written.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoimprove reliability of fixup_pack_header_footer()
Nicolas Pitre [Fri, 29 Aug 2008 20:07:59 +0000 (16:07 -0400)]
improve reliability of fixup_pack_header_footer()

Currently, this function has the potential to read corrupted pack data
from disk and give it a valid SHA1 checksum.  Let's add the ability to
validate SHA1 checksum of existing data along the way, including before
and after any arbitrary point in the pack.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agopack-objects: improve returned information from write_one()
Nicolas Pitre [Fri, 29 Aug 2008 20:07:58 +0000 (16:07 -0400)]
pack-objects: improve returned information from write_one()

This function returns 0 when the current object couldn't be written
due to the pack size limit, otherwise the current offset in the pack.
There is a problem with this approach however, since current object
could be a delta and its delta base might just have been written in
the same write_one() call, but those successfully written objects are
not accounted in the offset variable tracked by the caller. Currently
this is not an issue but a subsequent patch will need this.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'np/verify-pack' into maint
Junio C Hamano [Sat, 30 Aug 2008 04:48:02 +0000 (21:48 -0700)]
Merge branch 'np/verify-pack' into maint

* np/verify-pack:
  discard revindex data when pack list changes

15 years agotutorial: gentler illustration of Alice/Bob workflow using gitk
Paolo Ciarrocchi [Thu, 28 Aug 2008 12:23:52 +0000 (14:23 +0200)]
tutorial: gentler illustration of Alice/Bob workflow using gitk

Update to gitutorial as discussedin the git mailing list:

http://marc.info/?t=121969390900002&r=1&w=2

Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agopretty=format: respect date format options
Jeff King [Fri, 29 Aug 2008 00:54:59 +0000 (20:54 -0400)]
pretty=format: respect date format options

When running a command like:

  git log --pretty=format:%ad --date=short

the date option was ignored. This patch causes it to use whatever
format was specified by --date (or by --relative-date, etc), just
as the non-user formats would do.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomake git-shell paranoid about closed stdin/stdout/stderr
Paolo Bonzini [Wed, 27 Aug 2008 15:20:35 +0000 (17:20 +0200)]
make git-shell paranoid about closed stdin/stdout/stderr

It is in general unsafe to start a program with one or more of file
descriptors 0/1/2 closed.  Karl Chen for example noticed that stat_command
does this in order to rename a pipe file descriptor to 0:

    dup2(from, 0);
    close(from);

... but if stdin was closed (for example) from == 0, so that

    dup2(0, 0);
    close(0);

just ends up closing the pipe.  Another extremely rare but nasty problem
would occur if an "important" file ends up in file descriptor 2, and is
corrupted by a call to die().

Fixing this in git was considered to be overkill, so this patch works
around it only for git-shell.  The fix is simply to open all the "low"
descriptors to /dev/null in main.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Acked-by: Stephen R. van den Berg <srb@cuci.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocument gitk --argscmd flag.
Yann Dirson [Thu, 28 Aug 2008 22:00:28 +0000 (00:00 +0200)]
Document gitk --argscmd flag.

This was part of my original patch, but appears to have been lost.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix '--dirstat' with cross-directory renaming
Linus Torvalds [Thu, 28 Aug 2008 23:19:08 +0000 (16:19 -0700)]
Fix '--dirstat' with cross-directory renaming

The dirstat code depends on the fact that we always generate diffs with
the names sorted, since it then just does a single-pass walk-over of the
sorted list of names and how many changes there were. The sorting means
that all files are nicely grouped by directory.

That all works fine.

Except when we have rename detection, and suddenly the nicely sorted list
of pathnames isn't all that sorted at all. And now the single-pass dirstat
walk gets all confused, and you can get results like this:

  [torvalds@nehalem linux]$ git diff --dirstat=2 -M v2.6.27-rc4..v2.6.27-rc5
     3.0% arch/powerpc/configs/
     6.8% arch/arm/configs/
     2.7% arch/powerpc/configs/
     4.2% arch/arm/configs/
     5.6% arch/powerpc/configs/
     8.4% arch/arm/configs/
     5.5% arch/powerpc/configs/
    23.3% arch/arm/configs/
     8.6% arch/powerpc/configs/
     4.0% arch/
     4.4% drivers/usb/musb/
     4.0% drivers/watchdog/
     7.6% drivers/
     3.5% fs/

The trivial fix is to add a sorting pass, fixing it to:

  [torvalds@nehalem linux]$ git diff --dirstat=2 -M v2.6.27-rc4..v2.6.27-rc5
    43.0% arch/arm/configs/
    25.5% arch/powerpc/configs/
     5.3% arch/
     4.4% drivers/usb/musb/
     4.0% drivers/watchdog/
     7.6% drivers/
     3.5% fs/

Spot the difference. In case anybody wonders: it's because of a ton of
renames from {include/asm-blackfin => arch/blackfin/include/asm} that just
totally messed up the file ordering in between arch/arm and arch/powerpc.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofor-each-ref: Allow a trailing slash in the patterns
Björn Steinbrink [Thu, 28 Aug 2008 02:14:02 +0000 (04:14 +0200)]
for-each-ref: Allow a trailing slash in the patterns

More often than not, I end up using something like refs/remotes/ as the
pattern for for-each-ref, but that doesn't work, because it expects to see
the slash in the ref name right after the matched pattern. So teach it to
accept the slash as the final character in the pattern as well.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoread-tree: setup worktree if merge is required
Nguyễn Thái Ngọc Duy [Thu, 28 Aug 2008 13:03:22 +0000 (20:03 +0700)]
read-tree: setup worktree if merge is required

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: fix worktree setup
Nguyễn Thái Ngọc Duy [Thu, 28 Aug 2008 13:04:30 +0000 (20:04 +0700)]
grep: fix worktree setup

Unless used with --cached or grepping on a tree, "git grep" will
search on working directory, so set up worktree properly

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff*: fix worktree setup
Nguyễn Thái Ngọc Duy [Thu, 28 Aug 2008 13:02:12 +0000 (20:02 +0700)]
diff*: fix worktree setup

This fixes "git diff", "git diff-files" and "git diff-index" to work
correctly under worktree setup. Because diff* family works in many modes
and not all of them require worktree, Junio made a nice summary
(with a little modification from me):

 * diff-files is about comparing with work tree, so it obviously needs a
  work tree;

 * diff-index also does, except "diff-index --cached" or "diff --cached TREE"

 * no-index is about random files outside git context, so it obviously
   doesn't need any work tree;

 * comparing two (or more) trees doesn't;

 * comparing two blobs doesn't;

 * comparing a blob with a random file doesn't;

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoctype.c: protect tiny C preprocessor constants
Junio C Hamano [Wed, 27 Aug 2008 23:14:22 +0000 (16:14 -0700)]
ctype.c: protect tiny C preprocessor constants

Some platforms contaminate the preprocessor token namespace with their own
definition of SS without being asked.  Avoid getting hit by redefinition
warning messages by explicitly undef SS, AA and DD shorthand we use in this
table definition.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoindex-pack: be careful after fixing up the header/footer
Linus Torvalds [Wed, 27 Aug 2008 19:48:00 +0000 (12:48 -0700)]
index-pack: be careful after fixing up the header/footer

The index-pack command, when processing a thin pack, fixed up the pack
after-the-fact.  It forgets to fsync the result, because it only did that
in one path rather in all cases of fixup.

This moves the fsync_or_die() to the fix-up routine itself, rather than
doing it in one of the callers, so that all cases are covered.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoindex-pack: setup git repository
Nguyễn Thái Ngọc Duy [Tue, 26 Aug 2008 14:32:42 +0000 (21:32 +0700)]
index-pack: setup git repository

"git index-pack" is an independent command and does not setup git
repository while still need pack.indexversion. It may miss the
info if it is in a subdirectory of the repository.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSuppress some bash redirection error messages
Ramsay Jones [Tue, 26 Aug 2008 17:52:57 +0000 (18:52 +0100)]
Suppress some bash redirection error messages

In particular, when testing if the filesystem allows tabs in
filenames, bash issues an error something like:

./t4016-diff-quote.sh: pathname with HT: No such file or directory

which is caused by the failure of the (stdout) redirection,
since the file cannot be created. In order to suppress the
error message, you must redirect stderr to /dev/null, *before*
the stdout redirection on the command-line.

Also, remove a redundant filesystem check from the begining of
the t3902-quoted.sh test and standardise the "test skipped"
message to 'say' on exit.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix a warning (on cygwin) to allow -Werror
Ramsay Jones [Tue, 26 Aug 2008 17:50:37 +0000 (18:50 +0100)]
Fix a warning (on cygwin) to allow -Werror

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: always provide a fallback when hardlinks fail
Andreas Färber [Mon, 25 Aug 2008 15:33:03 +0000 (17:33 +0200)]
Makefile: always provide a fallback when hardlinks fail

We make hardlinks from "git" to "git-<cmd>" built-ins and have been
careful to avoid cross-device links when linking "git-<cmd>" to
gitexecdir.

However, we were not prepared to deal with a build directory that is
incapable of making hard links within itself. This patch corrects it.

Instead of temporarily linking "git" to gitexecdir, directly link "git-
add", falling back to "cp". Try hardlinking that as "git-<cmd>", falling
back to symlinks or "cp" on error.

While at it, avoid 100+ error messages from hardlink failures when we are
going to fall back to symlinks or "cp" by redirecting the standard error
to /dev/null.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix "git log -i --grep"
Jeff King [Mon, 25 Aug 2008 06:15:05 +0000 (02:15 -0400)]
Fix "git log -i --grep"

This has been broken in v1.6.0 due to the reorganization of
the revision option parsing code. The "-i" is completely
ignored, but works fine in "git log --grep -i".

What happens is that the code for "-i" looks for
revs->grep_filter; if it is NULL, we do nothing, since there
are no grep filters. But that is obviously not correct,
since we want it to influence the later --grep option. Doing
it the other way around works, since "-i" just impacts the
existing grep_filter option.

Instead, we now always initialize the grep_filter member and
just fill in options and patterns as we get them. This means
that we can no longer check grep_filter for NULL, but
instead must check the pattern list to see if we have any
actual patterns.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.0.1 v1.6.0.1
Junio C Hamano [Sun, 24 Aug 2008 21:47:24 +0000 (14:47 -0700)]
GIT 1.6.0.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'ag/maint-combine-diff-fix' into maint
Junio C Hamano [Sun, 24 Aug 2008 21:32:18 +0000 (14:32 -0700)]
Merge branch 'ag/maint-combine-diff-fix' into maint

* ag/maint-combine-diff-fix:
  Respect core.autocrlf in combined diff

15 years agoMerge branch 'mv/maint-merge-fix' into maint
Junio C Hamano [Sun, 24 Aug 2008 21:29:37 +0000 (14:29 -0700)]
Merge branch 'mv/maint-merge-fix' into maint

* mv/maint-merge-fix:
  merge: fix numerus bugs around "trivial merge" area

15 years agoDocumentation: clarify pager configuration
Jonathan Nieder [Sun, 24 Aug 2008 05:28:32 +0000 (00:28 -0500)]
Documentation: clarify pager configuration

The unwary user may not know how to disable the -FRSX options.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: clarify pager.<cmd> configuration
Jonathan Nieder [Sun, 24 Aug 2008 05:38:06 +0000 (00:38 -0500)]
Documentation: clarify pager.<cmd> configuration

It was not obvious from the text that pager.<cmd> is a boolean
setting.

While we're changing the description, make some other
improvements: lest we forget and fret, clarify that -p and
pager.<cmd> do not kick in when stdout is not a tty; point to
related core.pager and GIT_PAGER settings; use renamed --paginate
option.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoClean up the git-p4 documentation
Simon Hausmann [Sun, 24 Aug 2008 14:12:23 +0000 (16:12 +0200)]
Clean up the git-p4 documentation

This patch massages the documentation a bit for improved readability and cleans
it up from outdated options/commands.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRespect core.autocrlf in combined diff
Alexander Gavrilov [Sat, 23 Aug 2008 19:21:21 +0000 (23:21 +0400)]
Respect core.autocrlf in combined diff

Fix git-diff to make it produce useful 3-way diffs for merge conflicts in
repositories with autocrlf enabled. Otherwise it always reports that the
whole file was changed, because it uses the contents from the working tree
without necessary conversion.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: enable SNPRINTF_RETURNS_BOGUS for HP-UX
Miklos Vajna [Sat, 23 Aug 2008 22:07:55 +0000 (00:07 +0200)]
Makefile: enable SNPRINTF_RETURNS_BOGUS for HP-UX

In 81cc66a, customization has been added to Makefile for supporting
HP-UX, but git commit is still problematic. This should fix the issue.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Acked-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomerge: fix numerus bugs around "trivial merge" area
Junio C Hamano [Sat, 23 Aug 2008 19:56:57 +0000 (12:56 -0700)]
merge: fix numerus bugs around "trivial merge" area

The "trivial merge" codepath wants to optimize itself by making an
internal call to the read-tree machinery, but it does not read the index
before doing so, and the codepath is never exercised.  Incidentally, this
failure to read the index upfront means that the safety to refuse doing
anything when the index is unmerged does not kick in, either.

These two problem are fixed by using read_cache_unmerged() that does read
the index before checking if it is unmerged at the beginning of
cmd_merge().

The primary logic of the merge, however, assumes that the process never
reads the index in-core, and the call to write_cache_as_tree() it makes
from write_tree_trivial() will always read from the on-disk index that is
prepared the strategy back-ends.  This assumption is now broken by the
above fix.  To fix this issue, we now call discard_cache() before calling
write_tree_trivial() when it wants to write the on-disk index as a tree.

When multiple strategies are tried, their results are evaluated by reading
the resulting index and inspecting it.  The codepath needs to make a call
to read_cache() for each successful strategy, and for that to work, they
need to discard_cache() the one read by the previous round.

Also the "trivial merge" forgot that the current commit is one of the
parents of the resulting commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agounpack_trees(): protect the handcrafted in-core index from read_cache()
Junio C Hamano [Sat, 23 Aug 2008 19:57:30 +0000 (12:57 -0700)]
unpack_trees(): protect the handcrafted in-core index from read_cache()

unpack_trees() rebuilds the in-core index from scratch by allocating a new
structure and finishing it off by copying the built one to the final
index.

The resulting in-core index is Ok for most use, but read_cache() does not
recognize it as such.  The function is meant to be no-op if you already
have loaded the index, until you call discard_cache().

This change the way read_cache() detects an already initialized in-core
index, by introducing an extra bit, and marks the handcrafted in-core
index as initialized, to avoid this problem.

A better fix in the longer term would be to change the read_cache() API so
that it will always discard and re-read from the on-disk index to avoid
confusion.  But there are higher level API that have relied on the current
semantics, and they and their users all need to get converted, which is
outside the scope of 'maint' track.

An example of such a higher level API is write_cache_as_tree(), which is
used by git-write-tree as well as later Porcelains like git-merge, revert
and cherry-pick.  In the longer term, we should remove read_cache() from
there and add one to cmd_write_tree(); other callers expect that the
in-core index they prepared is what gets written as a tree so no other
change is necessary for this particular codepath.

The original version of this patch marked the index by pointing an
otherwise wasted malloc'ed memory with o->result.alloc, but this version
uses Linus's idea to use a new "initialized" bit, which is conceptually
much cleaner.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-p4: Fix one-liner in p4_write_pipe function.
Tor Arvid Lund [Thu, 21 Aug 2008 21:11:40 +0000 (23:11 +0200)]
git-p4: Fix one-liner in p4_write_pipe function.

The function built a p4 command string via the p4_build_cmd function, but
ignored the result.

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiscard revindex data when pack list changes
Nicolas Pitre [Fri, 22 Aug 2008 19:45:53 +0000 (15:45 -0400)]
discard revindex data when pack list changes

This is needed to fix verify-pack -v with multiple pack arguments.

Also, in theory, revindex data (if any) must be discarded whenever
reprepare_packed_git() is called. In practice this is hard to trigger
though.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoCompletion: add missing '=' for 'diff --diff-filter'
Eric Raible [Fri, 22 Aug 2008 17:25:06 +0000 (10:25 -0700)]
Completion: add missing '=' for 'diff --diff-filter'

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 agoFix 'git help help'
Miklos Vajna [Thu, 21 Aug 2008 14:21:48 +0000 (16:21 +0200)]
Fix 'git help help'

git help foo invokes man git-foo if foo is a git command, otherwise it
invokes man gitfoo. 'help' is not a git command, but the manual page is
called git-help, so add this special exception.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompat/snprintf.c: handle snprintf's that always return the # chars transmitted
Brandon Casey [Thu, 21 Aug 2008 01:53:50 +0000 (20:53 -0500)]
compat/snprintf.c: handle snprintf's that always return the # chars transmitted

Some platforms provide a horribly broken snprintf. More broken than the
platforms that return -1 when there is too little space in the target buffer
for the formatted string. Some platforms provide an snprintf which _always_
returns the number of characters transmitted to the buffer, regardless of
whether there was enough space or not.

IRIX 6.5 is such a platform. IRIX does have a working snprintf(), but it
is only provided when _NO_XOPEN5 evaluates to zero, and this only happens
if _XOPEN_SOURCE is defined, but definition of _XOPEN_SOURCE prevents
inclusion of many other common functions and defines. So it must be avoided.

Work around these horribly broken snprintf implementations by detecting an
snprintf call which results in the number of transmitted characters exactly
equal to the length of our buffer and retrying with a larger buffer just to
be safe.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: fix dcommit to urls with embedded usernames
Eric Wong [Wed, 20 Aug 2008 07:30:06 +0000 (00:30 -0700)]
git-svn: fix dcommit to urls with embedded usernames

Don't rely on the extracted URL from working_head_info since that has the
username removed.  Instead use the $gs->full_url method (as before with
ba24e74 (git-svn: add ability to specify --commit-url for dcommit,
2008-08-07)) to give us the URL to commit to if --commit-url is not
specified.

Aditionally, since we clean usernames from URLs, checking the URL after
rebase can fail because it doesn't match the URL we used to commit; so
unconditionally provide a username-free URL for checking the result of the
refetch.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorevision.h: make show_early_output an extern which is defined in revision.c
Brandon Casey [Thu, 21 Aug 2008 00:34:30 +0000 (19:34 -0500)]
revision.h: make show_early_output an extern which is defined in revision.c

The variable show_early_output is defined in revision.c and should be
declared extern in revision.h so that the linker does not complain
about multiply defined variables.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate draft release notes for 1.6.0.1
Junio C Hamano [Wed, 20 Aug 2008 22:19:00 +0000 (15:19 -0700)]
Update draft release notes for 1.6.0.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd hints to revert documentation about other ways to undo changes
Tarmigan Casebolt [Tue, 19 Aug 2008 19:50:31 +0000 (12:50 -0700)]
Add hints to revert documentation about other ways to undo changes

Based on its name, people may read the 'git revert' documentation when
they want to undo local changes, especially people who have used other
SCM's.  'git revert' may not be what they had in mind, but git
provides several other ways to undo changes to files.  We can help
them by pointing them towards the git commands that do what they might
want to do.

Cc: Daniel Barkalow <barkalow@iabervon.org>
Cc: Lea Wiemann <lewiemann@gmail.com>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>