Commit graph

18663 commits

Author SHA1 Message Date
Marco Nelissen 934f82a7d4 fix handling of iconv configuration options
Fix the way in which the configure script handles --without-iconv
(and --with-iconv=no), which it  used to essentially ignore.
Also fix the way the configure script determines the value of
NEEDS_LIBICONV, which would be incorrectly set to 'YesPlease' on
systems that lack iconv entirely.

Signed-off-by: Marco Nelissen <marcone@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-08 21:18:02 -07:00
Thomas Rast 801a011dcf Documentation: refer to gitworkflows(7) from tutorial and git(1)
Add references to the gitworkflows(7) manpage added in f948dd8
(Documentation: add manpage about workflows, 2008-10-19) to both
gittutorial(1) and git(1), so that new users might actually discover
and read it.

Noticed by Randal L. Schwartz.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-06 13:30:41 -07:00
Shawn O. Pearce 73bb33a94e daemon: Strictly parse the "extra arg" part of the command
Since 1.4.4.5 (49ba83fb67 "Add virtualization support to git-daemon")
git daemon enters an infinite loop and never terminates if a client
hides any extra arguments in the initial request line which is not
exactly "\0host=blah\0".

Since that change, a client must never insert additional extra
arguments, or attempt to use any argument other than "host=", as
any daemon will get stuck parsing the request line and will never
complete the request.

Since the client can't tell if the daemon is patched or not, it
is not possible to know if additional extra args might actually be
able to be safely requested.

If we ever need to extend the git daemon protocol to support a new
feature, we may have to do something like this to the exchange:

  # If both support git:// v2
  #
  C: 000cgit://v2
  S: 0010ok host user
  C: 0018host git.kernel.org
  C: 0027git-upload-pack /pub/linux-2.6.git
  S: ...git-upload-pack header...

  # If client supports git:// v2, server does not:
  #
  C: 000cgit://v2
  S: <EOF>

  C: 003bgit-upload-pack /pub/linux-2.6.git\0host=git.kernel.org\0
  S: ...git-upload-pack header...

This requires the client to create two TCP connections to talk to
an older git daemon, however all daemons since the introduction of
daemon.c will safely reject the unknown "git://v2" command request,
so the client can quite easily determine the server supports an
older protocol.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-06 13:27:52 -07:00
Junio C Hamano 6c7f58d6f6 GIT 1.6.3.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-03 22:47:48 -07:00
René Scharfe 84201eae77 grep: fix empty word-regexp matches
The command "git grep -w ''" dies as soon as it encounters an empty line,
reporting (wrongly) that "regexp returned nonsense".  The first hunk of
this patch relaxes the sanity check that is responsible for that,
allowing matches to start at the end.

The second hunk complements it by making sure that empty matches are
rejected if -w was specified, as they are not really words.

GNU grep does the same:

	$ echo foo | grep -c ''
	1
	$ echo foo | grep -c -w ''
	0

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-03 11:32:29 -07:00
Junio C Hamano a9b2d42486 blame: correctly handle a path that used to be a directory
When trying to see if the same path exists in the parent, we ran
"diff-tree" with pathspec set to the path we are interested in with the
parent, and expect either to have exactly one resulting filepair (either
"changed from the parent", "created when there was none") or nothing (when
there is no change from the parent).

If the path used to be a directory, however, we will also see unbounded
number of entries that talk about the files that used to exist underneath
the directory in question.  Correctly pick only the entry that describes
the path we are interested in in such a case (namely, the creation of the
path as a regular file).

Noticed by Ben Willard.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-03 00:49:34 -07:00
Thomas Rast 8dc3a47c3e add -i: do not dump patch during application
Remove a debugging print that snuck in at 7a26e65 (Revert
"git-add--interactive: remove hunk coalescing", 2009-05-16).

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-03 00:11:15 -07:00
Junio C Hamano 40bad52d7d Update draft release notes for 1.6.3.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-02 08:11:30 -07:00
Junio C Hamano 456cb4cf3e Merge branch 'cb/maint-1.6.0-xdl-merge-fix' into maint
* cb/maint-1.6.0-xdl-merge-fix:
  Change xdl_merge to generate output even for null merges
  t6023: merge-file fails to output anything for a degenerate merge

Conflicts:
	xdiff/xmerge.c
2009-06-02 07:48:44 -07:00
Junio C Hamano 3489428367 Merge branch 'rs/maint-grep-word-regexp-fix' into maint
* rs/maint-grep-word-regexp-fix:
  grep: fix colouring of matches with zero length
  grep: fix word-regexp at the beginning of lines
