Code

git.git
15 years agoChange the spelling of "wordregex".
Boyd Stephen Smith Jr [Wed, 21 Jan 2009 04:59:54 +0000 (22:59 -0600)]
Change the spelling of "wordregex".

Use "wordRegex" for configuration variable names.  Use "word_regex" for C
language tokens.

Signed-off-by: Boyd Stephen Smith Jr. <bss@iguanasuicide.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocolor-words: Support diff.wordregex config option
Boyd Stephen Smith Jr [Wed, 21 Jan 2009 03:46:57 +0000 (21:46 -0600)]
color-words: Support diff.wordregex config option

When diff is invoked with --color-words (w/o =regex), use the regular
expression the user has configured as diff.wordregex.

diff drivers configured via attributes take precedence over the
diff.wordregex-words setting.  If the user wants to change them, they have
their own configuration variables.

Signed-off-by: Boyd Stephen Smith Jr <bss@iguanasuicide.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocolor-words: make regex configurable via attributes
Thomas Rast [Sat, 17 Jan 2009 16:29:48 +0000 (17:29 +0100)]
color-words: make regex configurable via attributes

Make the --color-words splitting regular expression configurable via
the diff driver's 'wordregex' attribute.  The user can then set the
driver on a file in .gitattributes.  If a regex is given on the
command line, it overrides the driver's setting.

We also provide built-in regexes for the languages that already had
funcname patterns, and add an appropriate diff driver entry for C/++.
(The patterns are designed to run UTF-8 sequences into a single chunk
to make sure they remain readable.)

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocolor-words: expand docs with precise semantics
Thomas Rast [Sat, 17 Jan 2009 16:29:47 +0000 (17:29 +0100)]
color-words: expand docs with precise semantics

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocolor-words: enable REG_NEWLINE to help user
Thomas Rast [Sat, 17 Jan 2009 16:29:46 +0000 (17:29 +0100)]
color-words: enable REG_NEWLINE to help user

We silently truncate a match at the newline, which may lead to
unexpected behaviour, e.g., when matching "<[^>]*>" against

  <foo
  bar>

since then "<foo" becomes a word (and "bar>" doesn't!) even though the
regex said only angle-bracket-delimited things can be words.

To alleviate the problem slightly, use REG_NEWLINE so that negated
classes can't match a newline.  Of course newlines can still be
matched explicitly.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocolor-words: take an optional regular expression describing words
Johannes Schindelin [Sat, 17 Jan 2009 16:29:45 +0000 (17:29 +0100)]
color-words: take an optional regular expression describing words

In some applications, words are not delimited by white space.  To
allow for that, you can specify a regular expression describing
what makes a word with

git diff --color-words='[A-Za-z0-9]+'

Note that words cannot contain newline characters.

As suggested by Thomas Rast, the words are the exact matches of the
regular expression.

Note that a regular expression beginning with a '^' will match only
a word at the beginning of the hunk, not a word at the beginning of
a line, and is probably not what you want.

This commit contains a quoting fix by Thomas Rast.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocolor-words: change algorithm to allow for 0-character word boundaries
Johannes Schindelin [Sat, 17 Jan 2009 16:29:44 +0000 (17:29 +0100)]
color-words: change algorithm to allow for 0-character word boundaries

Up until now, the color-words code assumed that word boundaries are
identical to white space characters.

Therefore, it could get away with a very simple scheme: it copied the
hunks, substituted newlines for each white space character, called
libxdiff with the processed text, and then identified the text to
output by the offsets (which agreed since the original text had the
same length).

This code was ugly, for a number of reasons:

- it was impossible to introduce 0-character word boundaries,

- we had to print everything word by word, and

- the code needed extra special handling of newlines in the removed part.

Fix all of these issues by processing the text such that

- we build word lists, separated by newlines,

- we remember the original offsets for every word, and

- after calling libxdiff on the wordlists, we parse the hunk headers, and
  find the corresponding offsets, and then

- we print the removed/added parts in one go.

The pre and post samples in the test were provided by Santi Béjar.

Note that there is some strange special handling of hunk headers where
one line range is 0 due to POSIX: in this case, the start is one too
low.  In other words a hunk header '@@ -1,0 +2 @@' actually means that
the line must be added after the _second_ line of the pre text, _not_
the first.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocolor-words: refactor word splitting and use ALLOC_GROW()
Johannes Schindelin [Sat, 17 Jan 2009 16:29:43 +0000 (17:29 +0100)]
color-words: refactor word splitting and use ALLOC_GROW()

Word splitting is now performed by the function diff_words_fill(),
avoiding having the same code twice.

In the same spirit, avoid duplicating the code of ALLOC_GROW().

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd color_fwrite_lines(), a function coloring each line individually
Johannes Schindelin [Sat, 17 Jan 2009 16:29:42 +0000 (17:29 +0100)]
Add color_fwrite_lines(), a function coloring each line individually

We have to set the color before every line and reset it before every
newline.  Add a function color_fwrite_lines() which does that for us.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Tue, 13 Jan 2009 09:25:55 +0000 (01:25 -0800)]
Merge branch 'maint'

