1
0
mirror of https://github.com/git/git.git synced 2024-10-01 14:11:31 +02:00
Commit Graph

12791 Commits

Author SHA1 Message Date
Junio C Hamano
9b433e4496 Merge branch 'maint'
* maint:
  config.c:store_write_pair(): don't read the byte before a malloc'd buffer.
2007-12-09 00:56:44 -08:00
Junio C Hamano
774751a8bc Re-fix "builtin-commit: fix --signoff"
An earlier fix to the said commit was incomplete; it mixed up the
meaning of the flag parameter passed to the internal fmt_ident()
function, so this corrects it.

git_author_info() and git_committer_info() can be told to issue a
warning when no usable user information is found, and optionally can be
told to error out.  Operations that actually use the information to
record a new commit or a tag will still error out, but the caller to
leave reflog record will just silently use bogus user information.

Not warning on misconfigured user information while writing a reflog
entry is somewhat debatable, but it is probably nicer to the users to
silently let it pass, because the only information you are losing is who
checked out the branch.

 * git_author_info() and git_committer_info() used to take 1 (positive
   int) to error out with a warning on misconfiguration; this is now
   signalled with a symbolic constant IDENT_ERROR_ON_NO_NAME.

 * These functions used to take -1 (negative int) to warn but continue;
   this is now signalled with a symbolic constant IDENT_WARN_ON_NO_NAME.

 * fmt_ident() function implements the above error reporting behaviour
   common to git_author_info() and git_committer_info().  A symbolic
   constant IDENT_NO_DATE can be or'ed in to the flag parameter to make
   it return only the "Name <email@address.xz>".

 * fmt_name() is a thin wrapper around fmt_ident() that always passes
   IDENT_ERROR_ON_NO_NAME and IDENT_NO_DATE.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-09 00:55:55 -08:00
Wincent Colaiuta
264474f29a Add tests for pre-commit and commit-msg hooks
As desired, these pass for git-commit.sh, fail for builtin-commit (prior
to the fixes), and succeeded for builtin-commit (after the fixes).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-09 00:55:55 -08:00
Junio C Hamano
740001a578 Fix commit-msg hook to allow editing
The old git-commit.sh script allowed the commit-msg hook to not only
prevent a commit from proceding, but also to edit the commit message
on the fly and allow it to proceed. So here we teach builtin-commit
to do the same.

This is based on Wincent's patch, but redone with a clarified logic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-09 00:55:55 -08:00
Wincent Colaiuta
aa6da6cddb Documentation: fix --no-verify documentation for "git commit"
The documentation for the --no-verify switch should mention the
commit-msg hook, not just the pre-commit hook.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-09 00:55:54 -08:00
Wincent Colaiuta
6b95655d7d Allow --no-verify to bypass commit-msg hook
At the moment the --no-verify switch to "git commit" instructs it to
skip over the pre-commit hook. Here we teach "git commit --no-verify"
to skip over the commit-msg hook as well. This brings the behaviour
of builtin-commit back in line with git-commit.sh.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-09 00:55:54 -08:00
Junio C Hamano
2ea7fe0d2c ls-remote: resurrect pattern limit support
"git ls-remote $remote $name1 $name2..." used to limit the output to
refs that end with one of the $name given from the command line, but
recent rewrite to C forgot to implement that support.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-09 00:55:46 -08:00
Jim Meyering
6281f39467 config.c:store_write_pair(): don't read the byte before a malloc'd buffer.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 14:24:13 -08:00
Junio C Hamano
1e931cb4d1 shortlog: code restructuring and clean-up
The code tried to parse and clean-up the author name and the one line
information in three places (two callers of insert_author_oneline() and
the called function itself), which was a mess.

