Code

git.git
13 years agohttp-push: add trailing slash at arg-parse time, instead of later on
Tay Ray Chuan [Thu, 25 Nov 2010 08:21:09 +0000 (16:21 +0800)]
http-push: add trailing slash at arg-parse time, instead of later on

That way, we don't have to update repo->path and repo->path_len again
after adding the trailing slash.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agohttp-push: check path length before using it
Tay Ray Chuan [Thu, 25 Nov 2010 08:21:08 +0000 (16:21 +0800)]
http-push: check path length before using it

We use path_len to skip the base url/path, but we do not know for sure
if path does indeed contain the base url/path. Check if this is so.

Helped-by: Johnathan Nieder <jrnieder@gmail.com>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agohttp-push: Normalise directory names when pushing to some WebDAV servers
Tay Ray Chuan [Thu, 25 Nov 2010 08:21:07 +0000 (16:21 +0800)]
http-push: Normalise directory names when pushing to some WebDAV servers

Fix a bug when pushing to WebDAV servers which do not use a trailing
slash for collection names. The previous implementation fails to see
that the requested resource "refs/" is the same resource as "refs"
and loads every reference twice (once for refs/ and once for refs).

This implementation normalises every collection name by appending a
trailing slash if necessary.

This can be tested with old versions of Apache (such as the WebDAV
server of GMX, Apache 2.0.63).

Based-on-patch-by: Gabriel Corona <gabriel.corona@enst-bretagne.fr>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agohttp-backend: use end_url_with_slash()
Tay Ray Chuan [Thu, 25 Nov 2010 08:21:06 +0000 (16:21 +0800)]
http-backend: use end_url_with_slash()

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agourl: add str wrapper for end_url_with_slash()
Tay Ray Chuan [Thu, 25 Nov 2010 08:21:05 +0000 (16:21 +0800)]
url: add str wrapper for end_url_with_slash()

Helped-by: Johnathan Nieder <jrnieder@gmail.com>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoshift end_url_with_slash() from http.[ch] to url.[ch]
Tay Ray Chuan [Thu, 25 Nov 2010 08:21:04 +0000 (16:21 +0800)]
shift end_url_with_slash() from http.[ch] to url.[ch]

This allows non-http/curl users to access it too (eg. http-backend.c).

Update include headers in end_url_with_slash() users too.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot5550-http-fetch: add test for http-fetch
Tay Ray Chuan [Thu, 25 Nov 2010 08:21:03 +0000 (16:21 +0800)]
t5550-http-fetch: add test for http-fetch

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot5550-http-fetch: add missing '&&'
Tay Ray Chuan [Thu, 25 Nov 2010 08:21:02 +0000 (16:21 +0800)]
t5550-http-fetch: add missing '&&'

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jl/maint-pull-tags-doc' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:47:42 +0000 (12:47 -0800)]
Merge branch 'jl/maint-pull-tags-doc' into maint

* jl/maint-pull-tags-doc:
  pull: Remove --tags option from manpage

13 years agoMerge branch 'kb/maint-diff-ws-check' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:47:27 +0000 (12:47 -0800)]
Merge branch 'kb/maint-diff-ws-check' into maint

* kb/maint-diff-ws-check:
  diff: handle lines containing only whitespace and tabs better
  test-lib: extend test_decode_color to handle more color codes

13 years agoMerge branch 'jm/mailmap' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:47:18 +0000 (12:47 -0800)]
Merge branch 'jm/mailmap' into maint

* jm/mailmap:
  t4203: do not let "git shortlog" DWIM based on tty
  t4203 (mailmap): stop hardcoding commit ids and dates
  mailmap: fix use of freed memory

13 years agoMerge branch 'tr/maint-git-repack-tmpfile' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:47:10 +0000 (12:47 -0800)]
Merge branch 'tr/maint-git-repack-tmpfile' into maint

* tr/maint-git-repack-tmpfile:
  repack: place temporary packs under .git/objects/pack/

13 years agoMerge branch 'jk/maint-apply-no-binary' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:47:04 +0000 (12:47 -0800)]
Merge branch 'jk/maint-apply-no-binary' into maint

* jk/maint-apply-no-binary:
  apply: don't segfault on binary files with missing data

13 years agoMerge branch 'jn/send-pack-error' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:46:46 +0000 (12:46 -0800)]
Merge branch 'jn/send-pack-error' into maint

* jn/send-pack-error:
  send-pack: avoid redundant "pack-objects died with strange error"

13 years agoMerge branch 'ak/submodule-sync' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:46:40 +0000 (12:46 -0800)]
Merge branch 'ak/submodule-sync' into maint

* ak/submodule-sync:
  submodule sync: Update "submodule.<name>.url" for empty directories

13 years agoMerge branch 'jk/maint-rev-list-nul' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:46:32 +0000 (12:46 -0800)]
Merge branch 'jk/maint-rev-list-nul' into maint

* jk/maint-rev-list-nul:
  rev-list: handle %x00 NUL in user format

13 years agoMerge branch 'cb/diff-fname-optim' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:46:26 +0000 (12:46 -0800)]
Merge branch 'cb/diff-fname-optim' into maint

* cb/diff-fname-optim:
  diff: avoid repeated scanning while looking for funcname
  do not search functions for patch ID
  add rebase patch id tests

13 years agoMerge branch 'jk/no-textconv-symlink' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:46:20 +0000 (12:46 -0800)]
Merge branch 'jk/no-textconv-symlink' into maint

* jk/no-textconv-symlink:
  diff: don't use pathname-based diff drivers for symlinks

13 years agoMerge branch 'dk/maint-blame-el' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:46:17 +0000 (12:46 -0800)]
Merge branch 'dk/maint-blame-el' into maint