* maint:
  Avoid spurious error messages on error mistakes.
  contrib/examples/README: give an explanation of the status of these files

15 years agoMerge branch 'kk/maint-http-push' into maint
Junio C Hamano [Tue, 13 Jan 2009 09:15:49 +0000 (01:15 -0800)]
Merge branch 'kk/maint-http-push' into maint

* kk/maint-http-push:
  http-push: support full URI in handle_remote_ls_ctx()

15 years agoMerge branch 'js/maint-merge-recursive-r-d-conflict' into maint
Junio C Hamano [Tue, 13 Jan 2009 09:15:19 +0000 (01:15 -0800)]
Merge branch 'js/maint-merge-recursive-r-d-conflict' into maint

* js/maint-merge-recursive-r-d-conflict:
  merge-recursive: mark rename/delete conflict as unmerged

15 years agoMerge branch 'cb/maint-merge-recursive-fix' into maint
Junio C Hamano [Tue, 13 Jan 2009 09:13:56 +0000 (01:13 -0800)]
Merge branch 'cb/maint-merge-recursive-fix' into maint

* cb/maint-merge-recursive-fix:
  merge-recursive: do not clobber untracked working tree garbage
  modify/delete conflict resolution overwrites untracked file

Conflicts:
builtin-merge-recursive.c

15 years agoMerge branch 'ap/maint-apply-modefix' into maint
Junio C Hamano [Tue, 13 Jan 2009 08:56:40 +0000 (00:56 -0800)]
Merge branch 'ap/maint-apply-modefix' into maint

* ap/maint-apply-modefix:
  builtin-apply: prevent non-explicit permission changes

15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Tue, 13 Jan 2009 08:40:19 +0000 (00:40 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  Avoid spurious error messages on error mistakes.
  contrib/examples/README: give an explanation of the status of these files

15 years agoAvoid spurious error messages on error mistakes.
Pierre Habouzit [Mon, 12 Jan 2009 23:09:36 +0000 (00:09 +0100)]
Avoid spurious error messages on error mistakes.

Prior to that, if the user chose "squash" as a first action, the stderr
looked like:

    grep: /home/madcoder/dev/scm/git/.git/rebase-merge/done: No such file or directory
    Cannot 'squash' without a previous commit

Now the first line is gone.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix Documentation typos surrounding the word 'handful'.
Jon Loeliger [Mon, 12 Jan 2009 20:02:07 +0000 (14:02 -0600)]
Fix Documentation typos surrounding the word 'handful'.

Some instances replaced by "handful of", others use
the word "few", a couple get a slight rewording.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosha1_file: make "read_object" static
Christian Couder [Mon, 12 Jan 2009 17:42:24 +0000 (18:42 +0100)]
sha1_file: make "read_object" static

This function is only used from "sha1_file.c".

And as we want to add a "replace_object" hook in "read_sha1_file",
we must not let people bypass the hook using something other than
"read_sha1_file".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocontrib/vim: change URL to point to the latest syntax files
Markus Heidelberg [Tue, 13 Jan 2009 02:10:26 +0000 (03:10 +0100)]
contrib/vim: change URL to point to the latest syntax files

Vim's SVN repository doesn't offer the latest runtime files, since
normally they are only updated there on a release. Though currently
there is no difference between the SVN and HTTP/FTP version of the git
syntax files.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocontrib/examples/README: give an explanation of the status of these files
jidanni@jidanni.org [Tue, 13 Jan 2009 01:19:42 +0000 (09:19 +0800)]
contrib/examples/README: give an explanation of the status of these files

We attempt to give an explanation of the status of the files in this
directory.

Signed-off-by: jidanni <jidanni@jidanni.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Mon, 12 Jan 2009 07:29:26 +0000 (23:29 -0800)]
Merge branch 'maint'

* maint:
  Documentation/git-push.txt: minor: compress one option

15 years agoMerge branch 'mh/maint-sendmail-cc-doc' into maint
Junio C Hamano [Mon, 12 Jan 2009 07:27:29 +0000 (23:27 -0800)]
Merge branch 'mh/maint-sendmail-cc-doc' into maint

* mh/maint-sendmail-cc-doc:
  doc/git-send-email: mention sendemail.cc config variable

15 years agoMerge branch 'jc/maint-do-not-switch-to-non-commit' into maint
Junio C Hamano [Mon, 12 Jan 2009 07:24:42 +0000 (23:24 -0800)]
Merge branch 'jc/maint-do-not-switch-to-non-commit' into maint

* jc/maint-do-not-switch-to-non-commit:
  git checkout: do not allow switching to a tree-ish that is not a commit

15 years agoDocumentation/git-push.txt: minor: compress one option
jidanni@jidanni.org [Mon, 12 Jan 2009 03:05:54 +0000 (11:05 +0800)]
Documentation/git-push.txt: minor: compress one option

Signed-off-by: jidanni <jidanni@jidanni.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: add --authors-file test
Eric Wong [Sun, 11 Jan 2009 23:44:07 +0000 (15:44 -0800)]
git-svn: add --authors-file test

