Commit graph

4494 commits

Author SHA1 Message Date
Junio C Hamano ef88ad2387 rebase --skip: correctly wrap-up when skipping the last patch
When "rebase --skip" is used to skip the last patch in the series, the
code to wrap up the rewrite by copying the notes from old to new commits
and also by running the post-rewrite hook was bypassed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 16:50:28 -08:00
Jonathan Nieder 77e572653b t0050: fix printf format strings for portability
Unlike bash and ksh, dash passes through hexadecimal \xcc escapes.
So when run with dash, these tests *pass* (since '\xcc' is a perfectly
reasonable filename) but they are not testing what was intended.

Use octal escapes instead, in the spirit of v1.6.1-rc1~55^2
(2008-11-09).

Reported-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-21 13:26:32 -08:00
Ramsay Jones 00f66f0e49 t3419-*.sh: Fix arithmetic expansion syntax error
Some shells, for example dash versions older than 0.5.4, need to
spell a variable reference as '$N' rather than 'N' in an arithmetic
expansion. In order to avoid the syntax error, we change the
offending variable reference from 'i' to '$i' in function scramble.

There is nothing bash specific to this test script (and we shouldn't
have any bash dependent test).  Fix its shebang line.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-21 12:26:21 -08:00
Clemens Buchacher 3055d78f97 use persistent memory for rejected paths
An aborted merge prints the list of rejected paths as part of the
error message. Since commit f66caaf9 (do not overwrite files in
leading path), some of those paths do not have static buffers, so
we have to keep a copy. Use string_list's to accomplish this.