* dk/maint-blame-el:
  git-blame.el: Add (require 'format-spec)

13 years agoMerge branch 'aw/git-p4-deletion' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:46:14 +0000 (12:46 -0800)]
Merge branch 'aw/git-p4-deletion' into maint

* aw/git-p4-deletion:
  Fix handling of git-p4 on deleted files

13 years agoMerge branch 'kf/post-receive-sample-hook' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:45:39 +0000 (12:45 -0800)]
Merge branch 'kf/post-receive-sample-hook' into maint

* kf/post-receive-sample-hook:
  post-receive-email: ensure sent messages are not empty

13 years agoMerge branch 'jk/repack-reuse-object' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:45:07 +0000 (12:45 -0800)]
Merge branch 'jk/repack-reuse-object' into maint

* jk/repack-reuse-object:
  Documentation: pack.compression: explain how to recompress
  repack: add -F flag to let user choose between --no-reuse-delta/object

Conflicts:
Documentation/git-repack.txt

13 years agoMerge branch 'bc/fix-cherry-pick-root' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:44:46 +0000 (12:44 -0800)]
Merge branch 'bc/fix-cherry-pick-root' into maint

* bc/fix-cherry-pick-root:
  builtin/revert.c: don't dereference a NULL pointer

13 years agoMerge branch 'uk/fix-author-ident-sed-script' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:44:41 +0000 (12:44 -0800)]
Merge branch 'uk/fix-author-ident-sed-script' into maint

* uk/fix-author-ident-sed-script:
  get_author_ident_from_commit(): remove useless quoting

13 years agoMerge branch 'ab/makefile-track-cc' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:44:35 +0000 (12:44 -0800)]
Merge branch 'ab/makefile-track-cc' into maint

* ab/makefile-track-cc:
  Makefile: add CC to TRACK_CFLAGS

13 years agoMerge branch 'mg/reset-doc' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:44:26 +0000 (12:44 -0800)]
Merge branch 'mg/reset-doc' into maint

* mg/reset-doc:
  git-reset.txt: make modes description more consistent
  git-reset.txt: point to git-checkout
  git-reset.txt: use "working tree" consistently
  git-reset.txt: reset --soft is not a no-op
  git-reset.txt: reset does not change files in target
  git-reset.txt: clarify branch vs. branch head

13 years agoMerge branch 'tr/send-email-refuse-sending-unedited-cover-letter' into maint
Junio C Hamano [Wed, 24 Nov 2010 20:44:12 +0000 (12:44 -0800)]
Merge branch 'tr/send-email-refuse-sending-unedited-cover-letter' into maint

* tr/send-email-refuse-sending-unedited-cover-letter:
  send-email: Refuse to send cover-letter template subject

13 years agoimap-send: link against libcrypto for HMAC and others
Diego Elio Pettenò [Wed, 24 Nov 2010 20:03:53 +0000 (21:03 +0100)]
imap-send: link against libcrypto for HMAC and others

When using stricter linkers, such as GNU gold or Darwin ld, transitive
dependencies are not counted towards symbol resolution. If we don't link
imap-send to libcrypto, we'll have undefined references to the HMAC_*,
EVP_* and ERR_* functions families.

Signed-off-by: Diego Elio Pettenò <flameeyes@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-send-email.perl: Deduplicate "to:" and "cc:" entries with names
Joe Perches [Sat, 20 Nov 2010 23:06:05 +0000 (15:06 -0800)]
git-send-email.perl: Deduplicate "to:" and "cc:" entries with names

If an email address in the "to:" list is in the style
"First Last <email@domain.tld>", ie: not just a bare
address like "email@domain.tld", and the same named
entry style exists in the "cc:" list, the current
logic will not remove the entry from the "cc:" list.

Add logic to better deduplicate the "cc:" list by also
matching the email address with angle brackets.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoreflogs: clear flags properly in corner case
Jeff King [Mon, 22 Nov 2010 04:42:53 +0000 (23:42 -0500)]
reflogs: clear flags properly in corner case

The reflog-walking mechanism is based on the regular
revision traversal. We just rewrite the parents of each
commit in fake_reflog_parent to point to the commit in the
next reflog entry instead of the real parents.

However, the regular revision traversal tries not to show
the same commit twice, and so sets the SHOWN flag on each
commit it shows. In a reflog, however, we may want to see
the same commit more than once if it appears in the reflog
multiple times (which easily happens, for example, if you do
a reset to a prior state).

The fake_reflog_parent function takes care of this by
clearing flags, including SHOWN. Unfortunately, it does so
at the very end of the function, and it is possible to
return early from the function if there is no fake parent to
set up (e.g., because we are at the very first reflog entry
on the branch). In such a case the flag is not cleared, and
the entry is skipped by the revision traversal machinery as
already shown.

You can see this by walking the log of a ref which is set to
its very first commit more than once (the test below shows
such a situation). In this case the reflog walk will fail to
show the entry for the initial creation of the ref.

We don't want to simply move the flag-clearing to the top of
the function; we want to make sure flags set during the
fake-parent installation are also cleared. Instead, let's
hoist the flag-clearing out of the fake_reflog_parent
function entirely. It's not really about fake parents
anyway, and the only caller is the get_revision machinery.

Reported-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorebase --abort: do not update branch ref
Martin von Zweigbergk [Sun, 21 Nov 2010 11:11:21 +0000 (12:11 +0100)]
rebase --abort: do not update branch ref

If a non-interactive rebase of a ref fails at commit X and is aborted by
the user, the ref will be updated twice. First to point at X (with the
reflog message "rebase finished: $head_name onto $onto"), and then back
to $orig_head. It should not be updated at all.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomingw: do not set errno to 0 on success
Erik Faye-Lund [Tue, 23 Nov 2010 19:53:08 +0000 (20:53 +0100)]
mingw: do not set errno to 0 on success

