1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-02 15:28:21 +01:00
Commit graph

4407 commits

Author SHA1 Message Date
Junio C Hamano
3a3e89b897 Merge branch 'fix'
* fix:
  Fix git-pack-objects for 64-bit platforms
2006-05-13 22:24:18 -07:00
Dennis Stosberg
66561f5a77 Fix git-pack-objects for 64-bit platforms
The offset of an object in the pack is recorded as a 4-byte integer
in the index file.  When reading the offset from the mmap'ed index
in prepare_pack_revindex(), the address is dereferenced as a long*.
This works fine as long as the long type is four bytes wide.  On
NetBSD/sparc64, however, a long is 8 bytes wide and so dereferencing
the offset produces garbage.

[jc: taking suggestion by Linus to use uint32_t]

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-13 10:43:16 -07:00
Nicolas Pitre
639ca54972 fix diff-delta bad memory access
It cannot be assumed that the given buffer will never be moved when
shrinking the allocated memory size with realloc().  So let's ignore
that optimization for now.

This patch makes Electric Fence happy on Linux.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Acked-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-10 10:53:59 -07:00
Junio C Hamano
f7a3276bab Merge branch 'fix'
* fix:
  checkout: use --aggressive when running a 3-way merge (-m).
  revert/cherry-pick: use aggressive merge.
2006-05-09 19:24:16 -07:00
Junio C Hamano
8d7a397aab checkout: use --aggressive when running a 3-way merge (-m).
After doing an in-index 3-way merge, we always do the stock
"merge-index merge-one-file" without doing anything fancy;
use of --aggressive helps performance quite a bit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-09 19:23:23 -07:00
Linus Torvalds
d1802851b0 revert/cherry-pick: use aggressive merge.
After doing an in-index 3-way merge, we always do the stock
"merge-index merge-one-file" without doing anything fancy;
use of --aggressive helps performance quite a bit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-09 19:22:25 -07:00
Junio C Hamano
8c2462dc5b Merge branch 'jc/clean'
* jc/clean:
  Teach git-clean optional <paths>... parameters.
2006-05-09 16:52:54 -07:00
Junio C Hamano
2c49009dbe Merge branch 'mw/alternates'
* mw/alternates:
  clone: don't clone the info/alternates file
  test case for transitive info/alternates
  Transitively read alternatives
2006-05-09 16:45:45 -07:00
Junio C Hamano
b9895c0688 Merge branch 'jc/xsha1'
* jc/xsha1:
  get_sha1() - fix infinite loop on nonexistent stage.
  get_sha1(): :path and :[0-3]:path to extract from index.
2006-05-09 16:44:59 -07:00
Junio C Hamano
143f4d94c6 Merge branch 'jc/again'
* jc/again:
  Fix users of prefix_path() to free() only when necessary
  update-index --again: take optional pathspecs
  update-index --again
2006-05-09 16:40:53 -07:00
Junio C Hamano
4edd44725c Merge branch 'np/delta'
* np/delta:
  improve diff-delta with sparse and/or repetitive data
  tiny optimization to diff-delta
  replace adler32 with Rabin's polynomial in diff-delta
  use delta index data when finding best delta matches
  split the diff-delta interface
2006-05-09 16:40:28 -07:00
Junio C Hamano
2fc240a7b2 Merge branch 'jc/bindiff'
* jc/bindiff:
  improve base85 generated assembly code
  binary diff and apply: testsuite.
  binary diff: further updates.
  binary patch.
2006-05-09 14:16:56 -07:00
Junio C Hamano
016cd9f665 Merge branch 'fix'
* fix:
  read-cache.c: use xcalloc() not calloc()
  apply: fix infinite loop with multiple patches with --index
2006-05-09 13:54:42 -07:00
Yakov Lerner
28cc4ab422 read-cache.c: use xcalloc() not calloc()
Elsewhere we use xcalloc(); we should consistently do so.

