Commit graph

8742 commits

Author SHA1 Message Date
Junio C Hamano 4e4b55dd0f Merge branch 'maint'
* maint:
  git-apply: do not fix whitespaces on context lines.
  diff --cc: integer overflow given a 2GB-or-larger file
  mailinfo: do not get confused with logical lines that are too long.
2007-02-27 01:33:52 -08:00
Junio C Hamano 63e50d492c git-apply: do not fix whitespaces on context lines.
Internal function apply_line() is called to copy both context lines
and added lines to the output buffer, while possibly fixing the
whitespace breakages depending on --whitespace=strip settings.
However, it did its fix-up on both context lines and added lines.

This resulted in two symptoms:

 (1) The number of lines reported to have been fixed up included
     these context lines.

 (2) However, the lines actually shown were limited to the added
     lines that had whitespace breakages.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 01:33:14 -08:00
Jim Meyering ee24ee55c2 diff --cc: integer overflow given a 2GB-or-larger file
Few of us use git to compare or even version-control 2GB files,
but when we do, we'll want it to work.

Reading a recent patch, I noticed two lines like this:

   int len = st.st_size;

Instead of "int", that should be "size_t".  Otherwise, in the
non-symlink case, with 64-bit size_t, if the file's size is 2GB,
the following xmalloc will fail:

   result = xmalloc(len + 1);

trying to allocate 2^64 - 2^31 + 1 bytes (assuming sign-extension
in the int-to-size_t promotion).  And even if it didn't fail, the
subsequent "result[len] = 0;" would be equivalent to an unpleasant
"result[-2147483648] = 0;"

The other nearby "int"-declared size variable, sz, should also be of
type size_t, for the same reason.  If sz ever wraps around and becomes
negative, xread will corrupt memory _before_ the "result" buffer.

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 01:03:37 -08:00
Linus Torvalds 34fc5cefa7 mailinfo: do not get confused with logical lines that are too long.
It basically considers all the continuation lines to be lines of their
own, and if the total line is bigger than what we can fit in it, we just
truncate the result rather than stop in the middle and then get confused
when we try to parse the "next" line (which is just the remainder of the
first line).

[jc: added test, and tightened boundary a bit per list discussion.]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 01:02:32 -08:00
Junio C Hamano c260d790c8 Documentation: link in 1.5.0.2 material to the top documentation page.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-26 01:16:01 -08:00
Aneesh Kumar K.V 047f636d90 Documentation: document remote.<name>.tagopt
Update config.txt with info regarding tagopt option

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-26 00:32:48 -08:00
Junio C Hamano 8807d321af Merge branch 'maint'
* maint:
  GIT 1.5.0.2
  git-remote: support remotes with a dot in the name
  Documentation: describe "-f/-t/-m" options to "git-remote add"
  diff --cc: fix display of symlink conflicts during a merge.
2007-02-26 00:32:19 -08:00
Junio C Hamano 0d9b9ab128 GIT 1.5.0.2
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-26 00:26:06 -08:00
Pavel Roskin 4e5104c1fc git-remote: support remotes with a dot in the name
[jc: the original from Pavel was limiting the variable names to only
 fetch and url, but I loosened it to take valid variable names.]
[jc: cherry-picked from 'master', since people seem to be reinventing
 this many times.]

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-26 00:24:41 -08:00
Junio C Hamano c5ddca1fff Documentation: describe "-f/-t/-m" options to "git-remote add"
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 23:50:29 -08:00
Junio C Hamano 4fc970c438 diff --cc: fix display of symlink conflicts during a merge.
"git-diff-files --cc" to show conflicts during merge did not pass
the correct mode information for the working tree down, and showed
bogus combined diff.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 22:25:30 -08:00
Junio C Hamano 5569dad48e Merge branch 'maint'
* maint:
  merge-recursive: fix longstanding bug in merging symlinks
  merge-index: fix longstanding bug in merging symlinks
2007-02-25 19:10:13 -08:00
Junio C Hamano 0b1f647557 Merge branch 'jc/merge-symlink' into maint
* jc/merge-symlink:
  merge-recursive: fix longstanding bug in merging symlinks
  merge-index: fix longstanding bug in merging symlinks