Currently do_lstat always sets errno to 0 on success. This incorrectly
overwrites previous errors.

Fetch the error-code into a temporary variable instead, and assign that
to errno on failure.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoclean: remove redundant variable baselen
Nguyễn Thái Ngọc Duy [Mon, 15 Nov 2010 06:42:44 +0000 (13:42 +0700)]
clean: remove redundant variable baselen

baselen used to be the result of common_prefix() when it was made
builtin. Since 1d8842d (Add 'fill_directory()' helper function for
directory traversal - 2009-05-14), its value will always be
zero. Remove it because it's no longer variable.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'mz/maint-rebase-X-fix' into maint
Junio C Hamano [Wed, 17 Nov 2010 21:18:19 +0000 (13:18 -0800)]
Merge branch 'mz/maint-rebase-X-fix' into maint

* mz/maint-rebase-X-fix:
  t3402: test "rebase -s<strategy> -X<opt>"

13 years agoDocumentation/git-pull: clarify configuration
Martin von Zweigbergk [Fri, 12 Nov 2010 18:55:58 +0000 (19:55 +0100)]
Documentation/git-pull: clarify configuration

The sentence about 'branch.<name>.rebase' refers to the first sentence
in the paragraph and not to the sentence about avoiding rebasing
non-local changes. Clarify this.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocument that rev-list --graph triggers parent rewriting.
Yann Dirson [Fri, 12 Nov 2010 08:48:58 +0000 (09:48 +0100)]
Document that rev-list --graph triggers parent rewriting.

This may help to understand why --graph causes more comments to
be selected.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix username and password extraction from HTTP URLs
Gabriel Corona [Sun, 14 Nov 2010 01:51:15 +0000 (02:51 +0100)]
Fix username and password extraction from HTTP URLs

Change the authentification initialisation to percent-decode username
and password for HTTP URLs.

Signed-off-by: Gabriel Corona <gabriel.corona@enst-bretagne.fr>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot5550: test HTTP authentication and userinfo decoding
Gabriel Corona [Sun, 14 Nov 2010 01:51:14 +0000 (02:51 +0100)]
t5550: test HTTP authentication and userinfo decoding

Add a test for HTTP authentication and proper percent-decoding of the
userinfo (username and password) part of the URL.

Signed-off-by: Gabriel Corona <gabriel.corona@enst-bretagne.fr>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agolog.decorate: accept 0/1 bool values
Jeff King [Wed, 17 Nov 2010 17:00:45 +0000 (12:00 -0500)]
log.decorate: accept 0/1 bool values

We explicitly document "0" and "1" as synonyms for "false"
and "true" in boolean config options. However, we don't
actually handle those values in git_config_maybe_bool.

In most cases this works fine, as we call git_config_bool,
which in turn calls git_config_bool_or_int, which in turn
calls git_config_maybe_bool. Values of 0/1 are considered
"not bool", but their integer values end up being converted
to the corresponding boolean values.

However, the log.decorate code looks for maybe_bool
explicitly, so that it can fall back to the "short" and
"full" strings. It does not handle 0/1 at all, and considers
them invalid values.

We cannot simply add 0/1 support to git_config_maybe_bool.
That would confuse git_config_bool_or_int, which may want to
distinguish the integer values "0" and "1" from bools.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoclean: avoid quoting twice
Nguyễn Thái Ngọc Duy [Mon, 15 Nov 2010 10:12:44 +0000 (17:12 +0700)]
clean: avoid quoting twice

qname is the result of quote_path_relative(), which does
quote_c_style_counted() internally. Remove the hard-coded quotes.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodocument sigchain api
Jeff King [Fri, 12 Nov 2010 04:24:56 +0000 (23:24 -0500)]
document sigchain api

It's pretty straightforward, but a stripped-down example
never hurts. And we should make clear that it is explicitly
OK to use SIG_DFL and SIG_IGN.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoKeep together options controlling the behaviour of diffcore-rename.
Yann Dirson [Wed, 10 Nov 2010 20:27:13 +0000 (21:27 +0100)]
Keep together options controlling the behaviour of diffcore-rename.

It makes little sense to have --diff-filter in the middle of them, and
even spares an ifndef::git-format-patch.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodo not overwrite untracked during merge from unborn branch
Clemens Buchacher [Sun, 14 Nov 2010 22:07:49 +0000 (23:07 +0100)]
do not overwrite untracked during merge from unborn branch

In case HEAD does not point to a valid commit yet, merge is
implemented as a hard reset. This will cause untracked files to be
overwritten.

Instead, assume the empty tree for HEAD and do a regular merge. An
untracked file will cause the merge to abort and do nothing. If no
conflicting files are present, the merge will have the same effect
as a hard reset.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosetup: make sure git_dir path is in a permanent buffer, getenv(3) case
Kirill Smelkov [Thu, 11 Nov 2010 18:08:23 +0000 (21:08 +0300)]
setup: make sure git_dir path is in a permanent buffer, getenv(3) case

getenv(3) returns not-permanent buffer which may be changed by e.g.
putenv(3) call (*).

In practice I've noticed this when trying to do `git commit -m abc`
inside msysgit under wine, getting

    $ git commit -m abc
    fatal: could not open 'DIR=.git/COMMIT_EDITMSG': No such file or directory
                           ^^^^
    (notice introduced 'DIR=' artifact.)

The problem was showing itself only with -m option, and actually, as
debugging showed, originally

    git_dir = getenv("GIT_DIR")

returned pointer to

        "GIT_DIR=.git\0"
                 ^
               git_dir

, we stored it in git_dir, than, after processing -m git-commit option,
we did setenv("GIT_EDITOR", ":") which as (*) says changed environment
variables memory layout - something like this

       "...\0GIT_DIR=.git\0"
                 ^
               git_dir