Signed-off-by: Yakov Lerner <iler.ml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-09 06:28:59 -07:00
Eric Wong
dbd0f7d322 apply: fix infinite loop with multiple patches with --index
When multiple patches are passed to git-apply, it will attempt
to open multiple file descriptors to an index, which means
multiple entries will be in the circular cache_file_list.

This change makes git-apply only open the index once and
write the index at exit.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-09 01:29:38 -07:00
Junio C Hamano
393e3b1910 Teach git-clean optional <paths>... parameters.
When optional paths arguments are given, git-clean passes them
to underlying git-ls-files; with this, you can say:

	git clean 'temp-*'

to clean only the garbage files whose names begin with 'temp-'.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Pavel Roskin <proski@gnu.org>
2006-05-08 16:40:45 -07:00
Junio C Hamano
45f75a0167 Merge branch 'fix'
* fix:
  Separate object name errors from usage errors
  Documentation: {caret} fixes (git-rev-list.txt)
  Fix "git diff --stat" with long filenames
  Fix repo-config set-multivar error return path.
2006-05-08 16:40:23 -07:00
Dmitry V. Levin
31fff305bc Separate object name errors from usage errors
Separate object name errors from usage errors.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-08 16:25:33 -07:00
Junio C Hamano
e7cef45fbc get_sha1() - fix infinite loop on nonexistent stage.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-08 15:44:06 -07:00
Junio C Hamano
afb4ff2069 Documentation: {caret} fixes (git-rev-list.txt)
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-08 13:46:53 -07:00
Nicolas Pitre
addaacab07 improve base85 generated assembly code
This code is arguably pretty hot, if you use binary patches of course.
This patch helps gcc generate both smaller and faster code especially in
the error free path.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-08 11:05:01 -07:00
Linus Torvalds
5d6a9f45e1 Fix "git diff --stat" with long filenames
When we cut off the front of a filename to make it fit on the line, we add
a "..." in front. However, the way the "git diff" code was written, we
will never reset the prefix back to the empty string, so every single
filename afterwards will have the "..." prefix, whether appropriate or
not.

You can see this with "git diff v2.6.16.." on the current kernel tree,
since there are filenames with long names that changed there:

 [ snip snip ]
 Documentation/filesystems/vfs.txt                  |  229
 .../firmware_class/firmware_sample_driver.c        |    3
 .../firmware_sample_firmware_class.c               |    1
 ...Documentation/fujitsu/frv/kernel-ABI.txt           |  192
 ...Documentation/hwmon/w83627hf                       |    4
 [ snip snip ]

notice how the two Documentation/firmware** filenames caused the "..." to
be added, but then the later filenames don't want it, and it also screws
up the alignment of the line numbering afterwards.

Trivially fixed by moving the declaration (and initial setting) of the
"prefix" variable into the for-loop where it is used.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-08 10:54:30 -07:00
Junio C Hamano
f8ba655ee4 Fix repo-config set-multivar error return path.
This hopefully fixes the problem an earlier commit 5d8ee9ceb attemted
to fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-07 21:27:30 -07:00
Martin Waitz
0438402271 clone: don't clone the info/alternates file
Now that the cloned alternates file is parsed, too we don't need to
copy it into our new repository, we just reference it.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-07 15:41:35 -07:00
Martin Waitz
dd05ea1799 test case for transitive info/alternates
Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-07 15:41:35 -07:00
Martin Waitz
c2f493a4ae Transitively read alternatives
When adding an alternate object store then add entries from its
info/alternates files, too.
Relative entries are only allowed in the current repository.
Loops and duplicate alternates through multiple repositories are ignored.
Just to be sure that nothing breaks it is not allow to build deep
nesting levels using info/alternates.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-07 15:41:35 -07:00
Junio C Hamano
fd60acaced Merge branch 'fix'
* fix:
  repack: honor -d even when no new pack was created
  clone: keep --reference even with -l -s
  repo-config: document what value_regexp does a bit more clearly.
  Release config lock if the regex is invalid
  core-tutorial.txt: escape asterisk
2006-05-07 15:36:39 -07:00
Peter Hagervall
d92f1dc63f Sparse fix for builtin-diff
You gotta love sparse:

builtin-diff.c:88:4: error: Just how const do you want this type to be?

Signed-off-by: Peter Hagervall <hager@cs.umu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-07 15:36:10 -07:00
Martin Waitz
178613c737 repack: honor -d even when no new pack was created
If all objects are reachable via an alternate object store then we
still have to remove all obsolete local packs.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-07 15:35:50 -07:00
Martin Waitz
cf9dc65368 clone: keep --reference even with -l -s
Both -l -s and --reference update objects/info/alternates and used
to write over each other.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-07 15:33:43 -07:00
Junio C Hamano
6fe31e2e4c repo-config: document what value_regexp does a bit more clearly.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-07 15:32:51 -07:00
Pavel Roskin
5d8ee9ceb8 Release config lock if the regex is invalid
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-07 15:31:06 -07:00
Matthias Lederhofer
245f1029d6 core-tutorial.txt: escape asterisk
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-07 13:55:36 -07:00
Johannes Schindelin
0cc9e70c4c Fix users of prefix_path() to free() only when necessary
Unfortunately, prefix_path() sometimes returns a newly xmalloc()ed buffer,
and in other cases it returns a substring!

For example, when calling

	git update-index ./hello.txt

prefix_path() returns "hello.txt", but does not allocate a new buffer. The
original code only checked if the result of prefix_path() was different from
what was passed in, and thusly trigger a segmentation fault.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-06 21:36:24 -07:00
Johannes Schindelin
be65e7d9fb Fix users of prefix_path() to free() only when necessary
Unfortunately, prefix_path() sometimes returns a newly xmalloc()ed buffer,
and in other cases it returns a substring!

For example, when calling

	git update-index ./hello.txt

prefix_path() returns "hello.txt", but does not allocate a new buffer. The
original code only checked if the result of prefix_path() was different from
what was passed in, and thusly trigger a segmentation fault.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-06 21:34:32 -07:00
sean
bd886fd3ea t1300-repo-config: two new config parsing tests.
- correctly insert a new variable into a section that only
  contains a single (different) variable.

- correctly insert a new section that matches the initial
  substring of an existing section.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-06 14:03:13 -07:00
