Commit graph

18711 commits

Author SHA1 Message Date
Michal Marek 653a31c16a request-pull: really really disable pager
Earlier 476cc72 (request-pull: really disable pager, 2009-06-30)
tried to use the correct environment variable to disable paging
from multiple calls to "git log" and friends, but there was one
extra call to "git log" that was not covered by the trick.

Move the setting and exporting of GIT_PAGER much earlier in the
script to cover everybody.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-01 13:20:00 -07:00
René Scharfe d4c985653a attr: plug minor memory leak
Free the memory allocated for struct strbuf pathbuf when we're done.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 16:12:24 -07:00
Junio C Hamano 476cc72424 request-pull: really disable pager
ff06c74 (Improve request-pull to handle non-rebased branches, 2007-05-01)
attempted to disable pager when running subcommands in this script, but
with a wrong variable.  If GIT_PAGER is set, it takes precedence over
PAGER.

Noticed by Michal Marek.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 11:33:30 -07:00
Thadeu Lima de Souza Cascardo 21d777f257 Makes some cleanup/review in gittutorial
There are some different but little cleanup changes to fix some missing
quotes, to fix what seemed to be an unended sentence, to reident a
little paragraph with too large a sentence and fix a branch name that
was referred to twice later by another name.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 11:17:55 -07:00
Johannes Sixt fe104986c6 Makefile: git.o depends on library headers
This dependency was not yet specified anywhere else.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 11:17:54 -07:00
Miklos Vajna 1c3acfcd57 git-submodule documentation: fix foreach example
Backtick and apostrophe are asciidoc markup, so they should be escaped
in order to get the expected result in the rendered manual page.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 11:17:54 -07:00
Giuseppe Bilotta 1bed73c64a gitweb/README: fix AliasMatch in example
When combining "dumb client" and human-friendly access by using the
'.git' extension to switch between the two, make sure the AliasMatch
covers the entire request. Without a full match, a request for

http://git.example.com/project/shortlog/branch..gitsomething

would result in a 404 because the server would try to access the
the project 'project/shortlog/branch.'

The solution is still not bulletproof, so document the possible failing
case.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 13:15:57 -07:00
Thomas Rast 0f7050469b Test grep --and/--or/--not
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 13:15:41 -07:00
Thomas Rast 4813926921 Test git archive --remote
Add a small test case for git archive --remote (and thus
git-upload-archive), which so far went untested.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 13:15:39 -07:00
Roel Kluin 6651c3f706 fread does not return negative on error
size_t res cannot be less than 0. fread returns 0 on error.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-23 16:57:15 -07:00
Johannes Sixt 1ab012cf81 t3700-add: add a POSIXPERM prerequisite to a new test
The new test does a 'chmod 0', which does not have the intended
effect on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-22 00:44:14 -07:00
Junio C Hamano d1f6c18bd6 Merge branch 'sb/maint-1.6.0-add-config-fix' into maint
* sb/maint-1.6.0-add-config-fix:
  add: allow configurations to be overriden by command line
2009-06-22 00:44:09 -07:00
Junio C Hamano cff4231a1d GIT 1.6.3.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-21 21:15:50 -07:00
Junio C Hamano a69f8c9809 Merge branch 'ak/maint-for-each-ref-no-lookup' into maint
* ak/maint-for-each-ref-no-lookup:
  for-each-ref: Do not lookup objects when they will not be used
2009-06-21 21:15:39 -07:00
Junio C Hamano be273c73b7 Merge branch 'rc/maint-http-local-slot-fix' into maint
* rc/maint-http-local-slot-fix:
  http*: cleanup slot->local after fclose
2009-06-21 21:15:31 -07:00
Junio C Hamano d836118be9 Merge branch 'cb/maint-no-double-merge' into maint
* cb/maint-no-double-merge:
  refuse to merge during a merge
2009-06-21 21:15:27 -07:00
Junio C Hamano 6019b3ce8d Merge branch 'mn/maint-iconv-autoconf' into maint
* mn/maint-iconv-autoconf:
  fix handling of iconv configuration options
2009-06-21 21:14:25 -07:00
Junio C Hamano 44fb185963 Merge branch 'lt/maint-unsigned-left-shift' into maint
* lt/maint-unsigned-left-shift:
  Fix big left-shifts of unsigned char
2009-06-21 21:14:09 -07:00
Junio C Hamano 037e9d5b15 Merge branch 'pb/maint-1.6.2-userdiff-fix' into maint
* pb/maint-1.6.2-userdiff-fix:
  upload-archive: fix infinite loop on Cygwin
  avoid exponential regex match for java and objc function names
2009-06-21 21:08:05 -07:00
Junio C Hamano a437900fd7 attribute: whitespace set to true detects all errors known to git
That is what the documentation says, but the code pretends as if all the
known whitespace error tokens were given.