2007-02-25 19:09:59 -08:00
Junio C Hamano 17cd29b25c merge-recursive: fix longstanding bug in merging symlinks
Commit 3af244ca added unlink(2) before running symlink(2) to
update the working tree with the merge result, but it was
unlinking a wrong path.  This resulted in loss of the path
pointed by a symlink.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 19:08:48 -08:00
Junio C Hamano 308efc10d8 merge-index: fix longstanding bug in merging symlinks
Ancient commit e2b6a9d0 added code to pass "file modes" from
merge-index to merge-one-file, and then later commit 54dd99a1
wanted to make sure we do not end up creating a nonsense symlink
that points at a path whose name contains conflict markers.

However, nobody noticed that the code in merge-index added by
e2b6a9d0 were stripping the S_IFMT bits and the code in 54dd99a1
was meaningless.  This fixes it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 19:08:48 -08:00
Junio C Hamano 6c09c45138 diff --cached: give more sensible error message when HEAD is yet to be created.
It is not like the user said 'diff --cached HEAD', so complaining about
HEAD not being a valid commit, while technically might be correct, is
not very helpful.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 11:09:56 -08:00
Eric Wong 56cf9806a9 Update tests to use test-chmtime
test-lib:
  Make sure test-chmtime has been built before starting.

t4200-rerere:
  Removed non-portable date dependency and avoid touch
  Avoid "test -a" which isn't portable, either

lib-git-svn:
  Use test-chmtime instead of Perl one-liner to poke

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 11:09:56 -08:00
Eric Wong 17e4836875 Add test-chmtime: a utility to change mtime on files
This is intended to be a portable replacement for our usage
of date(1), touch(1), and Perl one-liners in tests.

Usage: test-chtime (+|=|-|=+|=-)<seconds> <file>..."

  '+' increments the mtime on the files by <seconds>
  '-' decrements the mtime on the files by <seconds>
  '=' sets the mtime on the file to exactly <seconds>
  '=+' and '=-' sets the mtime on the file to <seconds> after or
      before the current time.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 11:09:56 -08:00
Junio C Hamano 2c7ca1fcf1 Merge branch 'maint'
* maint:
  Add Release Notes to prepare for 1.5.0.2
  Allow arbitrary number of arguments to git-pack-objects
  rerere: do not deal with symlinks.
  rerere: do not skip two conflicted paths next to each other.
  Don't modify CREDITS-FILE if it hasn't changed.
2007-02-25 11:08:47 -08:00
Junio C Hamano d2dc6222d4 Add Release Notes to prepare for 1.5.0.2
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 10:53:42 -08:00
Roland Dreier ffa84ffb77 Allow arbitrary number of arguments to git-pack-objects
If a repository ever gets in a situation where there are too many
packs (more than 60 or so), perhaps because of frequent use of
git-fetch -k or incremental git-repack, then it becomes impossible to
fully repack the repository with git-repack -a.  That command just
dies with the cryptic message

    fatal: too many internal rev-list options

This message comes from git-pack-objects, which is passed one command
line option like --unpacked=pack-<SHA1>.pack for each pack file to be
repacked.  However, the current code has a static limit of 64 command
line arguments and just aborts if more arguments are passed to it.

Fix this by dynamically allocating the array of command line
arguments, and doubling the size each time it overflows.

Signed-off-by: Roland Dreier <roland@digitalvampire.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 10:50:12 -08:00
Junio C Hamano 1289172749 rerere: do not deal with symlinks.
Who would use multi-line symlinks that would benefit from rerere?
Just ignore them.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 01:29:43 -08:00
Junio C Hamano ab242f809a rerere: do not skip two conflicted paths next to each other.
The code forgot to take the for (;;) loop control into account,
incrementing the index once too many.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 01:28:44 -08:00
Junio C Hamano cef19c7af5 Merge git://repo.or.cz/git-gui into maint
* git://repo.or.cz/git-gui:
  Don't modify CREDITS-FILE if it hasn't changed.