This renames the callee to insert_one_record() and make it responsible
for cleaning up the author name and one line information.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 11:31:17 -08:00
Junio C Hamano
fd99b36134 mailmap: fix bogus for() loop that happened to be safe by accident
The empty loop pretended to have an empty statement as its body by a
phony indentation, but in fact was slurping the next statement into it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 03:40:12 -08:00
Nicolas Pitre
384b32c09b pack-objects: fix threaded load balancing
The current method consists of a master thread serving chunks of objects
to work threads when they're done with their previous chunk.  The issue
is to determine the best chunk size: making it too large creates poor
load balancing, while making it too small has a negative effect on pack
size because of the increased number of chunk boundaries and poor delta
window utilization.

This patch implements a completely different approach by initially
splitting the work in large chunks uniformly amongst all threads, and
whenever a thread is done then it steals half of the remaining work from
another thread with the largest amount of unprocessed objects.

This has the advantage of greatly reducing the number of chunk boundaries
with an almost perfect load balancing.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 03:38:36 -08:00
Nicolas Pitre
b904166ccb pack-objects: reverse the delta search sort list
It is currently sorted and then walked backward.  Not only this doesn't
feel natural for my poor brain, but it would make the next patch less
obvious as well.

So reverse the sort order, and reverse the list walking direction,
which effectively produce the exact same end result as before.

Also bring the relevant comment nearer the actual code and adjust it
accordingly, with minor additional clarifications.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 03:38:35 -08:00
Nicolas Pitre
b7a28f7827 pack-objects: fix delta cache size accounting
The wrong value was substracted from delta_cache_size when replacing
a cached delta, as trg_entry->delta_size was used after the old size
had been replaced by the new size.

Noticed by Linus.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 03:38:35 -08:00
Jeff King
2099bca9ed git-status: documentation improvements
This patch is the result of reading over git-status with an
editorial eye:

  - fix a few typo/grammatical errors
  - mention untracked output
  - present output types in the order they appear from the
    command

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 03:33:24 -08:00
Jeff King
46f721c8fe add status.relativePaths config variable
The output of git-status was recently changed to output relative
paths. Setting this variable to false restores the old behavior for
any old-timers that prefer it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 03:33:24 -08:00
Jeff King
c3ce326128 wt-status.c:quote_path(): convert empty path to "./"
Now that we are correctly removing leading prefixes from files in git
status, there is a degenerate case: the directory matching the prefix.
Because we show only the directory name for a directory that contains
only untracked files, it gets collapsed to an empty string.

Example:

  $ git init
  $ mkdir subdir
  $ touch subdir/file
  $ git status
  ...
  # Untracked files:
  #   (use "git add <file>..." to include in what will be committed)
  #
  #       subdir/

  So far, so good.

  $ cd subdir
  $ git status
  ....
  # Untracked files:
  #   (use "git add <file>..." to include in what will be committed)
  #
  #

  Oops, that's a bit confusing.

  This patch prints './' to show that there is some output.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 03:33:24 -08:00
Junio C Hamano
235997c90f git-bisect visualize: work in non-windowed environments better
This teaches "git bisect visualize" to be more useful in non-windowed
environments.

 (1) When no option is given, and $DISPLAY is set, it continues to
     spawn gitk as before;

 (2) When no option is given, and $DISPLAY is unset, "git log" is run
     to show the range of commits between the bad one and the good ones;

 (3) If only "-flag" options are given, "git log <options>" is run.
     E.g. "git bisect visualize --stat"

 (4) Otherwise, all of the given options are taken as the initial part
     of the command line and the commit range expression is given to
     that command.  E.g. "git bisect visualize tig" will run "tig"
     history viewer to show between the bad one and the good ones.

As "visualize" is a bit too long to type, we also give it a shorter
synonym "view".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 02:58:26 -08:00
Wincent Colaiuta
4af756f31b Teach "git add -i" to colorize whitespace errors
Rather than replicating the colorization logic of "git diff-files" we
rely on "git diff-files" itself. This guarantees consistent colorization
in and outside "git add -i".

Seeing as speed is not a concern here (the bottleneck is how fast the
user can read, not how fast "git diff-files" runs) we do this by
actually running it twice, once without color and once with.