sean
6f81bf16a9 Another config file parsing fix.
If the variable we need to store should go into a section
that currently only has a single variable (not matching
the one we're trying to insert), we will already be into
the next section before we notice we've bypassed the correct
location to insert the variable.

To handle this case we store the current location as soon
as we find a variable matching the section of our new
variable.

This breakage was brought up by Linus.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-06 14:03:09 -07:00
Junio C Hamano
42d0ee8302 binary diff and apply: testsuite.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-06 00:15:54 -07:00
Junio C Hamano
22293b9c41 update-index --again: take optional pathspecs
When pathspecs are given, update-index --again further limits
the set of paths to be updated to those that match them.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 23:11:29 -07:00
Junio C Hamano
83e77a25dc update-index --again
After running 'git-update-index' for some paths, you may want to
do the update on the same set of paths again.

The new flag --again checks the paths whose index entries are
are different from the HEAD commit and updates them from the
working tree contents.

This was brought up by Carl Worth on #git.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 22:57:27 -07:00
Junio C Hamano
fb69a760cc update-index: plug memory leak from prefix_path()
prefix_path() sometimes allocates new memory and returns it, and
other times returns the incoming path argument intact.  The
callers need to be a bit careful not to leak memory.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 22:53:56 -07:00
Junio C Hamano
dc46da2286 checkout-index: plug memory leak from prefix_path()
prefix_path() sometimes allocates new memory and returns it, and
other times returns the incoming path argument intact.  The
callers need to be a bit careful not to leak memory.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 22:40:45 -07:00
Junio C Hamano
09895c1fa0 update-index --unresolve: work from a subdirectory.
It completely forgot to take the prefix into account, so you
had to feed the full path even when you start from a
subdirectory, which was nonsensical.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 17:50:06 -07:00
Junio C Hamano
0660626caf binary diff: further updates.
This updates the user interface and generated diff data format.

 * "diff --binary" is used to signal that we want an e-mailable
   binary patch.  It implies --full-index and -p.

 * "apply --allow-binary-replacement" acquired a short synonym
   "apply --binary".

 * After the "GIT binary patch\n" header line there is a token
   to record which binary patch mechanism was used, so that we
   can extend it later.  Currently there are two mechanisms
   defined: "literal" and "delta".  The former records the
   deflated postimage and the latter records the deflated delta
   from the preimage to postimage.

   For purely implementation convenience, I added the deflated
   length after these "literal/delta" tokens (otherwise the
   decoding side needs to guess and reallocate the buffer while
   inflating).  Improvement patches are very welcomed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 15:24:32 -07:00
Junio C Hamano
051308f6e9 binary patch.
This adds "binary patch" to the diff output and teaches apply
what to do with them.

On the diff generation side, traditionally, we said "Binary
files differ\n" without giving anything other than the preimage
and postimage object name on the index line.  This was good
enough for applying a patch generated from your own repository
(very useful while rebasing), because the postimage would be
available in such a case.  However, this was not useful when the
recipient of such a patch via e-mail were to apply it, even if
the preimage was available.

This patch allows the diff to generate "binary" patch when
operating under --full-index option.  The binary patch follows
the usual extended git diff headers, and looks like this:

	"GIT binary patch\n"
	<length byte><data>"\n"
	...
	"\n"

Each line is prefixed with a "length-byte", whose value is upper
or lowercase alphabet that encodes number of bytes that the data
on the line decodes to (1..52 -- 'A' means 1, 'B' means 2, ...,
'Z' means 26, 'a' means 27, ...).  <data> is 1 or more groups of
5-byte sequence, each of which encodes up to 4 bytes in base85
encoding.  Because 52 / 4 * 5 = 65 and we have the length byte,
an output line is capped to 66 characters.  The payload is the
same diff-delta as we use in the packfiles.

On the consumption side, git-apply now can decode and apply the
binary patch when --allow-binary-replacement is given, the diff
was generated with --full-index, and the receiving repository
has the preimage blob, which is the same condition as it always
required when accepting an "Binary files differ\n" patch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 15:24:32 -07:00
Junio C Hamano
86118bcb46 pack-object: squelch eye-candy on non-tty
One of my post-update scripts runs a git-fetch into a separate
repository and sends the results back to me (2>&1); I end up
getting this in the mail:

    Generating pack...
    Done counting 180 objects.
    Result has 131 objects.
    Deltifying 131 objects.
       0% (0/131) done^M   1% (2/131) done^M...

This defaults not to do the progress report when not on a tty.

You could give --progress to force the progress report, but
let's not bother even documenting it nor mentioning it in the
usage string.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 15:24:12 -07:00
Junio C Hamano
188a634fec Merge branch 'fix'
* fix:
  core.prefersymlinkrefs: use symlinks for .git/HEAD
  repo-config: trim white-space before comment
  Fix for config file section parsing.
2006-05-05 14:49:49 -07:00
Junio C Hamano
e388c73825 core.prefersymlinkrefs: use symlinks for .git/HEAD
When inspecting a project whose build infrastructure used to
assume that .git/HEAD is a symlink ref, core.prefersymlinkrefs
in the config file of such a project would help to bisect its
history.

Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from 9f0bb90d16 commit)
2006-05-05 14:37:08 -07:00
Johannes Schindelin
7ebdba6142 repo-config: trim white-space before comment
Earlier, calling

	git-repo-config core.hello

on a .git/config like this:

	[core]
		hello = world ; a comment

would yield "world " (i.e. with a trailing space).

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from c1aee1fd8d commit)
2006-05-05 14:34:47 -07:00
sean
93ddef3e2d Fix for config file section parsing.
Currently, if the target key has a section that matches
the initial substring of another section we mistakenly
believe we've found the correct section.  To avoid this
problem, ensure that the section lengths are identical
before comparison.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-05 14:33:58 -07:00