I'm not sure how often this functionality is used, but in case
it's not, having an extra test here will help catch breakage
sooner.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoCleanup of unused symcache variable inside diff-lib.c
Kjetil Barvik [Sun, 11 Jan 2009 18:36:42 +0000 (19:36 +0100)]
Cleanup of unused symcache variable inside diff-lib.c

Commit c40641b77b0274186fd1b327d5dc3246f814aaaf, 'Optimize
symlink/directory detection' by Linus Torvalds, removed the 'char
*symcache' parameter to the has_symlink_leading_path() function.  This
made all variables currently named 'symcache' inside diff-lib.c
unnecessary.

This also let us throw away the 'struct oneway_unpack_data', and
instead directly use the 'struct rev_info *revs' member, which
was the only member left after removal of the 'symcache[] array'
member.  The 'struct oneway_unpack_data' was introduced by the
following commit:

  948dd346  "diff-files: careful when inspecting work tree items"

Impact: cleanup
        PATH_MAX bytes less memory stack usage in some cases

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: clean up TEST_PROGRAMS definition
Jeff King [Sun, 11 Jan 2009 11:25:06 +0000 (06:25 -0500)]
Makefile: clean up TEST_PROGRAMS definition

We try to keep lines under 80 characters, not to mention
that sticking a bunch of stuff on one line makes diffs
messier.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot7501-commit.sh: explicitly check that -F prevents invoking the editor
Adeodato Simó [Fri, 9 Jan 2009 17:30:05 +0000 (18:30 +0100)]
t7501-commit.sh: explicitly check that -F prevents invoking the editor

The "--signoff" test case in t7500-commit.sh was setting VISUAL while
using -F -, which indeed tested that the editor is not spawned with -F.
However, having it there was confusing, since there was no obvious reason
to the casual reader for it to be there.

This commits removes the setting of VISUAL from the --signoff test, and
adds in t7501-commit.sh a dedicated test case, where the rest of tests for
-F are.

Signed-off-by: Adeodato Simó <dato@net.com.org.es>
Okay-then-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: Use 'git add' completions for 'git stage'
Lee Marlow [Wed, 10 Dec 2008 19:39:18 +0000 (12:39 -0700)]
bash completion: Use 'git add' completions for 'git stage'

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Trivially-Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: Add '--intent-to-add' long option for 'git add'
Lee Marlow [Wed, 10 Dec 2008 19:39:17 +0000 (12:39 -0700)]
bash completion: Add '--intent-to-add' long option for 'git add'

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Trivially-Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofilter-branch: add git_commit_non_empty_tree and --prune-empty.
Pierre Habouzit [Fri, 31 Oct 2008 09:12:21 +0000 (10:12 +0100)]
filter-branch: add git_commit_non_empty_tree and --prune-empty.

git_commit_non_empty_tree is added to the functions that can be run from
commit filters. Its effect is to commit only commits actually touching the
tree and that are not merge points either.

The option --prune-empty is added. It defaults the commit-filter to
'git_commit_non_empty_tree "$@"', and can be used with any other
combination of filters, except --commit-hook that must used
'git_commit_non_empty_tree "$@"' where one puts 'git commit-tree "$@"'
usually to achieve the same result.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'mh/maint-sendmail-cc-doc'
Junio C Hamano [Wed, 7 Jan 2009 08:10:19 +0000 (00:10 -0800)]
Merge branch 'mh/maint-sendmail-cc-doc'

* mh/maint-sendmail-cc-doc:
  doc/git-send-email: mention sendemail.cc config variable

15 years agoMerge branch 'rs/diff-ihc'
Junio C Hamano [Wed, 7 Jan 2009 08:10:14 +0000 (00:10 -0800)]
Merge branch 'rs/diff-ihc'

* rs/diff-ihc:
  diff: add option to show context between close hunks

Conflicts:
Documentation/diff-options.txt

15 years agoMerge branch 'js/maint-merge-recursive-r-d-conflict'
Junio C Hamano [Wed, 7 Jan 2009 08:09:42 +0000 (00:09 -0800)]
Merge branch 'js/maint-merge-recursive-r-d-conflict'

* js/maint-merge-recursive-r-d-conflict:
  merge-recursive: mark rename/delete conflict as unmerged

15 years agoMerge branch 'mk/gitweb-feature'
Junio C Hamano [Wed, 7 Jan 2009 08:09:33 +0000 (00:09 -0800)]
Merge branch 'mk/gitweb-feature'

* mk/gitweb-feature:
  gitweb: unify boolean feature subroutines

15 years agoMerge branch 'cb/merge-recursive-fix'
Junio C Hamano [Wed, 7 Jan 2009 08:09:27 +0000 (00:09 -0800)]
Merge branch 'cb/merge-recursive-fix'

* cb/merge-recursive-fix:
  merge-recursive: do not clobber untracked working tree garbage
  modify/delete conflict resolution overwrites untracked file