2009-06-02 07:48:09 -07:00
Junio C Hamano b91ffd37d5 Merge branch 'sb/maint-1.6.2-opt-filename-fix' into maint
* sb/maint-1.6.2-opt-filename-fix:
  apply, fmt-merge-msg: use relative filenames
  commit: -F overrides -t
2009-06-02 07:47:03 -07:00
Junio C Hamano f2823263bd Merge branch 'jc/maint-add-p-coalesce-fix' into maint
* jc/maint-add-p-coalesce-fix:
  t3701: ensure correctly set up repository after skipped tests
  Revert "git-add--interactive: remove hunk coalescing"
  Splitting a hunk that adds a line at the top fails in "add -p"
2009-06-02 07:46:52 -07:00
Junio C Hamano db8af4b5ea Merge branch 'tr/maint-doc-stash-pop' into maint
* tr/maint-doc-stash-pop:
  Documentation: teach stash/pop workflow instead of stash/apply
2009-06-02 07:43:45 -07:00
René Scharfe 1f5b9cc40e grep: fix colouring of matches with zero length
If a zero-length match is encountered, break out of loop and show the rest
of the line uncoloured.  Otherwise we'd be looping forever, trying to make
progress by advancing the pointer by zero characters.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-01 22:30:39 -07:00
Thomas Rast 7b8988e113 Documentation: teach stash/pop workflow instead of stash/apply
Recent discussion on the list showed some comments in favour of a
stash/pop workflow:

  http://marc.info/?l=git&m=124234911423358&w=2
  http://marc.info/?l=git&m=124235348327711&w=2

Change the stash documentation and examples to document pop in its own
right (and apply in terms of pop), and use stash/pop in the examples.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-28 23:52:25 -07:00
Clemens Buchacher 6a01554e63 fix segfault showing an empty remote
In case of an empty list, the search for its tail caused a
NULL-pointer dereference.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Reported-by: Erik Faye-Lund <kusmabite@googlemail.com>
Acked-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-27 23:16:16 -07:00
Junio C Hamano e57cb01582 Prepare for 1.6.3.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 19:20:39 -07:00
Junio C Hamano 2a1feb92ee Merge branch 'js/maint-no-ln-across-libexec-and-bin' into maint
* js/maint-no-ln-across-libexec-and-bin:
  Add NO_CROSS_DIRECTORY_HARDLINKS support to the Makefile

Conflicts:
	Makefile
2009-05-25 19:04:29 -07:00
Junio C Hamano 5e04a1ee33 Merge branch 'lt/maint-diff-reduce-lstat' into maint
* lt/maint-diff-reduce-lstat:
  Teach 'git checkout' to preload the index contents
  Avoid unnecessary 'lstat()' calls in 'get_stat_data()'
2009-05-25 19:04:08 -07:00
Junio C Hamano 597a178246 Merge branch 'jm/format-patch-no-auto-n-when-k-is-given' into maint
* jm/format-patch-no-auto-n-when-k-is-given:
  format-patch let -k override a config-specified format.numbered
2009-05-25 19:03:52 -07:00
Junio C Hamano 5c44cc9ea2 Merge branch 'do/maint-merge-recursive-fix' into maint
* do/maint-merge-recursive-fix:
  merge-recursive: never leave index unmerged while recursing
2009-05-25 19:03:43 -07:00
Junio C Hamano 417653777a Merge branch 'jk/maint-1.6.0-trace-argv' into maint
* jk/maint-1.6.0-trace-argv:
  fix GIT_TRACE segfault with shell-quoted aliases

Conflicts:
	alias.c
2009-05-25 19:03:20 -07:00
Junio C Hamano 4619136c8b Merge branch 'np/push-delta' into maint
* np/push-delta:
  allow OFS_DELTA objects during a push
2009-05-25 19:02:11 -07:00
Junio C Hamano e82f625416 Merge branch 'ar/merge-one-file-diag' into maint
* ar/merge-one-file-diag:
  Clarify kind of conflict in merge-one-file helper
2009-05-25 19:01:59 -07:00
Junio C Hamano 2c5942dbae Merge branch 'ar/unlink-err' into maint
* ar/unlink-err:
  print unlink(2) errno in copy_or_link_directory
  replace direct calls to unlink(2) with unlink_or_warn
  Introduce an unlink(2) wrapper which gives warning if unlink failed