2007-02-24 23:33:12 -08:00
Junio C Hamano 92446aba47 Don't modify CREDITS-FILE if it hasn't changed.
We should always avoid rewriting a built file during `make install`
if nothing has changed since `make all`.  This is to help support
the typical installation process of compiling a package as yourself,
then installing it as root.

Forcing CREDITS-FILE to be always be rebuilt in the Makefile means
that CREDITS-GEN needs to check for a change and only update
CREDITS-FILE if the file content actually differs.  After all,
content is king in Git.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-25 02:18:26 -05:00
Junio C Hamano 7bd59dee5b Merge branch 'js/apply'
* js/apply:
  apply: make --verbose a little more useful
2007-02-24 02:00:32 -08:00
Junio C Hamano 503ca3a9f2 Merge branch 'js/no-limit-boundary'
* js/no-limit-boundary:
  rev-list --max-age, --max-count: support --boundary
2007-02-24 01:47:56 -08:00
Junio C Hamano cc58fc0684 Merge branch 'js/etc-config'
* js/etc-config:
  Make tests independent of global config files
  config: read system-wide defaults from /etc/gitconfig
2007-02-24 01:43:28 -08:00
Junio C Hamano 8a13becc0d Merge branch 'maint'
* maint:
  diff-patch: Avoid emitting double-slashes in textual patch.
  Reword git-am 3-way fallback failure message.
  Limit filename for format-patch
  core.legacyheaders: Use the description used in RelNotes-1.5.0
  git-show-ref --verify: Fail if called without a reference

Conflicts:

	builtin-show-ref.c
	diff.c
2007-02-24 01:42:06 -08:00
Junio C Hamano 5089277718 diff-patch: Avoid emitting double-slashes in textual patch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24 01:26:52 -08:00
Junio C Hamano b1440cc806 Reword git-am 3-way fallback failure message.
When the blobs recorded on the index lines in the patch as pre-image
blobs are not found in the repository, "git-am" punted saying
that the index line does not record anything useful.  This was not
clear enough -- the index line does have something useful but the
problem was that it was not useful in _that_ repository.

Reword the message as Francis Moreau suggests.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24 01:06:19 -08:00
Robin Rosenberg c06d2daa12 Limit filename for format-patch
Badly formatted commits may have very long comments. This causes
git-format-patch to fail. To avoid that, truncate the filename
to a value we believe will always work.

Err out if the patch file cannot be created.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24 00:55:56 -08:00
Santi Béjar bdd69c2f64 core.legacyheaders: Use the description used in RelNotes-1.5.0
It explains what it does and why, and says how to use the new format.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24 00:25:05 -08:00
Dmitry V. Levin 8ab40a2005 git-show-ref --verify: Fail if called without a reference
builtin-show-ref.c (cmd_show_ref): Fail if called with --verify option but
without a reference.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24 00:17:38 -08:00
Junio C Hamano 509b4d73b2 .mailmap maintenance after pulling from git-svn
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-23 03:11:52 -08:00
Eric Wong 2e5e24803f git-svn: fix some potential bugs with --follow-parent
When using do_switch:

  We only need to ensure the index is clean and set to that of the
  parent tree) we rely on being able to reconstruct full files
  with deltas transferred over the network.

When using do_update:

  We may safely unlink the index if we are fetching an entire
  new tree with do_update.  Having an old index (from a
  previously deleted/abandoned directory) around can cause
  irrelevant files to be mistakenly kept.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 02:21:59 -08:00
Eric Wong e2c475d91c git-svn: fix reconnections to different paths of svn:// repositories
Clearing the pool of the previous SVN::Ra connection we have
seems to to fix mysterious connection dropping errors when
reconnecting to different paths of svn:// repositories hosted by
rubyforge.org.

Note: I'm not sure *why* this fixes things things,
but it does for me.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 01:59:34 -08:00
Eric Wong f30603fcf3 git-svn: fix clone when a target directory has been specified
Several bugs caused this to fail:

* GIT_DIR was set incorrectly after entering the target directory