15 years agoMerge branch 'kk/maint-http-push'
Junio C Hamano [Wed, 7 Jan 2009 08:09:14 +0000 (00:09 -0800)]
Merge branch 'kk/maint-http-push'

* kk/maint-http-push:
  http-push: support full URI in handle_remote_ls_ctx()

15 years agoMerge branch 'mv/um-pdf'
Junio C Hamano [Wed, 7 Jan 2009 08:09:10 +0000 (00:09 -0800)]
Merge branch 'mv/um-pdf'

* mv/um-pdf:
  Add support for a pdf version of the user manual

15 years agoMerge branch 'jn/gitweb-blame'
Junio C Hamano [Wed, 7 Jan 2009 08:09:06 +0000 (00:09 -0800)]
Merge branch 'jn/gitweb-blame'

* jn/gitweb-blame:
  gitweb: cache $parent_commit info in git_blame()
  gitweb: A bit of code cleanup in git_blame()
  gitweb: Move 'lineno' id from link to row element in git_blame

15 years agoMerge branch 'wp/add-p-goto'
Junio C Hamano [Wed, 7 Jan 2009 08:09:00 +0000 (00:09 -0800)]
Merge branch 'wp/add-p-goto'

* wp/add-p-goto:
  Add 'g' command to go to a hunk
  Add subroutine to display one-line summary of hunks

15 years agostrbuf: instate cleanup rule in case of non-memory errors
René Scharfe [Tue, 6 Jan 2009 20:41:14 +0000 (21:41 +0100)]
strbuf: instate cleanup rule in case of non-memory errors

Make all strbuf functions that can fail free() their memory on error if
they have allocated it.  They don't shrink buffers that have been grown,
though.

This allows for easier error handling, as callers only need to call
strbuf_release() if A) the command succeeded or B) if they would have had
to do so anyway because they added something to the strbuf themselves.

Bonus hunk: document strbuf_readlink.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Wed, 7 Jan 2009 06:13:41 +0000 (22:13 -0800)]
Merge branch 'maint'

* maint:
  README: tutorial.txt is now called gittutorial.txt

15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Wed, 7 Jan 2009 06:12:35 +0000 (22:12 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  README: tutorial.txt is now called gittutorial.txt

15 years agoMerge branch 'maint-1.5.6' into maint-1.6.0
Junio C Hamano [Wed, 7 Jan 2009 06:12:30 +0000 (22:12 -0800)]
Merge branch 'maint-1.5.6' into maint-1.6.0

* maint-1.5.6:
  README: tutorial.txt is now called gittutorial.txt

15 years agoREADME: tutorial.txt is now called gittutorial.txt
Joey Hess [Wed, 7 Jan 2009 04:23:37 +0000 (23:23 -0500)]
README: tutorial.txt is now called gittutorial.txt

Signed-off-by: Joey Hess <joey@gnu.kitenet.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Tue, 6 Jan 2009 00:10:52 +0000 (16:10 -0800)]
Merge branch 'maint'

* maint:
  Be consistent in switch usage for tar
  Use capitalized names where appropriate
  fast-export: print usage when no options specified

15 years agoremove trailing LF in die() messages
Alexander Potashev [Sun, 4 Jan 2009 18:38:41 +0000 (21:38 +0300)]
remove trailing LF in die() messages

LF at the end of format strings given to die() is redundant because
die already adds one on its own.

Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoBe consistent in switch usage for tar
Henrik Austad [Mon, 5 Jan 2009 15:25:37 +0000 (16:25 +0100)]
Be consistent in switch usage for tar

tar handles switches with and witout preceding '-', but the
documentation should be consistent nonetheless.

Signed-off-by: Henrik Austad <henrik@austad.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUse capitalized names where appropriate
Henrik Austad [Mon, 5 Jan 2009 15:25:36 +0000 (16:25 +0100)]
Use capitalized names where appropriate

The Linux kernel and Emacs are both spelled capitalized

Signed-off-by: Henrik Austad <henrik@austad.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash: add '--merge' to 'git reset'
SZEDER Gábor [Mon, 29 Dec 2008 15:05:46 +0000 (16:05 +0100)]
bash: add '--merge' to 'git reset'

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoshow <tag>: reuse pp_user_info() instead of duplicating code
Johannes Schindelin [Fri, 2 Jan 2009 18:08:43 +0000 (19:08 +0100)]
show <tag>: reuse pp_user_info() instead of duplicating code

We used to extract the tagger information "by hand" in "git show <tag>",
but the function pp_user_info() already does that.  Even better:
it respects the commit_format and date_format specified by the user.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: use href() when generating URLs in OPML
Giuseppe Bilotta [Fri, 2 Jan 2009 12:15:28 +0000 (13:15 +0100)]
gitweb: use href() when generating URLs in OPML

Since the OPML project list view was hand-coding the RSS and HTML URLs,
it didn't respect global options such as use_pathinfo. Make it use
href() to ensure consistency with the rest of the gitweb setup.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofast-export: print usage when no options specified
Miklos Vajna [Sat, 3 Jan 2009 03:59:12 +0000 (04:59 +0100)]
fast-export: print usage when no options specified

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/maint-do-not-switch-to-non-commit'
Junio C Hamano [Sat, 3 Jan 2009 21:57:30 +0000 (13:57 -0800)]
Merge branch 'jc/maint-do-not-switch-to-non-commit'

