Commit graph

12925 commits

Author SHA1 Message Date
Junio C Hamano bd8ff616c9 Merge branch 'maint'
* maint:
  git-send-email: avoid duplicate message-ids
  clone: correctly report http_fetch errors
2007-12-17 20:49:42 -08:00
Johannes Schindelin 34454e858d rebase -p -i: handle "no changes" gracefully
Since commit 376ccb8cbb (rebase -i: style
fixes and minor cleanups), unchanged SHA-1s are no longer mapped via
$REWRITTEN.  But the updating phase was not prepared for the old head
not being rewritten.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-17 20:49:18 -08:00
Johannes Schindelin 77680caadb Document diff.external and mergetool.<tool>.path
There was no documentation for the config variables diff.external
and mergetool.<tool>.path.

Noticed by Sebastian Schuberth.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-17 20:49:18 -08:00
Johannes Schindelin cbe021004f Support config variable diff.external
We had the diff.external variable in the documentation of the config
file since its conception, but failed to respect it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-17 20:49:18 -08:00
Johannes Sixt f029427259 Clean up documentation that references deprecated 'git peek-remote'.
Now that 'git peek-remote' is deprecated and only an alias for
'git ls-remote', it should not be referenced from other manual pages.

This also removes the description of the --exec option, which is no
longer present.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-17 20:49:18 -08:00
Sam Vilain 5f48741a5a Clarify error response from 'git fetch' for bad responses
This error message prints the reponse from the server at this point.
Label it as such in the output.

Signed-off-by: Sam Vilain <sam@vilain.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-17 20:49:18 -08:00
H.Merijn Brand 3175b0cfc1 the use of 'tr' in the test suite isn't really portable
Some versions of 'tr' only accept octal codes if entered with three digits,
and therefor misinterpret the '\0' in the test suite.

Some versions of 'tr' reject the (needless) use of character classes.

Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-17 20:49:18 -08:00
Johannes Sixt 68e6a4f80d Plug a resource leak in threaded pack-objects code.
A mutex and a condition variable is allocated for each thread and torn
down when the thread terminates. However, for certain workloads it can
happen that some threads are actually not started at all. In this case
we would leak the mutex and condition variable. Now we allocate them only
for those threads that are actually started.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-17 16:08:40 -08:00
Jeff King 4f3d37035a git-send-email: avoid duplicate message-ids
We used to unconditionally add a message-id to the outgoing
email without bothering to check if it already had one.
Instead, let's use the existing one.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-17 15:58:05 -08:00
Jeff King 6851162adf clone: correctly report http_fetch errors
The exit status from curl was accidentally lost by the
'case' statement. We need to explicitly save it so that $?
doesn't get overwritten.

This improves the error message when fetching from an http
repository which has never had update-server-info run.
Previously, it would fail to note the fetch error and
produce multiple errors about the lack of origin branches.
It now correctly suggests running git-update-server-info.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-17 15:54:28 -08:00
Junio C Hamano 6fbe42c7ee Documentation/git-submodule: refer to gitmodules(5)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 22:03:21 -08:00
Johannes Sixt 50f22ada52 threaded pack-objects: Use condition variables for thread communication.
In the threaded pack-objects code the main thread and the worker threads
must mutually signal that they have assigned a new pack of work or have
completed their work, respectively. Previously, the code used mutexes that
were locked in one thread and unlocked from a different thread, which is
bogus (and happens to work on Linux).

Here we rectify the implementation by using condition variables: There is
one condition variable on which the main thread waits until a thread
requests new work; and each worker thread has its own condition variable
on which it waits until it is assigned new work or signaled to terminate.

As a cleanup, the worker threads are spawned only after the initial work
packages have been assigned.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 19:26:12 -08:00
Junio C Hamano 3eb2a15eb3 builtin-commit: make summary output consistent with status
This enables -B -M to the summary output after a commit is made so that
it is in line with what is shown in git-status and commit log template.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 15:05:39 -08:00
Junio C Hamano 1596456309 builtin-commit: fix summary output.
Because print_summary() forgot to call diff_setup_done() after futzing with
diff output options, it failed to activate recursive diff, which resulted in
an incorrect summary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 15:03:58 -08:00
J. Bruce Fields b90ced0f7d builtin-apply: stronger indent-with-on-tab fixing
Fix any sequence of 8 spaces in initial indent, not just the case where
the 8 spaces are the first thing on the line.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 14:03:40 -08:00
J. Bruce Fields 95f9b92700 builtin-apply: minor cleanup of whitespace detection
Use 0 instead of -1 for the case where not tabs or spaces are found; it
will make some later math slightly simpler.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 14:03:36 -08:00
Junio C Hamano 079fe1dae8 Re-re-re-fix common tail optimization
We need to be extra careful recovering the removed common section, so
that we do not break context nor the changed incomplete line (i.e. the
last line that does not end with LF).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 14:00:30 -08:00
J. Bruce Fields 127f72e689 whitespace: fix config.txt description of indent-with-non-tab
Fix garbled description.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 13:08:03 -08:00
J. Bruce Fields ffe568859b whitespace: more accurate initial-indent highlighting
Instead of highlighting the entire initial indent, highlight only the
problematic spaces.