Among the whitespace error tokens, there is one kind that loosens the rule
when set: cr-at-eol.  Which means that whitespace error token that is set
to true ignores a newly introduced CR at the end, which is inconsistent
with the documentation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-21 10:43:10 -07:00
Nanako Shiraishi e2f6331a14 .gitattributes: CR at the end of the line is an error
When a CR is accidentally added at the end of a C source file in the git
project tree, "git diff --check" doesn't detect it as an error.

    $ echo abQ | tr Q '\015' >>fast-import.c
    $ git diff --check

I think this is because the "whitespace" attribute is set to *.[ch] files
without specifying what kind of errors are caught. It makes git "notice
all types of errors" (as described in the documentation), but I think it
is incorrectly setting cr-at-eol, too, and hides this error.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-21 10:42:37 -07:00
Junio C Hamano c6720cfa49 t3505: fix abuse of test_expect_code
The test wanted to make sure that cherry-pick exits with status 1,
but with the way it was placed after "git checkout master &&" meant
that it could have misjudged success if checkout barfed with the
same failure status.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-21 02:01:28 -07:00
Junio C Hamano 3ba4f3a9fc Merge branch 'maint-1.6.2' into maint
* maint-1.6.2:
  git-show-ref.txt: remove word and make consistent
  git-svn documentation: fix typo in 'rebase vs. pull/merge' section
  use xstrdup, not strdup in ll-merge.c
2009-06-20 23:48:46 -07:00
Junio C Hamano cd12f53612 Merge branch 'maint-1.6.1' into maint-1.6.2
* maint-1.6.1:
  git-show-ref.txt: remove word and make consistent
  git-svn documentation: fix typo in 'rebase vs. pull/merge' section
  use xstrdup, not strdup in ll-merge.c
2009-06-20 23:48:28 -07:00
Junio C Hamano 4258c212ca Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  git-show-ref.txt: remove word and make consistent
  git-svn documentation: fix typo in 'rebase vs. pull/merge' section
  use xstrdup, not strdup in ll-merge.c
2009-06-20 23:48:21 -07:00
Stephen Boyd d4900ee48c git-show-ref.txt: remove word and make consistent
Under is better than in because of the nested nature of the .git
directory.

"also using" sounds a little odd, plus we say combined with later on so
just use that.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-20 23:45:51 -07:00
Miklos Vajna ccf497de97 git-svn documentation: fix typo in 'rebase vs. pull/merge' section
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-20 21:20:51 -07:00
Stephen Boyd ed342fdea0 add: allow configurations to be overriden by command line
Don't call git_config after parsing the command line options, otherwise
the config settings will override any settings made by the command line.

This can be seen by setting add.ignore_errors and then specifying
--no-ignore-errors when using git-add.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-18 12:20:36 -07:00
Mark Lodato ef52aafa0f http.c: fix compiling with libcurl 7.9.2
Change the minimimum required libcurl version for the http.sslKey option
to 7.9.3.  Previously, preprocessor macros checked for >= 7.9.2, which
is incorrect because CURLOPT_SSLKEY was introduced in 7.9.3.  This now
allows git to compile with libcurl 7.9.2.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-18 10:10:30 -07:00
Johannes Schindelin 6fb37f86bc import-tars: support symlinks
Without this patch, symbolic links are turned into empty files.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-18 09:53:53 -07:00
René Scharfe 1b19fa4634 upload-archive: fix infinite loop on Cygwin
On Cygwin, poll() reports POLLIN even for file descriptors that have
reached their end.  This caused git upload-archive to be stuck in an
infinite loop, as it only looked at the POLLIN flag.

In addition to POLLIN, check if read() returned 0, which indicates
end-of-file, and keep looping only as long as at least one of the file
descriptors has input.  This lets the following command finish on its
own when run in a git repository on Cygwin, instead of it getting stuck
after printing all file names:

	$ git archive -v --remote . HEAD >/dev/null

Reported-by: Bob Kagy <bobkagy@gmail.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-18 09:52:28 -07:00
Paolo Bonzini 959e2e64a5 avoid exponential regex match for java and objc function names
In the old regex

^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\([^;]*)$
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

you can backtrack arbitrarily from [A-Za-z_0-9]* into [A-Za-z_], thus
causing an exponential number of backtracks.  Ironically it also causes
the regex not to work as intended; for example "catch" can match the
underlined part of the regex, the first repetition matching "c" and
the second matching "atch".

The replacement regex avoids this problem, because it makes sure that
at least a space/tab is eaten on each repetition.  In other words,
a suffix of a repetition can never be a prefix of the next repetition.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-18 09:52:10 -07:00
Linus Torvalds 48fb7deb5b Fix big left-shifts of unsigned char
Shifting 'unsigned char' or 'unsigned short' left can result in sign
extension errors, since the C integer promotion rules means that the
unsigned char/short will get implicitly promoted to a signed 'int' due to
the shift (or due to other operations).

This normally doesn't matter, but if you shift things up sufficiently, it
will now set the sign bit in 'int', and a subsequent cast to a bigger type
(eg 'long' or 'unsigned long') will now sign-extend the value despite the
original expression being unsigned.

One example of this would be something like

	unsigned long size;
	unsigned char c;

	size += c << 24;