* jc/maint-do-not-switch-to-non-commit:
  git checkout: do not allow switching to a tree-ish that is not a commit

15 years agoMerge branch 'ap/maint-apply-modefix'
Junio C Hamano [Sat, 3 Jan 2009 21:57:10 +0000 (13:57 -0800)]
Merge branch 'ap/maint-apply-modefix'

* ap/maint-apply-modefix:
  builtin-apply: prevent non-explicit permission changes

15 years agogit checkout: do not allow switching to a tree-ish that is not a commit
Junio C Hamano [Sat, 3 Jan 2009 12:07:32 +0000 (04:07 -0800)]
git checkout: do not allow switching to a tree-ish that is not a commit

"git checkout -b newbranch $commit^{tree}" mistakenly created a new branch
rooted at the current HEAD, because in that case, the two structure fields
used to see if the command was invoked without any argument (hence it
needs to default to checking out the HEAD) were populated incorrectly.

Upon seeing a command line argument that we took as a rev, we should store
that string in new.name, even if that does not name a commit.  This will
correctly trigger the existing safety logic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
15 years agobuiltin-apply: prevent non-explicit permission changes
Junio C Hamano [Fri, 2 Jan 2009 10:55:37 +0000 (02:55 -0800)]
builtin-apply: prevent non-explicit permission changes

A git patch that does not change the executable bit records the mode bits
on its "index" line.  "git apply" used to interpret this mode exactly the
same way as it interprets the mode recorded on "new mode" line, as the
wish by the patch submitter to set the mode to the one recorded on the
line.

The reason the mode does not agree between the submitter and the receiver
in the first place is because there is _another_ commit that only appears
on one side but not the other since their histories diverged, and that
commit changes the mode.  The patch has "index" line but not "new mode"
line because its change is about updating the contents without affecting
the mode.  The application of such a patch is an explicit wish by the
submitter to only cherry-pick the commit that updates the contents without
cherry-picking the commit that modifies the mode.  Viewed this way, the
current behaviour is problematic, even though the command does warn when
the mode of the path being patched does not match this mode, and a careful
user could detect this inconsistencies between the patch submitter and the
patch receiver.

This changes the semantics of the mode recorded on the "index" line;
instead of interpreting it as the submitter's wish to set the mode to the
recorded value, it merely informs what the mode submitter happened to
have, and the presense of the "index" line is taken as submitter's wish to
keep whatever the mode is on the receiving end.

This is based on the patch originally done by Alexander Potashev with a
minor fix; the tests are mine.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit wrapper: Make while loop more reader-friendly
Johannes Schindelin [Fri, 2 Jan 2009 18:07:52 +0000 (19:07 +0100)]
git wrapper: Make while loop more reader-friendly

It is not a good practice to prefer performance over readability in
something as performance uncritical as finding the trailing slash
of argv[0].

So avoid head-scratching by making the loop user-readable, and not
hyper-performance-optimized.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'cb/mergetool'
Junio C Hamano [Thu, 1 Jan 2009 13:48:40 +0000 (05:48 -0800)]
Merge branch 'cb/mergetool'

* cb/mergetool:
  mergetool: Don't keep temporary merge files unless told to
  mergetool: Add prompt to continue after failing to merge a file
  Add -y/--no-prompt option to mergetool
  Fix some tab/space inconsistencies in git-mergetool.sh

15 years agoMerge branch 'maint'
Junio C Hamano [Thu, 1 Jan 2009 13:48:35 +0000 (05:48 -0800)]
Merge branch 'maint'

* maint:
  Documentation/git-tag.txt: minor typo and grammar fix

15 years agoDocumentation/git-tag.txt: minor typo and grammar fix
jidanni@jidanni.org [Sat, 27 Dec 2008 19:49:03 +0000 (03:49 +0800)]
Documentation/git-tag.txt: minor typo and grammar fix

Signed-off-by: jidanni <jidanni@jidanni.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'lt/reset-merge'
Junio C Hamano [Mon, 29 Dec 2008 09:21:45 +0000 (01:21 -0800)]
Merge branch 'lt/reset-merge'

* lt/reset-merge:
  Document "git-reset --merge"
  Add 'merge' mode to 'git reset'

15 years agoMerge branch 'np/auto-thread'
Junio C Hamano [Mon, 29 Dec 2008 09:21:33 +0000 (01:21 -0800)]
Merge branch 'np/auto-thread'

* np/auto-thread:
  Force t5302 to use a single thread
  pack-objects: don't use too many threads with few objects
  autodetect number of CPUs by default when using threads

15 years agoMerge branch 'maint'
Junio C Hamano [Mon, 29 Dec 2008 09:18:34 +0000 (01:18 -0800)]
Merge branch 'maint'