2009-05-25 19:01:50 -07:00
Junio C Hamano 43f8f560c0 Merge branch 'jk/maint-add-empty' into maint
* jk/maint-add-empty:
  add: don't complain when adding empty project root
2009-05-25 19:01:41 -07:00
Jeff King 0e5168fd18 fix cat-file usage message and documentation
cat-file with an object on the command line requires an
option to tell it what to output (type, size, pretty-print,
etc). However, the square brackets in the usage imply that
those options are not required. This patch switches them to
parentheses to indicate "required but grouped-OR" (curly
braces might also work, but this follows the convention used
already by "git stash").

While we're at it, let's change the <sha1> specifier in the
usage to <object>. That's what the documentation uses, and
it does actually use the regular object lookup.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 12:08:15 -07:00
Jeff King fa25075979 fetch: report ref storage DF errors more accurately
When we fail to store a fetched ref, we recommend that the
user try running "git prune" to remove up any old refs that
have been deleted by the remote, which would clear up any DF
conflicts. However, ref storage might fail for other
reasons (e.g., permissions problems) in which case the
advice is useless and misleading.

This patch detects when there is an actual DF situation and
only issues the advice when one is found.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 12:07:07 -07:00
Jeff King f475e08edb lock_ref: inform callers of unavailable ref
One of the ways that locking might fail is that there is a
DF conflict between two refs (e.g., you want to lock
"foo/bar" but "foo" already exists). In this case, we return
an error, but there is no way for the caller to know the
specific problem.

This patch sets errno to ENOTDIR, which is the most sensible
code. It's what we would see if the refs were stored purely
in the filesystem (but these days we must check the
namespace manually due to packed refs).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 12:06:54 -07:00
Johannes Sixt 32a90233d1 t3701: ensure correctly set up repository after skipped tests
There are two tests that are skipped if file modes are not obeyed by the
file system. In this case, the subsequent test failed because the
repository was in an unexpected state. This corrects it.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 11:23:30 -07:00
Michael J Gruber f5d4c4d0f1 merge-options.txt: Clarify merge --squash
With the --squash option, merge sets up the index just like for a real
merge, but without the merge info (stages). Say so.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 11:23:18 -07:00
Charles Bailey 5719db91ce Change xdl_merge to generate output even for null merges
xdl_merge used to have a check to ensure that there was at least
some change in one or other side being merged but this suppressed
output for the degenerate case when base, local and remote
contents were all identical.

Removing this check enables correct output in the degenerate case
and xdl_free_script handles freeing NULL scripts so there is no
need to have the check for these calls.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-24 23:56:34 -07:00
Charles Bailey 1cd12926ce t6023: merge-file fails to output anything for a degenerate merge
In the case that merge-file is passed three files with identical
contents it wipes the contents of the output file instead of
leaving it unchanged.

Althought merge-file is porcelain and this will never happen in
normal usage, it is still wrong.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-24 23:46:03 -07:00
Junio C Hamano f5b223abfd Merge branch 'maint-1.6.2' into maint
* maint-1.6.2:
  http-push.c::remove_locks(): fix use after free
2009-05-24 15:29:33 -07:00
Junio C Hamano 34ab57df97 Merge branch 'maint-1.6.1' into maint-1.6.2
* maint-1.6.1:
  http-push.c::remove_locks(): fix use after free
2009-05-24 15:29:23 -07:00
Junio C Hamano ff6e93fe60 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  http-push.c::remove_locks(): fix use after free
2009-05-24 15:29:13 -07:00
Alex Riesen 6589ebf107 http-push.c::remove_locks(): fix use after free
Noticed and reported by Serhat Şevki Dinçer.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-24 11:08:31 -07:00
René Scharfe dbb6a4ada6 grep: fix word-regexp at the beginning of lines
After bol is forwarded, it doesn't represent the beginning of the line
any more.  This means that the beginning-of-line marker (^) mustn't match,
i.e. the regex flag REG_NOTBOL needs to be set.

This bug was introduced by fb62eb7fab
("grep -w: forward to next possible position after rejected match").

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-23 16:29:05 -07:00
Stephen Boyd 4c8d4c14c6 apply, fmt-merge-msg: use relative filenames
Commit dbd0f5c7 (Files given on the command line are relative to $cwd,
2008-08-06) only fixed git-commit and git-tag. But, git-apply and
git-fmt-merge-msg didn't get the update and exhibit the same behavior.