In the case of an indent like ' \t \t' there may be multiple problematic
ranges, so it's easiest to emit the highlighting as we go instead of
trying rember disjoint ranges and do it all at the end.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 13:07:58 -08:00
J. Bruce Fields 9afa2d4aa9 whitespace: fix initial-indent checking
After this patch, "written" counts the number of bytes up to and
including the most recently seen tab.  This allows us to detect (and
count) spaces by comparing to "i".

This allows catching initial indents like '\t        ' (a tab followed
by 8 spaces), while previously indent-with-non-tab caught only indents
that consisted entirely of spaces.

This also allows fixing an indent-with-non-tab regression, so we can
again detect indents like '\t \t'.

Also update tests to catch these cases.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 13:07:49 -08:00
J. Bruce Fields 954ecd4353 whitespace: minor cleanup
The variable leading_space is initially used to represent the index of
the last space seen before a non-space.  Then later it represents the
index of the first non-indent character.

It will prove simpler to replace it by a variable representing a number
of bytes.  Eventually it will represent the number of bytes written so
far (in the stream != NULL case).

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 13:07:41 -08:00
J. Bruce Fields 1020999a98 whitespace: reorganize initial-indent check
Reorganize to emphasize the most complicated part of the code (the tab
case).

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 13:07:20 -08:00
J. Bruce Fields 4d9697c787 whitespace: fix off-by-one error in non-space-in-indent checking
If there were no tabs, and the last space was at position 7, then
positions 0..7 had spaces, so there were 8 spaces.

Update test to check exactly this case.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 13:07:14 -08:00
Jeff King d7e522cffb rename git-browse--help to git-help--browse
The convention for helper scripts has been
git-$TOOL--$HELPER. Since this is a "browse" helper for the
"help" tool, git-help--browse is a more sensible name.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 12:52:40 -08:00
李鸿 6ba78238a8 Fix a memory leak
Signed-off-by: Li Hong <leehong@pku.edu.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 12:50:08 -08:00
Petr Baudis bc8b95ae4a gitweb: Make config_to_multi return [] instead of [undef]
This is important for the list of clone urls, where if there are
no per-repository clone URL configured, the default base URLs
are never used for URL construction without this patch.

Add tests for different ways of setting project URLs, just in case.
Note that those tests in current form wouldn't detect breakage fixed
by this patch, as it only checks for errors and not for expected
output.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 11:56:27 -08:00
Jakub Narebski dfa7c7d221 gitweb: Teach "a=blob" action to be more lenient about blob/file mime type
Since 930cf7dd7c 'blob' action knows the
file type; if the file type is not "text/*" or one of common network
image formats/mimetypes (gif, png, jpeg) then the action "blob"
defaulted to "blob_plain".  This caused the problem if mimetypes file
was not well suited for web, for example returning "application/x-sh"
for "*.sh" shell scripts, instead of "text/plain" (or other "text/*").

Now "blob" action defaults to "blob_plain" ('raw' view) only if file
is of type which is neither "text/*" nor "image/{gif,png,jpeg}"
AND it is binary file.  Otherwise it assumes that it can be displayed
either in <img> tag ("image/*" mimetype), or can be displayed line by
line (otherwise).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 11:56:26 -08:00
Jakub Narebski bf901f8e74 gitweb: disambiguate heads and tags withs the same name
Avoid wrong disambiguation that would link logs/trees of tags and
heads which share the same name to the same page, leading to
a disambiguation that would prefer the tag, thus making it impossible
to access the corresponding head log and tree without hacking the url
by hand.

It does it by using full refname (with 'refs/heads/' or 'refs/tags/'
prefix) instead of shortened one in the URLs in 'heads' and 'tags'
tables.  This makes URLs (and refs) provided by gitweb unambiguous.

Signed-off-by: Guillaume Seguin <guillaume@segu.in>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 11:56:26 -08:00
Jeff King 718a087a47 teach bash completion to treat commands with "--" as a helper
There is a convention that commands containing a double-dash
are implementation details and not to be used by mortals. We
should automatically remove them from the completion
suggestions as such.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 11:55:48 -08:00
Jeff King 5249997735 trim_common_tail: brown paper bag fix.
The recovered context lines were not LF terminated due to off-by-one
error, which also caused the outer loop to count the number of recovered
lines to terminate after running only once.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 11:53:03 -08:00
Junio C Hamano 7680087e7c Update draft release notes for 1.5.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 22:30:38 -08:00
Junio C Hamano 530e741c72 Start preparing the API documents.
Most of them are still stubs, but the procedure to build the HTML
documentation, maintaining the index and installing the end product are
there.