* maint:
  Prepare for v1.6.1.1 maintenance release
  Documentation/diff-options.txt: unify options
  gitweb: Fix export check in git_get_projects_list

Conflicts:
RelNotes

15 years agoPrepare for v1.6.1.1 maintenance release
Junio C Hamano [Mon, 29 Dec 2008 09:17:34 +0000 (01:17 -0800)]
Prepare for v1.6.1.1 maintenance release

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation/diff-options.txt: unify options
jidanni@jidanni.org [Mon, 29 Dec 2008 07:03:17 +0000 (15:03 +0800)]
Documentation/diff-options.txt: unify options

Instead of listing short option (e.g. "-U<n>") as a shorthand for its
longer counterpart (e.g. "--unified=<n>"), list the synonyms together.  It
saves one indirection to find what the reader wants.

Signed-off-by: jidanni <jidanni@jidanni.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodoc/git-send-email: mention sendemail.cc config variable
Markus Heidelberg [Sun, 28 Dec 2008 23:37:25 +0000 (00:37 +0100)]
doc/git-send-email: mention sendemail.cc config variable

This variable was added in 5f8b9fc (git-send-email: add a new
sendemail.cc configuration variable, 2008-04-27), but is not yet refered
to by the documentation.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff: add option to show context between close hunks
René Scharfe [Sun, 28 Dec 2008 18:45:32 +0000 (19:45 +0100)]
diff: add option to show context between close hunks

Merge two hunks if there is only the specified number of otherwise unshown
context between them.  For --inter-hunk-context=1, the resulting patch has
the same number of lines but shows uninterrupted context instead of a
context header line in between.

Patches generated with this option are easier to read but are also more
likely to conflict if the file to be patched contains other changes.

This patch keeps the default for this option at 0.  It is intended to just
make the feature available in order to see its advantages and downsides.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix the building of gitman.info document
Teemu Likonen [Mon, 29 Dec 2008 08:03:09 +0000 (10:03 +0200)]
Fix the building of gitman.info document

"makeinfo" failed to generate gitman.info from gitman.texi input file
because the combined manual page file contains several nodes with the
same name (DESCRIPTION, OPTIONS, SEE ALSO etc.). An Info document should
contain unique node names.

This patch creates a simple (read: ugly) work-around by suppressing the
validation of the final Info file. Jumping to nodes in the Info document
still works but they are not very useful. Common man-page headings like
DESCRIPTION and OPTIONS appear in the Info node list and they point to
the man page where they appear first (that is git-add currently).

Also, this patch adds directory-entry information for Info document to
make the document appear in the top-level Info directory.

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix the building of user-manual.texi and gitman.texi documents
Teemu Likonen [Mon, 29 Dec 2008 08:03:08 +0000 (10:03 +0200)]
Fix the building of user-manual.texi and gitman.texi documents

Previously "docbook2x-texi" failed to generate user-manual.texi and
gitman.texi files from .xml input files because "iconv" stopped at
"illegal input sequence" error. This was due to some UTF-8 octets in the
input .xml files. This patch adds option --encoding=UTF-8 for
"docbook2x-texi" to allow the building of .texi files complete.

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: Fix export check in git_get_projects_list
Devin Doucette [Sat, 27 Dec 2008 09:39:31 +0000 (02:39 -0700)]
gitweb: Fix export check in git_get_projects_list

When $filter was empty, the path passed to check_export_ok would
contain an extra '/', which some implementations of export_auth_hook
are sensitive to.

It makes more sense to fix this here than to handle the special case
in each implementation of export_auth_hook.

Signed-off-by: Devin Doucette <devin@doucette.cc>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Sat, 27 Dec 2008 22:25:14 +0000 (14:25 -0800)]
Merge branch 'maint'

* maint:
  git-send-email.txt: move --format-patch paragraph to a proper location
  git-shortlog.txt: improve documentation about .mailmap files
  pretty: support multiline subjects with format:
  pretty: factor out format_subject()
  pretty: factor out skip_empty_lines()
  merge-file: handle freopen() failure
  daemon: cleanup: factor out xstrdup_tolower()
  daemon: cleanup: replace loop with if
  daemon: handle freopen() failure
  describe: Avoid unnecessary warning when using --all

15 years agoStart 1.6.2 cycle
Junio C Hamano [Sat, 27 Dec 2008 22:25:10 +0000 (14:25 -0800)]
Start 1.6.2 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'rs/maint-tformat-foldline' into maint
Junio C Hamano [Sat, 27 Dec 2008 22:22:37 +0000 (14:22 -0800)]
Merge branch 'rs/maint-tformat-foldline' into maint

* rs/maint-tformat-foldline:
  pretty: support multiline subjects with format:
  pretty: factor out format_subject()
  pretty: factor out skip_empty_lines()

15 years agoMerge branch 'rs/maint-retval-fix' into maint
Junio C Hamano [Sat, 27 Dec 2008 22:21:24 +0000 (14:21 -0800)]
Merge branch 'rs/maint-retval-fix' into maint