* Avoid double chdir-ing when clone is called with an explicit path

* create target subdirectory *before* running git-init when using
  the multi-init path

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 01:26:26 -08:00
Sam Vilain a0d7fe3fcd git-svn: document --username
Also, it turns out that SVN::Ra doesn't attempt to deal with
authentication or pass the username to ssh when doing svn+ssh://
URLs

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 01:01:02 -08:00
Sam Vilain 18ea92bd81 git-svn: don't consider SVN URL usernames significant when comparing
http://foo@blah.com/path is the same as http://blah.com/path, so
remove usernames from URLs before storing them in commits, and when
reading them from commits.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 01:01:02 -08:00
Eric Wong 5253dc33b7 git-svn: ensure we're at the top-level and can access $GIT_DIR
If we are run inside a subdirectory of a working tree, we'll
chdir to the top first before touching anything.  This also
prevents the accidental creation of .git directories inside
subdirectories since they need metadata.

Noticed by maio on #git

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 1a97a50604 git-svn: give show-ignore HEAD smarts, like dcommit and log
This allows the user to run git-svn show-ignore on there
current HEAD without needing to remember which branch/ref they
branched from with -i.  Also, find_by_url should correctly
handle cases where the URL passed to it is not valid.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 0dfaf0a4e1 git-svn: allow metadata options to be specified with 'init' and 'clone'
Since the options that affect the way metadata is handled in
git-svn, should be consistently set/unset throughout history
imported by git-svn; it makes sense to allow the user to set
certain options from the command-line that will write to the
config file when initially creating the repository.

Also, fix some formatting issues while we're updating
documentation.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong a81ed0b63e git-svn: documentation updates
This documents the 'clone' and 'rebase' commands
of git-svn.   Additionaly, examples are updated
to use them instead of the lower-level 'init' and
'fetch' commands.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong e2b36f6018 git-svn: add test for useSvnsyncProps
These tests are very similar as the ones I used for useSvmProps
and expect the same results because both dumps were generated
from the same original repo.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong befc9adc0c git-svn: fix useSvmProps, hopefully for the last time
svm:mirror is not useful at all for us.  Parts of the old unit
test were broken and based on my misunderstanding of the
svm:mirror property.

When we read svm:source; make sure we correctly handle the '!'
in it: it is used to separate the path of the repository root
from the virtual path within the repository.  We don't need
to make that distinction, honestly!

We also ensure that subdirectories are also mirrored with the
correct URL if we're using useSvmProps.

We have a new test that uses dumped repo that was really
created using SVN::Mirror to avoid ambiguities and
mis-understandings about the svm: properties.

Note: trailing whitespace in the svm.dump file is unfortunately
a reality and required by SVN; so please ignore it when applying
this patch.

Also, ensure that the -R/--remote/--svn-remote flag is always
in effect if explicitly passed via the command-line.  This
allows us to track logically different mirrors sharing the
same URL (probably common with SVN::Mirror/SVK users).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 62e349d235 git-svn: add support for using svnsync properties
This is similar to useSvmProps, but far simpler in
implementation because svnsync retains a 1:1
between revision numbers and relative paths within
the repository

Config keys: svn.useSvnsyncProps
             svn-remote.<repo>.useSvnsyncProps

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong aea736cc6d git-svn: allow overriding of the SVN repo root in metadata
This feature allows users to create repositories from alternate
URLs.  For example, an administrator could run git-svn on the
server locally (accessing via file://) but wish to distribute
the repository with a public http:// or svn:// URL in the
metadata so users of it will see the public URL.

Config key: svn-remote.<remote>.rewriteRoot

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong 0425ea9088 git-svn: add 'clone' command, an alias for init + fetch
Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00
Eric Wong b7e5348c7f git-svn: hide the private git-svn 'config' file as '.metadata'
Having it named as 'config' prevents us from tracking a
ref named 'config', which is a huge mistake.

On the non-technical side, the word 'config' implies that
a user can freely modify it; but that's not the case
here.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-02-23 00:57:13 -08:00