Fix them and add tests for "apply --build-fake-ancestor" and
"fmt-merge-msg -F".

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-23 15:45:52 -07:00
Stephen Boyd aae94ffbc1 commit: -F overrides -t
Commit dbd0f5c7 (Files given on the command line are relative to $cwd,
2008-08-06) introduced parse_options_fix_filename() as a quick fix for
filename arguments used in the parse options API.

git-commit was still broken. This means

    git commit -F log -t temp

in a subdirectory would make git think the log message should be taken
from temp instead of log.

This is because parse_options_fix_filename() calls prefix_filename()
which uses a single static char buffer to do its work. Making two calls
with two char pointers causes the pointers to alias. To prevent
aliasing, we duplicate the string returned by
parse_options_fix_filename().

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-23 15:45:52 -07:00
René Scharfe e701fadb9e grep: fix word-regexp colouring
As noticed by Dmitry Gryazin: When a pattern is found but it doesn't
start and end at word boundaries, bol is forwarded to after the match and
the pattern is searched again.  When a pattern is finally found between
word boundaries, the match offsets are off by the number of characters
that have been skipped.

This patch corrects the offsets to be relative to the value of bol as
passed to match_one_pattern() by its caller.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-20 18:49:20 -07:00
Giuseppe Bilotta 8dfb17e1fd completion: use git rev-parse to detect bare repos
Its check is more robust than a config check for core.bare

Trivially-Acked-by: Shawn O. Pearce <spearce@spearce.org>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-20 18:35:23 -07:00
Johannes Schindelin fd73ccf279 Cope better with a _lot_ of packs
You might end up with a situation where you have tons of pack files, e.g.
when using hg2git.  In this situation, all kinds of operations may
end up with a "too many files open" error.  Let's recover gracefully from
that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Looks-right-to-me-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-20 18:23:06 -07:00
Jeff King e64c1b0053 for-each-ref: fix segfault in copy_email
You can trigger a segfault in git.git by doing:

  git for-each-ref --format='%(taggeremail)' refs/tags/v0.99

The v0.99 tag is special in that it contains no "tagger"
header.

The bug is obvious in copy_email, which carefully checks to
make sure the result of a strchr is non-NULL, but only after
already having used it to perform other work. The fix is to
move the check up.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-20 00:06:19 -07:00
Stephen Boyd 5acb3e5012 show-branch: Fix die message in parse_reflog_param()
Commit 76a44c5 (show-branch --reflog: show the reflog message at the
top, 2007-01-19) introduced parse_reflog_param(). The die() call was
incorrectly passed arg + 9, when it should have been passed arg.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-17 12:05:22 -07:00
Stephen Boyd 076c32370d completion: add missing options to show-branch and show
Add --oneline and --abbrev-commit to show and --sparse to show-branch.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 22:46:22 -07:00
Linus Torvalds da4b3e8c28 dir.c: clean up handling of 'path' parameter in read_directory_recursive()
Right now we pass two different pathnames ('path' and 'base') down to
read_directory_recursive(), and the only real reason for that is that we
want to allow an empty 'base' parameter, but when we do so, we need the
pathname to "opendir()" to be "." rather than the empty string.

And rather than handle that confusion in the caller, we can just fix
read_directory_recursive() to handle the case of an empty path itself,
by just passing opendir() a "." ourselves if the path is empty.

This would allow us to then drop one of the pathnames entirely from the
calling convention, but rather than do that, we'll start separating them
out as a "filesystem pathname" (the one we use for filesystem accesses)
and a "git internal base name" (which is the name that we use for git
internally).

That will eventually allow us to do things like handle different
encodings (eg the filesystem pathnames might be Latin1, while git itself
would use UTF-8 for filename information).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 22:41:46 -07:00
Dan McGee b867d324ce Fix type-punning issues
In these two places we are casting part of our unsigned char sha1 array into
an unsigned int, which violates GCCs strict-aliasing rules (and probably
other compilers).

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 22:41:18 -07:00
Nanako Shiraishi e4b09dad9f test: checkout shouldn't say that HEAD has moved if it didn't
Signed-off-by: しらいしななこ <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 19:49:25 -07:00
Junio C Hamano dd42c2f015 completion: enhance "current branch" display
Introduce GIT_PS1_DESCRIBE option you can set to "contains", "branch", or
"describe" to tweak the way how a detached HEAD is described.

The default behaviour is to describe only exact match with some tag
(otherwise use the first 7 hexdigits) as before.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 19:46:31 -07:00