In this way as the whitespace colorization provided by "git diff-files"
evolves (per-path attributes, new classes of whitespace error), "git
add -i" will automatically benefit from it and stay in synch.

Also, by working with two sets of diff output (an uncolorized one for
internal processing and a colorized one for display only) we minimize
the risk of regressions because the changes required to implement this
are minimally invasive.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 02:53:19 -08:00
Sergei Organov
8e566f24b3 Let git-help prefer man-pages installed with this version of git
Prepend $(prefix)/share/man to the MANPATH environment variable before
invoking 'man' from help.c:show_man_page().  There may be other git
documentation in the user's MANPATH but the user is asking a specific
instance of git about its own documentation, so we'd better show the
documentation for _that_ instance of git.

Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 02:50:54 -08:00
Junio C Hamano
9758ecde9a Update draft release notes to 1.5.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-07 01:28:05 -08:00
Junio C Hamano
d9f405931f Merge branch 'master' of git://repo.or.cz/git-gui
* 'master' of git://repo.or.cz/git-gui:
  Update Hungarian translation. 100% completed.
  Update ja.po for git-gui
  git-gui: Improve the application icon on Windows.
  git-gui: install-sh from automake does not like -m755
  git-gui: Reorder msgfmt command-line arguments
  Update German translation. 100% completed.
  Update git-gui.pot with latest (few) string additions and changes.
  git-gui: update it.po and glossary/it.po
  git-gui: fix a typo in lib/commit.tcl
2007-12-06 23:51:15 -08:00
Junio C Hamano
5f7003b18c Merge branch 'mw/cvsserver'
* mw/cvsserver:
  git-cvsserver runs hooks/post-update
  git-cvsserver runs hooks/post-receive
2007-12-06 23:44:49 -08:00
Junio C Hamano
9f6f4e0bc2 Merge branch 'kh/fetch-optparse'
* kh/fetch-optparse:
  Rewrite builtin-fetch option parsing to use parse_options().
2007-12-06 23:44:43 -08:00
Junio C Hamano
c1f238698b Merge branch 'jc/git-log-doc'
* jc/git-log-doc:
  Include diff options in the git-log manpage
2007-12-06 23:43:54 -08:00
Junio C Hamano
ca7325621a Merge branch 'jc/addi-color'
* jc/addi-color:
  config --get-colorbool: diff.color is a deprecated synonym to color.diff
  Color support for "git-add -i"
  git config --get-colorbool
2007-12-06 23:43:47 -08:00
Junio C Hamano
9539a56e23 Merge branch 'jc/docmake-perl'
* jc/docmake-perl:
  Run the specified perl in Documentation/
2007-12-06 23:43:42 -08:00
Junio C Hamano
a43aa4cec8 Merge branch 'jc/clean-fix'
* jc/clean-fix:
  t7300: add test for clean with wildcard pathspec
  git-clean: Honor pathspec.
2007-12-06 23:43:35 -08:00
Jakub Narebski
0f7a9c9b7b autoconf: Add test for OLD_ICONV (squelching compiler warning)
Update configure.ac (and config.mak.in) to keep up with git
development by adding [compile] test whether your library has an old
iconv(), where the second (input buffer pointer) parameter is declared
with type (const char **) (OLD_ICONV).

Test-proposed-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06 23:23:42 -08:00
Wincent Colaiuta
fe4aafba28 Silence iconv warnings on Leopard
Apple ships a newer version of iconv with Leopard (Mac OS X 10.5/Darwin
9). Ensure that OLD_ICONV is not set on any version of Darwin in the
9.x series; this should be good for at least a couple of years, when
Darwin 10 comes out and we can invert the sense of the test to
specifically check for Darwin 7 or 8.

A more sophisticated and robust check is possible for those who use
autoconf, but not everybody does that.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06 23:22:25 -08:00
Junio C Hamano
08e1812db1 Merge branch 'maint'
* maint:
  Change from using email.com to example.com as example domain, as per RFC 2606.