This changes the order of the list to the order in which the paths
are processed. Previously, it was reversed.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-14 08:55:13 -08:00
Clemens Buchacher b1735b1ab7 do not overwrite files in leading path
If the work tree contains an untracked file x, and
unpack-trees wants to checkout a path x/*, the
file x is removed unconditionally.

Instead, apply the same checks that are normally
used for untracked files, and abort if the file
cannot be removed.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-14 08:55:12 -08:00
Clemens Buchacher 175659b4cc t7607: add leading-path tests
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-14 08:54:05 -08:00
Clemens Buchacher 18a1d8953b t7607: use test-lib functions and check MERGE_HEAD
Use the test_commit and test_path_is_missing
functions from the test library.

Also make sure that a merge which fails due to
pre-merge checks aborts properly and does not
leave MERGE_HEAD behind.

The "will not overwrite removed file" test is an
exception to this. It notices the untracked file
at a stage where the merge is already well under
way. Therefore we cannot abort the merge without
major restructuring. See the following thread for
more details.

http://mid.gmane.org/7vskopwxej.fsf@gitster.siamese.dyndns.org

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-14 08:09:56 -08:00
Junio C Hamano 6b090e1710 Merge branch 'tc/http-urls-ends-with-slash' into maint
* tc/http-urls-ends-with-slash:
  http-fetch: rework url handling
  http-push: add trailing slash at arg-parse time, instead of later on
  http-push: check path length before using it
  http-push: Normalise directory names when pushing to some WebDAV servers
  http-backend: use end_url_with_slash()
  url: add str wrapper for end_url_with_slash()
  shift end_url_with_slash() from http.[ch] to url.[ch]
  t5550-http-fetch: add test for http-fetch
  t5550-http-fetch: add missing '&&'
2010-12-14 07:36:10 -08:00
Junio C Hamano 006f424b2d Merge branch 'jk/maint-reflog-bottom' into maint
* jk/maint-reflog-bottom:
  reflogs: clear flags properly in corner case
2010-12-14 07:35:50 -08:00
Junio C Hamano 37ad7ca7db Merge branch 'mz/rebase-abort-reflog-fix' into maint
* mz/rebase-abort-reflog-fix:
  rebase --abort: do not update branch ref
2010-12-14 07:35:44 -08:00
Junio C Hamano 187b259dce Merge branch 'gc/http-with-non-ascii-username-url' into maint
* gc/http-with-non-ascii-username-url:
  Fix username and password extraction from HTTP URLs
  t5550: test HTTP authentication and userinfo decoding

Conflicts:
	t/lib-httpd/apache.conf
2010-12-14 07:35:18 -08:00
Junio C Hamano 7bf040c5bf Merge branch 'jk/maint-decorate-01-bool' into maint
* jk/maint-decorate-01-bool:
  log.decorate: accept 0/1 bool values
2010-12-10 16:13:14 -08:00
Junio C Hamano aa78384156 Merge branch 'mg/maint-tag-rfc1991' into maint
* mg/maint-tag-rfc1991:
  tag: recognize rfc1991 signatures
  tag: factor out sig detection for tag display
  tag: factor out sig detection for body edits
  verify-tag: factor out signature detection
  t/t7004-tag: test handling of rfc1991 signatures
2010-12-10 16:13:03 -08:00
Junio C Hamano 6aa6a92fb6 Merge branch 'jn/cherry-pick-refresh-index' into maint
* jn/cherry-pick-refresh-index:
  cherry-pick/revert: transparently refresh index
2010-12-09 10:36:51 -08:00
Junio C Hamano a59c87265b Merge branch 'fc/apply-p2-get-header-name' into maint
* fc/apply-p2-get-header-name:
  test: git-apply -p2 rename/chmod only
  Fix git-apply with -p greater than 1
2010-12-09 10:36:36 -08:00
Junio C Hamano ded4dfd519 Merge branch 'ak/apply-non-git-epoch' into maint
* ak/apply-non-git-epoch:
  apply: handle patches with funny filename and colon in timezone
  apply: Recognize epoch timestamps with : in the timezone
2010-12-09 10:36:16 -08:00
Junio C Hamano ae0a37cd6b Merge branch 'cm/diff-check-at-eol' into maint
* cm/diff-check-at-eol:
  diff --check: correct line numbers of new blank lines at EOF
2010-12-09 10:36:10 -08:00
Junio C Hamano d3334d9c44 Merge branch 'tc/smart-http-post-redirect' into maint
* tc/smart-http-post-redirect:
  smart-http: Don't change POST to GET when following redirect
2010-12-09 10:36:04 -08:00
Junio C Hamano fa8f1ca2a4 Merge branch 'ab/require-perl-5.8' into maint
* ab/require-perl-5.8:
  perl: use "use warnings" instead of -w
  perl: bump the required Perl version to 5.8 from 5.6.[21]
2010-12-09 10:35:21 -08:00
Junio C Hamano 47f16e8b11 Merge branch 'cb/maint-orphan-merge-noclobber' into maint
* cb/maint-orphan-merge-noclobber:
  do not overwrite untracked during merge from unborn branch
2010-12-02 11:27:13 -08:00
Junio C Hamano 1f238da573 Merge branch 'bg/maint-gitweb-test-lib' into maint
* bg/maint-gitweb-test-lib:
  t/gitweb-lib: Don't pass constant to decode_utf8
2010-12-02 11:26:49 -08:00
Junio C Hamano a49e9af493 Merge branch 'tr/maint-merge-file-subdir' into maint
* tr/maint-merge-file-subdir:
  merge-file: correctly find files when called in subdir
  prefix_filename(): safely handle the case where pfx_len=0
2010-12-02 11:26:40 -08:00
Junio C Hamano 9f6774ed86 Merge branch 'ks/no-textconv-symlink' into maint
* ks/no-textconv-symlink:
  blame,cat-file --textconv: Don't assume mode is ``S_IFREF | 0664''
  blame,cat-file: Demonstrate --textconv is wrongly running converter on symlinks
  blame,cat-file: Prepare --textconv tests for correctly-failing conversion program
2010-12-02 11:26:24 -08:00
Junio C Hamano f3a70e9cc6 Merge branch 'bc/fortran-userdiff' into maint
* bc/fortran-userdiff:
  userdiff.c: add builtin fortran regex patterns
2010-12-02 11:25:36 -08:00
Tay Ray Chuan 6cfc028641 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>
2010-11-26 14:50:45 -08:00
Tay Ray Chuan 2bcd9ec501 t5550-http-fetch: add missing '&&'
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-26 14:50:44 -08:00
Junio C Hamano 4713fd9b5d 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
2010-11-24 12:47:27 -08:00
Junio C Hamano a33fb40fe4 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
2010-11-24 12:47:18 -08:00
Junio C Hamano 9bdef78fb0 Merge branch 'jk/maint-apply-no-binary' into maint
* jk/maint-apply-no-binary:
  apply: don't segfault on binary files with missing data
2010-11-24 12:47:04 -08:00
Junio C Hamano a274f5b21d Merge branch 'ak/submodule-sync' into maint
* ak/submodule-sync:
  submodule sync: Update "submodule.<name>.url" for empty directories
2010-11-24 12:46:40 -08:00
Junio C Hamano e7b9b80e2f Merge branch 'jk/maint-rev-list-nul' into maint
* jk/maint-rev-list-nul:
  rev-list: handle %x00 NUL in user format
2010-11-24 12:46:32 -08:00
Junio C Hamano 9cffe2018a 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
2010-11-24 12:46:26 -08:00
Junio C Hamano 78bce6c7e9 Merge branch 'jk/no-textconv-symlink' into maint
* jk/no-textconv-symlink:
  diff: don't use pathname-based diff drivers for symlinks
2010-11-24 12:46:20 -08:00
Junio C Hamano 2f9d2e22cb Merge branch 'bc/fix-cherry-pick-root' into maint
* bc/fix-cherry-pick-root:
  builtin/revert.c: don't dereference a NULL pointer
2010-11-24 12:44:46 -08:00
Junio C Hamano 71d35bdb36 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
2010-11-24 12:44:12 -08:00
Jeff King ffa1eeaeea 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>
2010-11-23 16:24:24 -08:00
Martin von Zweigbergk 729ec9e23a 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>
2010-11-23 16:23:10 -08:00
Gabriel Corona f39f72d8cf 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>
2010-11-17 13:07:43 -08:00
Gabriel Corona 3cf8fe1d26 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>
2010-11-17 13:07:43 -08:00
Jeff King b2be2f6aea 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>
2010-11-17 10:59:23 -08:00
Clemens Buchacher 172b6428d0 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>
2010-11-15 09:27:33 -08:00
Junio C Hamano 71fc224fe8 t3402: test "rebase -s<strategy> -X<opt>"
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-11 13:30:55 -08:00
Michael J Gruber 3d5854e765 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>
2010-11-10 09:40:35 -08:00
Michael J Gruber c8525c302b 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>
2010-11-10 09:39:35 -08:00
Jonathan Nieder f6ce1f2588 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>
2010-11-10 08:49:26 -08:00
Jonathan Nieder 2d502e1f37 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>
2010-11-10 08:42:40 -08:00
Nguyễn Thái Ngọc Duy ae3cdfe112 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>
2010-11-08 11:39:23 -08:00
Junio C Hamano aae1f6acf1 test: git-apply -p2 rename/chmod only
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-05 14:35:46 -07:00
Jeff King 24305cd700 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>
2010-10-29 14:13:33 -07:00
Kevin Ballard cfd1a9849c 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>
2010-10-20 16:10:15 -07:00