I placed names of people who are likely to know the most about the topic
in the stub files, so that volunteers will know whom to ask questions as
needed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 22:29:38 -08:00
Junio C Hamano fa4701601a Retire git-runstatus for real.
The command was removed from the builtin command list and there was no
way to invoke it, but the code was still there.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 22:08:25 -08:00
Junio C Hamano 5b4617c749 Rename git-browse-help helper to git-browse--help
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 22:04:43 -08:00
Christian Couder 70087cdbd3 git-help: add "help.format" config variable.
This config variable makes it possible to choose the default format
used to display help. This format will be used only if no option
like -a|--all|-i|--info|-m|--man|-w|--web is passed to "git-help".

The following values are possible for this variable:

	- "man"  --> "man" program is used
	- "info" --> "info" program is used
	- "web"  --> "git-browse-help" is used

By default we still show help using "man".

This patch also adds -m|--man command line option to use "man"
to allow overriding the "help.format" configuration variable.

Note that this patch also revert some recent changes in
"git-browse-help" because they prevented to look for config
variables in the global configuration file.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:58:35 -08:00
Junio C Hamano dfaf75b469 Merge branch 'wc/diff'
* wc/diff:
  Test interaction between diff --check and --exit-code
  Use shorter error messages for whitespace problems
  Add tests for "git diff --check" with core.whitespace options
  Make "diff --check" output match "git apply"
  Unify whitespace checking
  diff --check: minor fixups
  "diff --check" should affect exit status
2007-12-14 21:42:53 -08:00
Mike Hommey d7e92806cd Move fetch_ref from http-push.c and http-walker.c to http.c
Make the necessary changes to be ok with their difference, and rename the
function http_fetch_ref.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:31:59 -08:00
Mike Hommey 3a462bc9ba Fix various memory leaks in http-push.c and http-walker.c
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:31:59 -08:00
Mike Hommey 028c297638 Use strbuf in http code
Also, replace whitespaces with tabs in some places

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:31:59 -08:00
Mike Hommey e8dc37e0e3 Avoid redundant declaration of missing_target()
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:31:59 -08:00
Mike Hommey 02dc534fc6 Remove a CURLOPT_HTTPHEADER (un)setting
Setting CURLOPT_HTTPHEADER doesn't add HTTP headers, but replaces whatever
set of headers was configured before, so setting to NULL doesn't have any
magic meaning, and is pretty much useless when setting to another list
right after.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:31:59 -08:00
Mike Hommey c20f290808 Remove the default_headers variable from http-push.c
It appears that despite being initialized, it was never used.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:31:59 -08:00
Mike Hommey a096bb18af Fix random sha1 in error message in http-fetch and http-push
When a downloaded ref doesn't contain a sha1, the error message displays
a random sha1 because of uninitialized memory. This happens when cloning
a repository that is already a clone of another one, in which case
refs/remotes/origin/HEAD is a symref.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:31:59 -08:00
Mike Hommey 3b683b91cd Fix some more memory leaks in http-push.c
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:31:58 -08:00
Wincent Colaiuta 5973a07937 Test interaction between diff --check and --exit-code
Make sure that it works as advertised in the man page.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 20:52:26 -08:00
Wincent Colaiuta 420f4f04de Use shorter error messages for whitespace problems
The initial version of the whitespace_error_string() function took the
messages from builtin-apply.c rather than the shorter messages from
diff.c.

This commit addresses Junio's concern that these messages might be too
long (now that we can emit multiple warnings per line).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 20:51:58 -08:00
Kristian Høgsberg cb891a5989 Use a strbuf for building up section header and key/value pair strings.
Avoids horrible 1-byte write(2) calls and cleans up the logic a bit.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 20:42:26 -08:00
David S. Miller 69ae517541 fast-import: fix unalinged allocation and access
The specialized pool allocator fast-import uses aligned objects on the
size of a pointer, which was not sufficient at least on Sparc.  Instead,
make the alignment for objects of type unitmax_t.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 20:39:16 -08:00
Junio C Hamano 896c0535af remote: Fix bogus make_branch() call in configuration reader.
The configuration reader to enumerate branches that have configuration
data were not careful enough and failed to skip "branch.<variable>"
entries (e.g. branch.autosetupmerge).  This resulted in bogus attempt to
allocate huge memory.

Noticed by David Miller.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 20:34:56 -08:00
Junio C Hamano 1eb1e9eea4 commit: allow --amend to reuse message from another commit
After tentatively applying a patch from a contributor, you can get a
replacement patch with corrected code and unusable commit log message.
In such a case, this sequence ought to give you an editor based on the
message in the earlier commit, to let you describe an incremental
improvement:

    git reset --hard HEAD^ ;# discard the earlier one
    git am <corrected-patch
    git commit --amend -c HEAD@{1}

Unfortunately, --amend insisted reusing the message from the commit
being amended, ignoring the -c option.  This corrects it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 15:39:54 -08:00