2007-12-06 23:20:18 -08:00
David Symonds
8e7425da78 Change from using email.com to example.com as example domain, as per RFC 2606.
Signed-off-by: David Symonds <dsymonds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06 23:20:11 -08:00
Junio C Hamano
c7860507f0 git-status documentation: mention subdirectory behaviour
Consistently with all other diff oriented commands, we have given paths
relative to the work tree root in git-status output for a long time.
This documents the recent behaviour change, as people's eyes (and worse
yet, scripts, although scripts should not parse "git status" output) may
depend on the old behaviour.

In the longer run, giving a --full-name option to git-diff Porcelain
similar to what ls-files has, and change the default for git-diff
Porcelain to show relative paths may be a good thing to do, in order to
hide the oddballness of this git-status behaviour, but that would have a
rather large impact to established expectation by existing users.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06 09:15:39 -08:00
Junio C Hamano
c6bc400585 do not discard status in fetch_refs_via_pack()
The code calls fetch_pack() to get the list of refs it fetched, and
discards refs and always returns 0 to signal success.

But builtin-fetch-pack.c::fetch_pack() has error cases.  The function
returns NULL if error is detected (shallow-support side seems to choose
to die but I suspect that is easily fixable to error out as well).

Make fetch_refs_via_pack() propagate that error to the caller.

Acked-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06 07:54:06 -08:00
Johannes Sixt
c9ecf4f12a for-each-ref: Fix quoting style constants.
for-each-ref can accept only one quoting style. For this reason it uses
OPT_BIT for the quoting style switches so that it is easy to check for
more than one bit being set. However, not all symbolic constants were
actually single bit values. In particular:

    $ git for-each-ref --python
    error: more than one quoting style ?

This fixes it.

While we are here, let's also remove the space before the question mark.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06 07:53:20 -08:00
Junio C Hamano
90e0653b18 hg-to-git: handle an empty dir in hg.
Mark Drago had a subversion repository which was then converted to hg
and now is moving in to git.  The first commit in the svn repo was
just the creation of the empty directory.  This made its way in to the
hg repository fine, but converting from hg to git would cause an
error.  The problem was that hg-to-git.py tries to commit the change,
git-commit fails, and then hg-to-git.py tries to checkout the new
revision and that fails (because it was not created).  This may have
only caused an error because it was the first commit in the
repository.  If an empty directory was added in the middle of the repo
somewhere things might have worked out fine.

This patch will use the new --allow-empty option to git-commit to
record such an "empty" commit, to reproduce the history recorded in hg
more faithfully.

Tested-by: Mark Drago <markdrago@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-06 07:26:29 -08:00
Junio C Hamano
69243c2b95 config --get-colorbool: diff.color is a deprecated synonym to color.diff
The applications can ask for color.diff but the configuration of old
timer users can still instruct it to use color with diff.color this
way.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 23:05:10 -08:00
Jeff King
d3357ab873 t7300: add test for clean with wildcard pathspec
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 22:47:45 -08:00
Junio C Hamano
d871c86935 git-clean: Honor pathspec.
git-clean "*.rej" should attempt to look at only paths that match
pattern "*.rej", but rewrite to C broke it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 18:42:49 -08:00
Junio C Hamano
b4c61ed6d3 Color support for "git-add -i"
This is mostly lifted from earlier series by Dan Zwell, but updated to
use "git config --get-color" and "git config --get-colorbool" to make it
simpler and more consistent with commands written in C.

A new configuration color.interactive variable is like color.diff and
color.status, and controls if "git-add -i" uses color.

A set of configuration variables, color.interactive.<slot>, are used to
define what color is used for the prompt, header, and help text.

For perl scripts, Git.pm provides $repo->get_color() method, which takes
the slot name and the default color, and returns the terminal escape
sequence to color the output text.  $repo->get_colorbool() method can be
used to check if color is set to be used for a given operation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 17:57:11 -08:00
Junio C Hamano
0f6f5a4022 git config --get-colorbool
This adds an option to help scripts find out color settings from
the configuration file.

    git config --get-colorbool color.diff