where despite all the variables being unsigned, 'c << 24' ends up being a
signed entity, and will get sign-extended when then doing the addition in
an 'unsigned long' type.

Since git uses 'unsigned char' pointers extensively, we actually have this
bug in a couple of places.

I may have missed some, but this is the result of looking at

	git grep '[^0-9 	][ 	]*<<[ 	][a-z]' -- '*.c' '*.h'
	git grep '<<[   ]*24'

which catches at least the common byte cases (shifting variables by a
variable amount, and shifting by 24 bits).

I also grepped for just 'unsigned char' variables in general, and
converted the ones that most obviously ended up getting implicitly cast
immediately anyway (eg hash_name(), encode_85()).

In addition to just avoiding 'unsigned char', this patch also tries to use
a common idiom for the delta header size thing. We had three different
variations on it: "& 0x7fUL" in one place (getting the sign extension
right), and "& ~0x80" and "& 0x7f" in two other places (not getting it
right). Apart from making them all just avoid using "unsigned char" at
all, I also unified them to then use a simple "& 0x7f".

I considered making a sparse extension which warns about doing implicit
casts from unsigned types to signed types, but it gets rather complex very
quickly, so this is just a hack.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-18 09:22:46 -07:00
Stephen Boyd bc2bbc4542 pull, rebase: simplify to use die()
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-14 21:14:10 -07:00
Jim Meyering 90dce51584 use xstrdup, not strdup in ll-merge.c
Otherwise, a fluky allocation failure would cause merge
configuration settings to be silently ignored.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-14 13:37:14 -07:00
Junio C Hamano 50a991ec46 Merge branch 'maint-1.6.2' into maint
* maint-1.6.2:
  git-rerere.txt: grammatical fixups and cleanups
2009-06-13 17:10:08 -07:00
Junio C Hamano 9b7dc71835 Merge branch 'maint-1.6.1' into maint-1.6.2
* maint-1.6.1:
  git-rerere.txt: grammatical fixups and cleanups
2009-06-13 17:09:50 -07:00
Junio C Hamano dfe50511c7 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  git-rerere.txt: grammatical fixups and cleanups
  http-push.c::remove_locks(): fix use after free
2009-06-13 17:09:45 -07:00
Stephen Boyd c97038d1cf git-rerere.txt: grammatical fixups and cleanups
Rewrite the gc section using unresolved and resolved instead of "not
recorded". Add plurals and missing articles. Make some sentences have
consistent tense. Try and be more active by removing "that" and
simplifying sentences.

The terms "hand-resolve" and "hand resolve" were used, so just use "hand
resolve" to be more consistent.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-13 12:44:41 -07:00
Paolo Bonzini 94af7c31a5 Documentation: git-send-mail can take rev-list arg to drive format-patch
The git-send-email docs do not mention except in the usage lines
the combined patch formatting/sending ability of git-send-email.
This patch expands on the possible arguments to git-send-email
and explains the meaning of the rev-list argument.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-11 23:35:05 -07:00
Junio C Hamano a0c0447b8e Merge branch 'uk/maint-1.5.3-rebase-i-reflog' into maint
* uk/maint-1.5.3-rebase-i-reflog:
  rebase--interactive: remote stray closing parenthesis

Conflicts:
	git-rebase--interactive.sh
2009-06-11 14:14:00 -07:00
Uwe Kleine-König 795cbe938f rebase--interactive: remote stray closing parenthesis
it was introduced in 68a163c9b4

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Jöhännës "Dschö" Schindëlin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-11 14:01:15 -07:00
Johannes Sixt 802f9c9cb2 diff.c: plug a memory leak in an error path
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-08 21:19:26 -07:00
Johannes Sixt 3ef67cf250 fetch-pack: close output channel after sideband demultiplexer terminates
fetch-pack runs the sideband demultiplexer using start_async(). This
facility requires that the asynchronously executed function closes the
output file descriptor (see Documentation/technical/api-run-command.txt).
But the sideband demultiplexer did not do that. This fixes it.

In certain error situations this could lock up a fetch operation on
Windows because the asynchronous function is run in a thread; by not
closing the output fd the reading end never got EOF and waited for more
data indefinitely. On Unix this is not a problem because the asynchronous
function is run in a separate process, which exits after the function ends
and so implicitly closes the output.

Since the pack that is sent over the wire encodes the number of objects in
the stream, during normal operation the reading end knows when the stream
ends and terminates by itself, and does not lock up.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-08 21:18:41 -07:00
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
Michael J Gruber 956d27a872 builtin-remote: Make "remote show" display all urls
Currently, "git remote -v" lists all urls whereas "git remote show
$remote" shows only the first. Make it so that both show all.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-08 15:01:12 -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
Tay Ray Chuan 16493eb0d0 http*: cleanup slot->local after fclose
Set slot->local to NULL after doing a fclose() on the file it points
to. This prevents the passing of a FILE* pointer to a fclose()'d file
to ftell() in http.c::run_active_slot().

This issue was raised by Clemens Buchacher on 30th May 2009:

  http://www.spinics.net/lists/git/msg104623.html

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-06 10:30:16 -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