* rs/maint-retval-fix:
  merge-file: handle freopen() failure
  daemon: cleanup: factor out xstrdup_tolower()
  daemon: cleanup: replace loop with if
  daemon: handle freopen() failure

15 years agoMerge branch 'sp/maint-describe-all-tag-warning' into maint
Junio C Hamano [Sat, 27 Dec 2008 22:21:15 +0000 (14:21 -0800)]
Merge branch 'sp/maint-describe-all-tag-warning' into maint

* sp/maint-describe-all-tag-warning:
  describe: Avoid unnecessary warning when using --all

15 years agogit-send-email.txt: move --format-patch paragraph to a proper location
Adeodato Simó [Sat, 27 Dec 2008 08:50:30 +0000 (09:50 +0100)]
git-send-email.txt: move --format-patch paragraph to a proper location

When introducing --format-patch, its documentation was accidentally inserted
in the middle of documentation for --validate.

Signed-off-by: Adeodato Simó <dato@net.com.org.es>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-shortlog.txt: improve documentation about .mailmap files
Adeodato Simó [Sat, 27 Dec 2008 18:23:30 +0000 (19:23 +0100)]
git-shortlog.txt: improve documentation about .mailmap files

The description on .mailmap made it seem like they are only useful for
commits with a wrong address for an author, but they are about fixing the
real name.  Explain this better in the text, and replace the existing
example with a new one that hopefully makes things clearer.

Signed-off-by: Adeodato Simó <dato@net.com.org.es>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agopretty: support multiline subjects with format:
René Scharfe [Sat, 27 Dec 2008 00:49:21 +0000 (01:49 +0100)]
pretty: support multiline subjects with format:

git log --pretty=format:%s (and tformat:) used to display the first
line of the subject, unlike the other --pretty options, which would
construct a subject line from all lines of the first paragraph of
the commit message.

For consistency and increased code reuse, change format: to do the
same as the other options.

Before:
$ git log --pretty=oneline v1.6.1 | md5sum
7c0896d2a94fc3315a0372b9b3373a8f  -
$ git log --pretty=tformat:"%H %s" v1.6.1 | md5sum
298903b1c065002e15daa5329213c51f  -

After:
$ git log --pretty=tformat:"%H %s" v1.6.1 | md5sum
7c0896d2a94fc3315a0372b9b3373a8f  -
$ git log --pretty=oneline v1.6.1 | md5sum
7c0896d2a94fc3315a0372b9b3373a8f  -

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agopretty: factor out format_subject()
René Scharfe [Sat, 27 Dec 2008 00:39:35 +0000 (01:39 +0100)]
pretty: factor out format_subject()

The next patch will use it.

In the version that was factored out, we can't rely on the len of the
struct strbuf to find out if a line separator needs to be added, as
it might already contain something.  Add a guard variable ("first")
instead.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agopretty: factor out skip_empty_lines()
René Scharfe [Sat, 27 Dec 2008 00:32:49 +0000 (01:32 +0100)]
pretty: factor out skip_empty_lines()

The patch after the next one will use it.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomerge-file: handle freopen() failure
René Scharfe [Fri, 26 Dec 2008 10:17:04 +0000 (11:17 +0100)]
merge-file: handle freopen() failure

Report the error if redirection of stderr to /dev/null failed.

This silences a compiler warning about ignoring the return value
of freopen() on Ubuntu 8.10.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodaemon: cleanup: factor out xstrdup_tolower()
René Scharfe [Fri, 26 Dec 2008 10:12:15 +0000 (11:12 +0100)]
daemon: cleanup: factor out xstrdup_tolower()

Add xstrdup_tolower(), a helper to get a lower case copy of a
string, and use it in two cases.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodaemon: cleanup: replace loop with if
René Scharfe [Fri, 26 Dec 2008 10:01:57 +0000 (11:01 +0100)]
daemon: cleanup: replace loop with if

Replace a loop around an enter_repo() call, which was used to retry
a single time with a different parameter in case the first call fails,
with two calls and an if.  This is shorter and cleaner.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodaemon: handle freopen() failure
René Scharfe [Fri, 26 Dec 2008 09:46:25 +0000 (10:46 +0100)]
daemon: handle freopen() failure

Die if stderr couldn't be sent to /dev/null when operating in inetd
mode and report the error message from the OS.

This fixes a compiler warning about the return value of freopen()
being ignored on Ubuntu 8.10.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodescribe: Avoid unnecessary warning when using --all
Shawn O. Pearce [Fri, 26 Dec 2008 22:02:01 +0000 (14:02 -0800)]
describe: Avoid unnecessary warning when using --all