and oops - we got wrong git_dir.

Avoid that by strdupping getenv("GIT_DIR") result like we did in 06f354
(setup: make sure git dir path is in a permanent buffer). Unfortunately
this also shows that other getenv usage inside git needs auditing...

(*) from man 3 getenv:

       The implementation of getenv() is not required to  be  reentrant.   The
       string  pointed  to  by  the return value of getenv() may be statically
       allocated, and can be  modified  by  a  subsequent  call  to  getenv(),
       putenv(3), setenv(3), or unsetenv(3).

Cc: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3402: test "rebase -s<strategy> -X<opt>"
Junio C Hamano [Thu, 11 Nov 2010 21:28:57 +0000 (13:28 -0800)]
t3402: test "rebase -s<strategy> -X<opt>"

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: point to related commands from gitignore
Jonathan Nieder [Wed, 10 Nov 2010 19:00:48 +0000 (13:00 -0600)]
Documentation: point to related commands from gitignore

A frequently asked question on #git is how to stop tracking a file
that is mistakenly tracked by git.  A frequently attempted strategy is
to add such files to .gitignore.

Thus one might imagine that the gitignore documentation could be a
good entry point for 'git rm' documentation.  Add some
cross-references in this vein.

While at it, move a reference to update-index --assume-unchanged from
the DESCRIPTION to lower down on the page.  This way, the methodical
reader can benefit from first learning what excludes files do, then
how they relate to other git facilities.

Based-on-patch-by: Sitaram Chamarty <sitaram@atc.tcs.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: split gitignore page into sections
Jonathan Nieder [Wed, 10 Nov 2010 18:57:39 +0000 (12:57 -0600)]
Documentation: split gitignore page into sections

A learner-by-example might want to look at the examples section first.
Help her out by supplying some section headings: PATTERN FORMAT for
the format of lines in an excludes file and EXAMPLES for the two
examples.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotag: recognize rfc1991 signatures
Michael J Gruber [Wed, 10 Nov 2010 11:17:30 +0000 (12:17 +0100)]
tag: recognize rfc1991 signatures

We have always been creating rfc1991 signatures for users with "rfc1991"
in their gpg config but failed to recognize them (tag -l -n largenumber)
and verify them (tag -v, verify-tag).

Make good use of the refactored signature detection and let us recognize
and verify those signatures also.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotag: factor out sig detection for tag display
Michael J Gruber [Wed, 10 Nov 2010 11:17:29 +0000 (12:17 +0100)]
tag: factor out sig detection for tag display

Use the factored out code for sig detection when displaying tags.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotag: factor out sig detection for body edits
Michael J Gruber [Wed, 10 Nov 2010 11:17:28 +0000 (12:17 +0100)]
tag: factor out sig detection for body edits

Use the factored out code for sig detection when editing existing
tag bodies (tag -a -f without -m).

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoverify-tag: factor out signature detection
Michael J Gruber [Wed, 10 Nov 2010 11:17:27 +0000 (12:17 +0100)]
verify-tag: factor out signature detection

into tag.h/c for later reuse and modification.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/t7004-tag: test handling of rfc1991 signatures
Michael J Gruber [Wed, 10 Nov 2010 11:17:26 +0000 (12:17 +0100)]
t/t7004-tag: test handling of rfc1991 signatures

Currently, git expects "-----BEGIN PGP SIGNATURE-----" at the beginning of a
signature. But gpg uses "MESSAGE" instead of "SIGNATURE" when used with
the "rfc1991" option. This leads to git's failing to verify it's own
signed tags, among other problems.

Add tests for all code paths (tag -v, tag -l -n largenumber, tag -f
without -m) where signature detection matters.

Reported-by: Stephan Hugel <urschrei@gmail.com>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorebase -X: do not clobber strategy
Martin von Zweigbergk [Wed, 10 Nov 2010 07:14:26 +0000 (08:14 +0100)]
rebase -X: do not clobber strategy

If any strategy options are passed to -X, the strategy will always be
set to 'recursive'. According to the documentation, it should default to
'recursive' if it is not set, but it should be possible to set it to
other values.

This fixes a regression introduced in v1.7.3-rc0~67^2 (2010-07-29).

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocherry-pick/revert: transparently refresh index
Jonathan Nieder [Sun, 31 Oct 2010 19:59:33 +0000 (14:59 -0500)]
cherry-pick/revert: transparently refresh index

A stat-dirty index is not a detail that ought to concern the operator
of porcelain such as "git cherry-pick".

Without this change, a cherry-pick after copying a worktree with rsync
errors out with a misleading message.

$ git cherry-pick build/top
error: Your local changes to 'file.h' would be overwritten by merge.  Aborting.
Please, commit your changes or stash them before you can merge.

Noticed-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoapply: handle patches with funny filename and colon in timezone
Jonathan Nieder [Wed, 29 Sep 2010 21:41:08 +0000 (16:41 -0500)]
apply: handle patches with funny filename and colon in timezone