inspects color.diff variable, and exits with status 0 (i.e. success) if
color is to be used.  It exits with status 1 otherwise.

If a script wants "true"/"false" answer to the standard output of the
command, it can pass an additional boolean parameter to its command
line, telling if its standard output is a terminal, like this:

    git config --get-colorbool color.diff true

When called like this, the command outputs "true" to its standard output
if color is to be used (i.e. "color.diff" says "always", "auto", or
"true"), and "false" otherwise.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 17:57:11 -08:00
Junio C Hamano
cec99d8cef Documentation: color.* = true means "auto"
We forgot to document the earlier sanity-fix.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 17:50:53 -08:00
Junio C Hamano
27ee189163 Merge branch 'maint'
* maint:
  git-am -i: report rewritten title
  git grep shows the same hit repeatedly for unmerged paths
  Do check_repository_format() early (re-fix)
  Do check_repository_format() early
  Add missing inside_work_tree setting in setup_git_directory_gently
2007-12-05 17:49:13 -08:00
Junio C Hamano
f23272f3fd git-am -i: report rewritten title
Jeff Garzik noticed that "git am -i" reports the applied patch with
the title before the user edited it.  This was confusing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 16:27:17 -08:00
Junio C Hamano
6326cee51b git grep shows the same hit repeatedly for unmerged paths
When the index is unmerged, e.g.

	$ git ls-files -u
        100644 faf413748eb6ccb15161a212156c5e348302b1b6 1	setup.c
        100644 145eca50f41d811c4c8fcb21ed2604e6b2971aba 2	setup.c
        100644 cb9558c49b6027bf225ba2a6154c4d2a52bcdbe2 3	setup.c

running "git grep" for work tree files repeats hits for each unmerged
stage.

	$ git grep -n -e setup_work_tree -- '*.[ch]'
        setup.c:209:void setup_work_tree(void)
        setup.c:209:void setup_work_tree(void)
        setup.c:209:void setup_work_tree(void)

This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 16:16:40 -08:00
Miklos Vajna
cfb5e10442 Update Hungarian translation. 100% completed.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-12-05 18:55:25 -05:00
しらいしななこ
e360bebf71 Update ja.po for git-gui
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-12-05 18:54:10 -05:00
Junio C Hamano
9d25acc49a Merge branch 'nd/maint-work-tree-fix' into maint
* nd/maint-work-tree-fix:
  Do check_repository_format() early (re-fix)
  Do check_repository_format() early
  Add missing inside_work_tree setting in setup_git_directory_gently
2007-12-05 15:07:23 -08:00
Nguyễn Thái Ngọc Duy
9459aa77a0 Do check_repository_format() early (re-fix)
This pushes check_repository_format() (actually _gently() version)
to setup_git_directory_gently() in order to prevent from
using unsupported repositories.

New setup_git_directory_gently()'s behaviour is stop searching
for a valid gitdir and return as if there is no gitdir if a
unsupported repository is found. Warning will be thrown in these
cases.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 15:06:37 -08:00
Junio C Hamano
3b78959ece Revert "git-am: catch missing author date early."
This reverts commit 6e9e0327b7d7f384d8a223b4bc40330ef3e7fb61.  People
can prepare a text file with Subject: and From: headers and feed it to
"am" (pretending the file is a piece of e-mail), and have actually been
doing so.  Strict checking for Date: breaks this established workflow,
which wants to record the time of the commit as the author time.

Thanks go to Jens Axboe for injection of sanity.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 13:16:35 -08:00
Björn Steinbrink
9e4bbeb95f git config: Don't rely on regexec() returning 1 on non-match
Some systems don't return 1 from regexec() when the pattern does not
match (notably HP-UX which returns 20).

Bug identified by Dscho and H.Merijn Brand.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Tested-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 11:34:44 -08:00