In 212945d4 ("Teach git-describe to verify annotated tag names
before output") git-describe learned how to output a warning if
an annotated tag object was matched but its internal name doesn't
match the local ref name.

However, "git describe --all" causes the local ref name to be
prefixed with "tags/", so we need to skip over this prefix before
comparing the local ref name with the name recorded inside of the
tag object.

Patch-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomerge-recursive: mark rename/delete conflict as unmerged
Johannes Schindelin [Mon, 22 Dec 2008 22:10:20 +0000 (23:10 +0100)]
merge-recursive: mark rename/delete conflict as unmerged

When a file was renamed in one branch, but deleted in the other, one
should expect the index to contain an unmerged entry, namely the
target of the rename.  Make it so.

Noticed by Constantine Plotnikov.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp-push: support full URI in handle_remote_ls_ctx()
Kirill A. Korinskiy [Tue, 23 Dec 2008 08:31:15 +0000 (11:31 +0300)]
http-push: support full URI in handle_remote_ls_ctx()

The program calls remote_ls() to get list of files from the server over
HTTP; handle_remote_ls_ctx() is used to parse its response to populate
"struct remote_ls_ctx" that is returned from remote_ls().

The handle_remote_ls_ctx() function assumed that the server returns a
local path in href field, but RFC 4918 (14.7) demand of support full URI
(e.g. "http://localhost:8080/repo.git").

This resulted in push failure (e.g. git-http-push issues a PROPFIND
request to "/repo.git/alhost:8080/repo.git/refs/" to the server).

Signed-off-by: Kirill A. Korinskiy <catap@catap.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.1 v1.6.1
Junio C Hamano [Thu, 25 Dec 2008 03:41:08 +0000 (19:41 -0800)]
GIT 1.6.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'js/rebase-i-p'
Junio C Hamano [Wed, 24 Dec 2008 08:14:14 +0000 (00:14 -0800)]
Merge branch 'js/rebase-i-p'

* js/rebase-i-p:
  rebase -i -p: leave a --cc patch when a merge could not be redone
  rebase -i -p: Fix --continue after a merge could not be redone
  Show a failure of rebase -p if the merge had a conflict

15 years agorebase -i -p: leave a --cc patch when a merge could not be redone
Johannes Schindelin [Mon, 22 Dec 2008 21:16:51 +0000 (22:16 +0100)]
rebase -i -p: leave a --cc patch when a merge could not be redone

The result is easier to review this way, and the merge resolution has to be
done inside the work tree, not by adjusting "the patch" anyway.

15 years agot9129: skip the last three tests if UTF-8 locale is not available
Miklos Vajna [Tue, 23 Dec 2008 01:09:24 +0000 (02:09 +0100)]
t9129: skip the last three tests if UTF-8 locale is not available

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.1-rc4 v1.6.1-rc4
Junio C Hamano [Mon, 22 Dec 2008 03:20:21 +0000 (19:20 -0800)]
GIT 1.6.1-rc4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAlways show which directory is not a git repository
Richard Hartmann [Sun, 21 Dec 2008 23:17:32 +0000 (00:17 +0100)]
Always show which directory is not a git repository

Unify all

  fatal: Not a git repository

error messages so they include path information.

Signed-off-by: Richard Hartmann <richih@net.in.tum.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMake help entries alphabetical
Richard Hartmann [Sun, 21 Dec 2008 22:28:25 +0000 (23:28 +0100)]
Make help entries alphabetical

Signed-off-by: Richard Hartmann <richih@net.in.tum.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Mon, 22 Dec 2008 02:35:54 +0000 (18:35 -0800)]
Merge branch 'maint'

* maint:
  doc/git-fsck: change the way for getting heads' SHA1s

15 years agogit-revert documentation: refer to new HOWTO on reverting faulty merges
Boyd Stephen Smith Jr [Mon, 22 Dec 2008 00:26:03 +0000 (18:26 -0600)]
git-revert documentation: refer to new HOWTO on reverting faulty merges

Signed-off-by: Boyd Stephen Smith Jr <bss@iguanasuicide.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-revert: record the parent against which a revert was made
Robin Rosenberg [Sun, 21 Dec 2008 22:17:12 +0000 (14:17 -0800)]
git-revert: record the parent against which a revert was made

As described in Documentation/howto/revert-a-faulty-merge.txt, re-merging
from a previously reverted a merge of a side branch may need a revert of
the revert beforehand.  Record against which parent the revert was made in
the commit, so that later the user can figure out what went on.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge git://git.kernel.org/pub/scm/gitk/gitk
Junio C Hamano [Mon, 22 Dec 2008 02:31:12 +0000 (18:31 -0800)]
Merge git://git.kernel.org/pub/scm/gitk/gitk

* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Force the focus to the main window on Windows
  gitk: Allow unbalanced quotes/braces in commit headers
  gitk: Update German translation
  gitk: Mark forgotten strings (header sentence parts in color chooser) for translation
  gitk: Ensure that "Reset branch" menu entry is enabled
  gitk: Use check-buttons' -text property instead of separate labels
  gitk: Map / to focus the search box
  gitk: Fix bugs in blaming code

15 years agogitk: Force the focus to the main window on Windows
Johannes Sixt [Thu, 18 Dec 2008 07:30:49 +0000 (08:30 +0100)]
gitk: Force the focus to the main window on Windows

On msysGit, the focus is first on the (Tk) console.  This console is then
hidden, but keeps the focus.  Work around that by forcing the focus onto
the gitk window.

This fixes msysGit issue 14.  Diagnosed and originally fixed by
Johannes Schindelin.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>