Some patches have a timezone formatted like '-08:00' instead of
'-0800' in their ---/+++ lines (e.g. http://lwn.net/Articles/131729/).
Take this into account when searching for the start of the timezone
(which is the end of the filename).

This does not actually affect the outcome of patching unless (1) a
file being patched has a non-' ' whitespace character (e.g., tab) in
its filename, or (2) the patch is whitespace-damaged, so the tab
between filename and timestamp has been replaced with spaces.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodocs: give more hints about how "add -e" works
Jeff King [Tue, 9 Nov 2010 04:58:20 +0000 (23:58 -0500)]
docs: give more hints about how "add -e" works

The previous text was not exactly accurate; it is OK to
change space and minus lines, but only in certain ways.

This patch takes a whole new approach, which is to describe
the sorts of conceptual operations you might want to
perform. It also includes a healthy dose of warnings about
how things can go wrong.

Since the size of the text is getting quite long, it also
splits this out into an "editing patches" section. This
makes more sense with the current structure, anyway, which
already splits out the interactive mode description.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: document show -s
Jonathan Nieder [Tue, 9 Nov 2010 17:12:48 +0000 (11:12 -0600)]
Documentation: document show -s

Git's diff machinery has supported a -s (silence diff output) option
as far back as v0.99~900 (Silent flag for show-diff, 2005-04-13), but
the option is only advertised in an odd corner of the git diff-tree
manual.

The main use is to retrieve basic metadata about a commit:

git show -s rev

Explain this in the 'git log' manual and provide an example in the
'git show' examples section.  This is kind of a cop-out, since it
would be more useful to explain it in the 'git show' manual proper,
which says:

The command takes options applicable to the git
diff-tree command to control how the changes the
commit introduces are shown.

This manual page describes only the most frequently
used options.

Fixing that is a larger task for another day.

Reported-by: Will Hall <will@gnatter.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agostatus: Quote paths with spaces in short format
Kevin Ballard [Tue, 9 Nov 2010 02:44:38 +0000 (18:44 -0800)]
status: Quote paths with spaces in short format

According to the documentation for git-status, in short-format mode,
paths with spaces or unprintable characters are quoted. However
28fba29 (Do not quote SP., 2005-10-17) removed the behavior that quotes
paths that have spaces but not unprintable characters. Unfortunately this
makes the output of `git status --porcelain` non-parseable in certain
(rather unusual) edge cases. In the interest of removing ambiguity when
parsing the output of `git status --porcelain`, restore the behavior of
quoting paths with spaces in git-status's short-format mode.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodir.c: fix EXC_FLAG_MUSTBEDIR match in sparse checkout
Nguyễn Thái Ngọc Duy [Sun, 7 Nov 2010 18:04:58 +0000 (01:04 +0700)]
dir.c: fix EXC_FLAG_MUSTBEDIR match in sparse checkout

Commit c84de70 (excluded_1(): support exclude files in index -
2009-08-20) tries to work around the fact that there is no
directory/file information in index entries, therefore
EXC_FLAG_MUSTBEDIR match would fail.

Unfortunately the workaround is flawed. This fixes it.

Reported-by: Thomas Rinderknecht <thomasr@sailguy.org>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotest: git-apply -p2 rename/chmod only
Junio C Hamano [Fri, 22 Oct 2010 05:09:40 +0000 (22:09 -0700)]
test: git-apply -p2 rename/chmod only

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix git-apply with -p greater than 1
Federico Cuello [Thu, 21 Oct 2010 22:12:02 +0000 (19:12 -0300)]
Fix git-apply with -p greater than 1

Fix the case when the patch is a rename or mode-change only
and -p is used with a value greater than one.
The git_header_name function did not remove more than one path
component.

Signed-off-by: Federico Cuello <fedux@lugmen.org.ar>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agopull: Remove --tags option from manpage
Jens Lehmann [Wed, 3 Nov 2010 20:55:48 +0000 (21:55 +0100)]
pull: Remove --tags option from manpage

"Fetch all tags and merge them" does not make any sense as a request at
the logical level, even though it might be more convenient to type.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-blame.el: Add (require 'format-spec)
David Kågedal [Tue, 25 May 2010 13:44:15 +0000 (15:44 +0200)]
git-blame.el: Add (require 'format-spec)

c5022f57 (git-blame.el: Change how blame information is shown,
2009-09-29) taught the "M-x git-blame" mode to format its output
in a more interesting way, making use of the format-spec function.

format-spec is included in Emacs 23 and is a useful function.
Older emacsen can get it from Gnus.  In all emacsen, we need
to 'require it before use to avoid warnings:

 git-blame.el:483:1:Warning: the function `format-spec' is not known to be
     defined.

Reported-by: Sergei Organov <osv@javad.com>
Reported-by: Kevin Ryde <user42@zip.com.au>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoapply: don't segfault on binary files with missing data
Jeff King [Mon, 18 Oct 2010 18:39:17 +0000 (14:39 -0400)]
apply: don't segfault on binary files with missing data

Usually when applying a binary diff generated without
--binary, it will be rejected early, as we don't even have
the full sha1 of the pre- and post-images.

However, if the diff is generated with --full-index (but not
--binary), then we will actually try to apply it. If we have
the postimage blob, then we can take a shortcut and never
even look at the binary diff at all (e.g., this can happen
when rebasing changes within a repository).

If we don't have the postimage blob, though, we try to look
at the actual fragments, of which there are none, and get a
segfault. This patch checks explicitly for that case and
complains to the user instead of segfaulting. We need to
keep the check at a low level so that the "shortcut" case
above continues to work.

We also add a test that demonstrates the segfault. While
we're at it, let's also explicitly test the shortcut case.

Reported-by: Rafaël Carré <rafael.carre@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix a formatting error in git-merge.txt
Nathan W. Panike [Fri, 29 Oct 2010 15:33:54 +0000 (10:33 -0500)]
Fix a formatting error in git-merge.txt

Inside an element of an enumerated list, the second and subsequent
paragraphs need to lose their indent and have to be strung together with a
line with a single '+' on it instead.  Otherwise the lines below are shown
in typewriter face, which just looks wrong.

Signed-off-by: Nathan W. Panike <nathan.panike@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoCorrect help blurb in checkout -p and friends
Jonathan "Duke" Leto [Thu, 28 Oct 2010 00:49:20 +0000 (17:49 -0700)]
Correct help blurb in checkout -p and friends

When git checkout -p from the index or HEAD is run in edit mode, the
help message about removing '-' and '+' lines was backwards. Because it
is reverse applying the patch, the meanings of '-' and '+' are reversed.

Signed-off-by: Jonathan "Duke" Leto <jonathan@leto.net>
Acked-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix copy-pasted comments related to tree diff handling.
Yann Dirson [Sun, 24 Oct 2010 21:03:10 +0000 (23:03 +0200)]
Fix copy-pasted comments related to tree diff handling.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomake pack-objects a bit more resilient to repo corruption
Nicolas Pitre [Fri, 22 Oct 2010 20:26:23 +0000 (16:26 -0400)]
make pack-objects a bit more resilient to repo corruption

Right now, packing valid objects could fail when creating a thin pack
simply because a pack edge object used as a preferred base is corrupted.
Since preferred base objects are not strictly needed to produce a valid
pack, let's not consider the inability to read them as a fatal error.
Delta compression may well be attempted against other objects in the
search window.  To avoid warning storms (we are in the inner loop of
the delta search window) a warning is emitted only on the first
occurrence.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix handling of git-p4 on deleted files
Andrew Waters [Fri, 22 Oct 2010 12:26:02 +0000 (13:26 +0100)]
Fix handling of git-p4 on deleted files

Signed-off-by: Andrew Waters <apwaters@googlemail.com>
Tested-by: Thomas Berg <merlin66b@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff: don't presume empty file when corresponding object is missing
Nicolas Pitre [Fri, 22 Oct 2010 04:02:27 +0000 (00:02 -0400)]
diff: don't presume empty file when corresponding object is missing

The low-level diff code will happily produce totally bogus diff output
with a broken repository via format-patch and friends by treating missing
objects as empty files.  Let's prevent that from happening any longer.

Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.3.2 v1.7.3.2
Junio C Hamano [Fri, 22 Oct 2010 00:14:32 +0000 (17:14 -0700)]
Git 1.7.3.2

13 years agoMerge branch 'sn/doc-opt-notation' into maint
Junio C Hamano [Thu, 21 Oct 2010 23:26:42 +0000 (16:26 -0700)]
Merge branch 'sn/doc-opt-notation' into maint

* sn/doc-opt-notation:
  Fix {update,checkout}-index usage strings
  Put a space between `<' and argument in pack-objects usage string
  Remove stray quotes in --pretty and --format documentation
  Use parentheses and `...' where appropriate
  Fix odd markup in --diff-filter documentation
  Use angles for placeholders consistently

13 years agoMerge branch 'mg/fix-build-remote-helpers' into maint
Junio C Hamano [Thu, 21 Oct 2010 23:26:38 +0000 (16:26 -0700)]
Merge branch 'mg/fix-build-remote-helpers' into maint

* mg/fix-build-remote-helpers:
  remote-helpers: build in platform independent directory

13 years agodocs: give more hints about how "add -e" works
Jeff King [Thu, 21 Oct 2010 14:30:35 +0000 (10:30 -0400)]
docs: give more hints about how "add -e" works

The previous text was not exactly accurate; it is OK to
change space and minus lines, but only in certain ways. This
patch attempts to cover explicitly what can be done at the
individual line level, and cautions the user that
conceptually larger changes (like modifying a line) require
some understanding of the patch format.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff: handle lines containing only whitespace and tabs better
Kevin Ballard [Wed, 20 Oct 2010 22:17:26 +0000 (15:17 -0700)]
diff: handle lines containing only whitespace and tabs better

When a line contains nothing but whitespace with at least one tab
and the core.whitespace config option contains blank-at-eol, the
whitespace on the line is being printed twice, once unhighlighted
(unless otherwise matched by one of the other core.whitespace values),
and a second time highlighted for blank-at-eol.

Update the leading indentation check to stop checking when it reaches
the trailing whitespace.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotest-lib: extend test_decode_color to handle more color codes
Kevin Ballard [Wed, 20 Oct 2010 22:17:25 +0000 (15:17 -0700)]
test-lib: extend test_decode_color to handle more color codes

Enhance the test_decode_color function to handle all common color codes,
including background colors and escapes that contain multiple codes.
This change necessitates changing <WHITE> to <BOLD>, so update t4034
as well.

This change is necessary for the next commit in order to test
background colors properly.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/gitweb-lib: Don't pass constant to decode_utf8
Brian Gernhardt [Wed, 20 Oct 2010 05:57:11 +0000 (01:57 -0400)]
t/gitweb-lib: Don't pass constant to decode_utf8

Encode.pm started updating the string to decode in-place when a second
argument is passed in version 2.40.

This causes 'decode_utf8("", Encode::FB_CROAK)' to die with a message
like:

  Modification of a read-only value attempted at .../Encode.pm line 216.

Work around this by passing an empty variable instead of a constant
string.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot4203: do not let "git shortlog" DWIM based on tty
Junio C Hamano [Wed, 20 Oct 2010 06:32:06 +0000 (23:32 -0700)]
t4203: do not let "git shortlog" DWIM based on tty

The "shortlog" command defaults to HEAD only when its standard input is
connected to a terminal; otherwise it acts in the traditional "filter"
mode to read and summarize the "git log" output.

Two new tests added to t4203 assumed that the command always default to
HEAD, but when the standard input is closed (or connected to /dev/null),
it output empty, which is a summary of its empty input, causing the test
to break.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/t9001-send-email.sh: fix stderr redirection in 'Invalid In-Reply-To'
Antonio Ospite [Tue, 19 Oct 2010 09:50:39 +0000 (11:50 +0200)]
t/t9001-send-email.sh: fix stderr redirection in 'Invalid In-Reply-To'

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoClarify and extend the "git diff" format documentation
Andreas Gruenbacher [Thu, 14 Oct 2010 10:53:11 +0000 (12:53 +0200)]
Clarify and extend the "git diff" format documentation

Move the similarity and dissimilarity index header description closer to
where those extended headers are described.

Describe and/or clarify the format used for file modes, pathnames, and
the index header.

Document that all "old" files refer to the state before applying the
*entire* output, and all "new" files refer to the state thereafter.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-show-ref.txt: clarify the pattern matching
Michael J Gruber [Mon, 18 Oct 2010 11:33:32 +0000 (13:33 +0200)]
git-show-ref.txt: clarify the pattern matching

git-show-ref really does not do what one would expect under the name
pattern matching, so describe it.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodocumentation: git-config minor cleanups
Cliff Frey [Mon, 18 Oct 2010 03:10:45 +0000 (20:10 -0700)]
documentation: git-config minor cleanups

Change push.default's description to add hyphens between values and
descriptions to make the manpage easier to read.  The html version is
readable either way.

Change status.showUntrackedFiles to make item descriptions be
sentences and to use the same asciidoc format as push.default.  The
only visual change is the additions of "."

Signed-off-by: Cliff Frey <cliff@meraki.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUpdate test script annotate-tests.sh to handle missing/extra authors
Kevin Ballard [Sat, 16 Oct 2010 11:09:20 +0000 (04:09 -0700)]
Update test script annotate-tests.sh to handle missing/extra authors

The current script used by annotate-tests.sh (used by t8001 and t8002) fails
to emit a warning if any of the expected authors never show up in the output
or if authors that show up in the output were never specified as expected.
Update the script to fail in both of these scenarios.

Helped-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorepack: place temporary packs under .git/objects/pack/
Thomas Rast [Tue, 19 Oct 2010 09:50:43 +0000 (11:50 +0200)]
repack: place temporary packs under .git/objects/pack/

git-pack-objects is already careful to start out its temporary packs
under .git/objects/pack/ (cf. 8b4eb6b, Do not perform cross-directory
renames when creating packs, 2008-09-22), but git-repack did not
respond in kind so the effort was lost when the filesystem boundary is
exactly at that directory.

Let git-repack pass a path under .git/objects/pack/ as the base for
its temporary packs.

This means we might need the $PACKDIR sooner (before the pack-objects
invocation), so move the mkdir up just to be safe.

Also note that the only use of *.pack is in the find invocation way
before the pack-objects call, so the temporary packs will not suddenly
show up in any wildcards because of the directory change.

Reported-by: Marat Radchenko <marat@slonopotamus.org>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosend-pack: avoid redundant "pack-objects died with strange error"
Jonathan Nieder [Sat, 16 Oct 2010 17:09:54 +0000 (12:09 -0500)]
send-pack: avoid redundant "pack-objects died with strange error"

Saying "pack-objects died with strange error" after "pack-objects died
of signal 13" seems kind of redundant.  The latter message was
introduced when the run-command API changed to report abnormal exits
on behalf of the caller (v1.6.5-rc0~86^2~5, 2009-07-04).

Similarly, after a controlled pack-objects failure (detectable as a
normal exit with nonzero status), a "died with strange error" message
would be redundant next to the message from pack-objects itself.

So leave off the "strange error" messages.

The result should look something like this:

$ git push sf master
Counting objects: 21542, done.
Compressing objects: 100% (4179/4179), done.
fatal: Unable to create temporary file: Permission denied
error: pack-objects died of signal 13
error: failed to push some refs to 'ssh://sf.net/gitroot/project/project'
$

Or in the "controlled exit" case (contrived example):

[...]
fatal: delta size changed
error: failed to push some refs to 'ssh://example.com/foo/bar'
$

Improved-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomerge-file: correctly find files when called in subdir
Thomas Rast [Sun, 17 Oct 2010 19:23:22 +0000 (21:23 +0200)]
merge-file: correctly find files when called in subdir

Since b541248 (merge.conflictstyle: choose between "merge" and "diff3
-m" styles, 2008-08-29), git-merge-file uses setup_directory_gently(),
thus cd'ing around to find any possible config files to use.

This broke merge-file when it is called from within a subdirectory of
a repository, and the arguments are all relative paths.

Fix by prepending the prefix, as passed down from the main git
setup code, if there is any.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoprefix_filename(): safely handle the case where pfx_len=0
Thomas Rast [Sun, 17 Oct 2010 19:23:21 +0000 (21:23 +0200)]
prefix_filename(): safely handle the case where pfx_len=0

Current prefix_filename() is proofed against the case where the prefix
'pfx' is NULL or a 0-length string, _except on Windows_.

Change the behaviour to work the same on both platforms, and only
check pfx_len so that callers passing a NULL prefix with a nonzero
pfx_len segfault early on both.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot4203 (mailmap): stop hardcoding commit ids and dates
Jonathan Nieder [Fri, 15 Oct 2010 17:12:19 +0000 (12:12 -0500)]
t4203 (mailmap): stop hardcoding commit ids and dates

A seemingly innocuous change like adding test_tick somewhere can
completely upset the final mailmap test, since it checks commit
hashes and dates.  Make the test less fragile by fuzzing away the
unpredictable parts and leaving in the authors (which is what the
test is about, anyway).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodiff --check: correct line numbers of new blank lines at EOF
Christoph Mallon [Sun, 10 Oct 2010 17:24:06 +0000 (19:24 +0200)]
diff --check: correct line numbers of new blank lines at EOF

The whitespace check printed the value of the wrong variable, i.e. the
beginning of the block of blank lines at the EOF (possibly absent) in the
old file.

As "git diff --check" is used by users to check their changes before
making a commit, we should point at the line number in the file after
the change.

Signed-off-by: Christoph Mallon <christoph.mallon@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agomailmap: fix use of freed memory
Jim Meyering [Mon, 11 Oct 2010 15:41:16 +0000 (17:41 +0200)]
mailmap: fix use of freed memory

On an x86_64 system (F13-based), I ran these commands in an empty directory:

    git init
    printf '%s\n' \
      '<jdoe@example.com> <jdoe@example.COM>' \
      'John <jdoe@example.com>' > .mailmap
    git shortlog < /dev/null

Here's the result:

    (reading log message from standard input)
    *** glibc detected *** git: free(): invalid pointer: 0x0000000000f53730 ***
    ======= Backtrace: =========
    /lib64/libc.so.6[0x31ba875676]
    git[0x48c2a5]
    git[0x4b9858]
    ...
    zsh: abort (core dumped)  git shortlog

What happened?

Some .mailmap entry is of the <email1> <email2> form,
while a subsequent one looks like "User Name <Email2>,
and the two email addresses on the right are not identical
but are "equal" when using a case-insensitive comparator.

Then, when add_mapping is processing the latter line, new_email is NULL
and we free me->email, yet do not replace it with a new strdup'd string.
Thus, when later we attempt to use the buffer behind that ->email pointer,
we reference freed memory.

The solution is to free ->email and ->name only if we're about to replace them.

[jc: squashed in the tests from Jonathan]

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoBetter advice on using topic branches for kernel development
Luck, Tony [Fri, 1 Oct 2010 18:57:52 +0000 (11:57 -0700)]
Better advice on using topic branches for kernel development

Linus Torvalds wrote:
> The real problem is that maintainers often pick random - and not at
> all stable - points for their development to begin with. They just
> pick some random "this is where Linus -git tree is today", and do
> their development on top of that. THAT is the problem - they are
> unaware that there's some nasty bug in that version.

Maybe they do this because they read it in the Git user-manual.

Fix the manual to give them better guidance.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: update implicit "--no-index" behavior in "git diff"
Jonathan Nieder [Mon, 11 Oct 2010 16:06:18 +0000 (11:06 -0500)]
Documentation: update implicit "--no-index" behavior in "git diff"

Originally "--no-index" mode triggered for untracked files within the
tracked tree, but with v1.5.6-rc1~41 (Merge branch 'jc/diff-no-no-index,
2008-05-26) the command was fixed to only implicitly trigger when paths
outside the tracked tree are mentioned.

Reported-by: Yann Dirson <dirson@bertin.fr>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: expand 'git diff' SEE ALSO section
Jonathan Nieder [Mon, 11 Oct 2010 16:05:32 +0000 (11:05 -0500)]
Documentation: expand 'git diff' SEE ALSO section

Point in many directions in the hope of helping the reader find what
is needed more quickly.

This commit also removes the summary attached to the SEE ALSO entry
for difftool, to avoid making the SEE ALSO list too verbose.  If the
reader wants a summary of the commands referred to, she can always
look to the top of the named pages or to the table of contents on the
main git(1) page.

Suggested-by: Goswin von Brederlow <goswin-v-b@web.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: diff can compare blobs
Jonathan Nieder [Mon, 11 Oct 2010 16:04:08 +0000 (11:04 -0500)]
Documentation: diff can compare blobs

Meanwhile, there is no plumbing command to compare two blobs.
Strange.

Reported-by: Yann Dirson <dirson@bertin.fr>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: gitrevisions is in section 7
Jonathan Nieder [Mon, 11 Oct 2010 16:03:32 +0000 (11:03 -0500)]
Documentation: gitrevisions is in section 7

Fix references to gitrevisions(1) in the manual pages and HTML
documentation.

In practice, this will not matter much unless someone tries to use a
hard copy of the git reference manual.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorev-list: handle %x00 NUL in user format
Jeff King [Thu, 7 Oct 2010 18:25:43 +0000 (14:25 -0400)]
rev-list: handle %x00 NUL in user format

The code paths for showing commits in "git log" and "git
rev-list --graph" correctly handle embedded NULs by looking
only at the resulting strbuf's length, and never treating it
as a C string. The code path for regular rev-list, however,
used printf("%s"), which resulted in truncated output. This
patch uses fwrite instead, like the --graph code path.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosubmodule sync: Update "submodule.<name>.url" for empty directories
Andreas Köhler [Fri, 8 Oct 2010 01:07:48 +0000 (03:07 +0200)]
submodule sync: Update "submodule.<name>.url" for empty directories

If a submodule directory has not been filled by "git submodule update"
yet, then "git submodule sync" must still update the super-project's
configuration for submodule.<name>.url.

This situation occurs when switching between branches with a module from
different urls and other branches without the submodule.

Signed-off-by: Andreas Köhler <andi5.py@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoapply: Recognize epoch timestamps with : in the timezone
Anders Kaseorg [Wed, 29 Sep 2010 20:49:49 +0000 (16:49 -0400)]
apply: Recognize epoch timestamps with : in the timezone

Some patches have a timezone formatted like ‘-08:00’ instead of
‘-0800’ (e.g. http://lwn.net/Articles/131729/), so git apply would
fail to recognize the epoch timestamp of deleted files and would
create empty files instead.  Teach it to support both formats, and add
a test case.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoshell portability: no "export VAR=VAL"
Junio C Hamano [Wed, 13 Oct 2010 18:36:36 +0000 (11:36 -0700)]
shell portability: no "export VAR=VAL"

It is more portable to say "VAR=VAL && export VAR" instead.

Noticed by Ævar.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoCodingGuidelines: reword parameter expansion section
Junio C Hamano [Wed, 13 Oct 2010 18:15:14 +0000 (11:15 -0700)]
CodingGuidelines: reword parameter expansion section

Group entries related to parameter substitutions together and avoid
using the word "regexp" to refer to the ${parameter/pattern/string}
substitution (banned), as the pattern there is a shell glob and not
a regular expression.

Signed-off-by: Junio C Hamano <gitster@pobox.com>