1
0
mirror of https://github.com/git/git.git synced 2024-10-21 03:28:41 +02:00
Commit Graph

22160 Commits

Author SHA1 Message Date
Alexey Mahotkin
c8c073c420 xdiff/xmerge.c: use memset() instead of explicit for-loop
memset() is heavily optimized, and resulting assembler code
is about 150 lines less for that file.

Signed-off-by: Alexey Mahotkin <squadette@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-01 11:11:11 -07:00
Junio C Hamano
d599e0484f Git 1.7.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.7.1
2010-04-23 18:27:17 -07:00
Junio C Hamano
34c071aea4 Merge branch 'maint'
* maint:
  Documentation improvements for the description of short format.
2010-04-23 18:24:32 -07:00
Eric Raymond
e92e9cd3c3 Documentation improvements for the description of short format.
Incorporates the detailed explanation from Jeff King in
<20100410040959.GA11977@coredump.intra.peff.net> and fixes
the bug noted by Junio C Hamano in
<7vmxxc1i8g.fsf@alter.siamese.dyndns.org>.

Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-23 12:33:41 -07:00
Junio C Hamano
08641d022d Sync with 1.7.0.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-22 23:05:49 -07:00
Junio C Hamano
66cfd1026f Git 1.7.0.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.7.0.6
2010-04-22 23:04:21 -07:00
Junio C Hamano
5deb15e47e Merge branch 'mg/use-default-abbrev-length-in-rev-list' into maint
* mg/use-default-abbrev-length-in-rev-list:
  rev-list: use default abbrev length when abbrev-commit is in effect
2010-04-22 22:39:26 -07:00
Junio C Hamano
0737975d16 Merge branch 'wp/doc-filter-direction' into maint
* wp/doc-filter-direction:
  documentation: clarify direction of core.autocrlf
2010-04-22 22:29:50 -07:00
Junio C Hamano
4fd8145c0c Merge branch 'jk/maint-diffstat-overflow' into maint
* jk/maint-diffstat-overflow:
  diff: use large integers for diffstat calculations
2010-04-22 22:29:13 -07:00
Junio C Hamano
dd0c5133c6 Merge branch 'da/maint-python-startup' into maint
* da/maint-python-startup:
  Makefile: Remove usage of deprecated Python "has_key" method
2010-04-22 22:29:07 -07:00
Junio C Hamano
3e7f1e6ccb Merge branch 'maint'
* maint:
  Documentation/Makefile: fix interrupted builds of user-manual.xml
2010-04-21 23:54:04 -07:00
Jonathan Nieder
f9dae0d3e6 Documentation/Makefile: fix interrupted builds of user-manual.xml
Unlike gcc, asciidoc does not atomically write its output file or
delete it when interrupted.  If it is interrupted in the middle of
writing an XML file, the result will be truncated input for xsltproc.

	XSLTPROC user-manual.html
	user-manual.xml:998: parser error : Premature end of data in t

Take care of this case by writing to a temporary and renaming it when
finished.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-21 23:46:51 -07:00
Charles Bailey
2ba2fe292c stash tests: stash can lose data in a file removed from the index
If a file is removed from the index and then modified in the working
tree then stash will discard the working tree file with no way to
recover the changes.

This can might be done in one of a number of ways.

git rm file
vi file              # edit a new version
git stash

or with git mv

git mv file newfile
vi file              # make a new file with the old name
git stash

Signed-off-by: Charles Bailey <charles@hashpling.org>
2010-04-20 10:03:10 -07:00
Junio C Hamano
ddd02b70f0 Merge branch 'maint'
* maint:
  t7012: Mark missing tests as TODO
  reflog: remove 'show' from 'expire's usage string
  MSVC: Fix build by adding missing termios.h dummy
2010-04-19 22:41:30 -07:00
Jay Soffian
da3efdb17b receive-pack: detect aliased updates which can occur with symrefs
When pushing to a remote repo the sending side filters out aliased
updates (e.g., foo:baz bar:baz). However, it is not possible for the
sender to know if two refs are aliased on the receiving side via
symrefs. Here is one such scenario:

  $ git init origin
  $ (cd origin && touch file && git add file && git commit -a -m intial)
  $ git clone --bare origin origin.git
  $ rm -rf origin

  $ git clone origin.git client

  $ git clone --mirror client backup.git &&
  $ (cd backup.git && git remote set-head origin --auto)

  $ (cd client &&
	git remote add --mirror backup ../backup.git &&
	echo change1 > file && git commit -a -m change1 &&
	git push origin &&
	git push backup
	)

The push to backup fails with:

  Counting objects: 5, done.
  Writing objects: 100% (3/3), 244 bytes, done.
  Total 3 (delta 0), reused 0 (delta 0)
  Unpacking objects: 100% (3/3), done.
  error: Ref refs/remotes/origin/master is at ef3... but expected 262...
  remote: error: failed to lock refs/remotes/origin/master
  To ../backup.git
     262cd57..ef307ff  master -> master
     262cd57..ef307ff  origin/HEAD -> origin/HEAD
   ! [remote rejected] origin/master -> origin/master (failed to lock)
  error: failed to push some refs to '../backup.git'

The reason is that refs/remotes/origin/HEAD is a symref to
refs/remotes/origin/master, but it is not possible for the sending side
to unambiguously know this.

This commit fixes the issue by having receive-pack ignore any update to
a symref whose target is being identically updated. If a symref and its
target are being updated inconsistently, then the update for both fails
with an error message ("refusing inconsistent update...") to help
diagnose the situation.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 22:19:07 -07:00
Jay Soffian
5e1c71fd14 receive-pack: switch global variable 'commands' to a parameter
Receive-pack is inconsistent in its usage of the 'commands'
variable; though it is setup as a global and accessed that way by
execute_commands(), report(), and run_receive_hook(), it is also
passed as a parameter to delete_only() and run_update_post_hook().

For consistency, make it local to cmd_receive_pack and pass it as a
parameter. As long as we're cleaning up, also make our use of the
names 'commands' and 'cmd' consistent.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 22:18:36 -07:00
Jonathan Nieder
97a20eea19 fix "bundle --stdin" segfault
When passed an empty list, objects_array_remove_duplicates() corrupts it
by changing the number of entries from 0 to 1.

The problem lies in the condition of its main loop:

	for (ref = 0; ref < array->nr - 1; ref++) {

The loop body manipulates the supplied object array.  In the case of an
empty array, it should not be doing anything at all.  But array->nr is an
unsigned quantity, so the code enters the loop, in particular increasing
array->nr.  Fix this by comparing (ref + 1 < array->nr) instead.

This bug can be triggered by git bundle --stdin:

	$ echo HEAD | git bundle create some.bundle --stdin’
	Segmentation fault (core dumped)

The list of commits to bundle appears to be empty because of another bug:
by the time the revision-walking machinery gets to look at it, standard
input has already been consumed by rev-list, so this function gets an
empty list of revisions.

After this patch, git bundle --stdin still does not work; it just doesn’t
segfault any more.

Reported-by: Joey Hess <joey@kitenet.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 22:16:35 -07:00
Jonathan Nieder
f62e0a39b6 t5704 (bundle): add tests for bundle --stdin
As long as no rev-list arguments are supplied on the command line,
git bundle create --stdin currently segfaults.  With added rev-list
arguments, it does not segfault, but the revisions from stdin are
ignored.

Thanks to Joey Hess <joey@kitenet.net> for the report.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 22:14:39 -07:00
Michael J Gruber
3d8167677d t7012: Mark missing tests as TODO
Currently, there are 6 tests which are not even written but are
'test_expect_failure message false'.
Do not abuse test_expect_failure as a to do marker, but mark them as
'#TODO' instead.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 18:05:00 -07:00
Tay Ray Chuan
90d0571357 http.c::new_http_pack_request: do away with the temp variable filename
Now that the temporary variable char *filename is only used in one
place, do away with it and just call sha1_pack_name() directly.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 17:57:50 -07:00
Shawn O. Pearce
750ef42516 http-fetch: Use temporary files for pack-*.idx until verified
Verify that a downloaded pack-*.idx file is consistent and valid
as an index file before we rename it into its final destination.
This prevents a corrupt index file from later being treated as a
usable file, confusing readers.

Check that we do not have the pack index file before invoking
fetch_pack_index(); that way, we can do without the has_pack_index()
check in fetch_pack_index().

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 17:56:29 -07:00
Shawn O. Pearce
fe72d420ab http-fetch: Use index-pack rather than verify-pack to check packs
To ensure we don't leave a corrupt pack file positioned as though
it were a valid pack file, run index-pack on the temporary pack
before we rename it to its final name.  If index-pack crashes out
when it discovers file corruption (e.g. GitHub's error HTML at the
end of the file), simply delete the temporary files to cleanup.

By waiting until the pack has been validated before we move it
to its final name, we eliminate a race condition where another
concurrent reader might try to access the pack at the same time
that we are still trying to verify its not corrupt.

Switching from verify-pack to index-pack is a change in behavior,
but it should turn out better for users.  The index-pack algorithm
tries to minimize disk seeks, as well as the number of times any
given object is inflated, by organizing its work along delta chains.
The verify-pack logic does not attempt to do this, thrashing the
delta base cache and the filesystem cache.

By recreating the index file locally, we also can automatically
upgrade from a v1 pack table of contents to v2.  This makes the
CRC32 data available for use during later repacks, even if the
server didn't have them on hand.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 17:56:20 -07:00
Shawn O. Pearce
7b64469a36 Allow parse_pack_index on temporary files
The easiest way to verify a pack index is to open it through the
standard parse_pack_index function, permitting the header check
to happen when the file is mapped.  However, the dumb HTTP client
needs to verify a pack index before its moved into its proper file
name within the objects/pack directory, to prevent a corrupt index
from being made available.  So permit the caller to specify the
exact path of the index file.

For now we're still using the final destination name within the
sole call site in http.c, but eventually we will start to parse
the temporary path instead.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 17:56:17 -07:00
Shawn O. Pearce
9b0aa72870 Extract verify_pack_index for reuse from verify_pack
The dumb HTTP transport should verify an index is completely valid
before trying to use it.  That requires checking the header/footer
but also checking the complete content SHA-1.  All of this logic is
already in the front half of verify_pack, so pull it out into a new
function that can be reused.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 17:56:13 -07:00
Shawn O. Pearce
fa5fc15d6e Introduce close_pack_index to permit replacement
By closing the pack index, a caller can later overwrite the index
with an updated index file, possibly after converting from v1 to
the v2 format.  Because p->index_data is NULL after close, on the
next access the index will be opened again and the other members
will be updated with new data.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 17:56:08 -07:00
Shawn O. Pearce
162eb5f838 http.c: Remove unnecessary strdup of sha1_to_hex result
Most of the time the dumb HTTP transport is run without the verbose
flag set, so we only need the result of sha1_to_hex(sha1) once, to
construct the pack URL.  Don't bother with an unnecessary malloc,
copy, free chain of this buffer.

If verbose is set, we'll format the SHA-1 twice now.  But this
tiny extra CPU time spent is nothing compared to the slowdown that
is usually imposed by the verbose messages being sent to the tty,
and is entirely trivial compared to the latency involved with the
remote HTTP server sending something as big as a pack file.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 17:55:59 -07:00
SZEDER Gábor
580b7d3605 reflog: remove 'show' from 'expire's usage string
Most of 'expire's options are not recognized by the 'show' subcommand,
hence it errors out.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 17:52:14 -07:00
Junio C Hamano
8165952517 Merge branch 'maint-1.6.6' into maint
* maint-1.6.6:
  MSVC: Fix build by adding missing termios.h dummy
2010-04-19 01:28:27 -07:00
Johannes Sixt
b75686455c MSVC: Fix build by adding missing termios.h dummy
A use of this header file was introduced in eb80042 (Add missing #include
to support TIOCGWINSZ on Solaris, 2010-01-11).

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-19 01:28:21 -07:00
Junio C Hamano
5469e2dab1 Git 1.7.1-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.7.1-rc2
2010-04-18 22:19:04 -07:00
Junio C Hamano
407a963cae Merge branch 'rr/remote-helper-doc'
* rr/remote-helper-doc:
  Documentation/remote-helpers: Fix typos and improve language
  Fixup: Second argument may be any arbitrary string
  Documentation/remote-helpers: Add invocation section
  Documentation/urls: Rewrite to accomodate <transport>::<address>
  Documentation/remote-helpers: Rewrite description
2010-04-18 21:32:25 -07:00
Junio C Hamano
c4df50c2d8 Merge branch 'wp/doc-filter-direction'
* wp/doc-filter-direction:
  documentation: clarify direction of core.autocrlf
2010-04-18 21:32:21 -07:00
Junio C Hamano
bc32d342c2 Merge branch 'jk/maint-diffstat-overflow'
* jk/maint-diffstat-overflow:
  diff: use large integers for diffstat calculations
2010-04-18 21:31:50 -07:00
Junio C Hamano
779f9467eb Merge branch 'jg/auto-initialize-notes-with-percent-n-in-format'
* jg/auto-initialize-notes-with-percent-n-in-format:
  t3301: add tests to use --format="%N"
  pretty: Initialize notes if %N is used
2010-04-18 21:31:29 -07:00
Junio C Hamano
fab45027e0 Merge branch 'maint'
* maint:
  Documentation: Describe other situations where -z affects git diff
2010-04-18 21:31:20 -07:00
Junio C Hamano
e8a1228053 Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Display dirty submodules correctly
  gitk: Fix display of copyright symbol
  gitk: Add emacs editor variable block
  gitk: Avoid calling tk_setPalette on Windows
  gitk: Don't clobber "Remember this view" setting
  gitk: Add comments to explain encode_view_opts and decode_view_opts
  gitk: Use consistent font for all text input fields
  gitk: Set the font for all listbox widgets
  gitk: Set the font for all spinbox widgets
  gitk: Remove forced use of sans-serif font
  gitk: Add Ctrl-W shortcut for closing the active window
2010-04-18 18:36:41 -07:00
Ramkumar Ramachandra
d0c26f0f56 SubmittingPatches: Add new section about what to base work on
Add a section 0 explaining which commit to base patches on.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-18 18:19:22 -07:00
Charles Bailey
7aa5d43cc6 stash: Don't overwrite files that have gone from the index
The use of git add -u in create_stash isn't always complete. In
particular, if a file has been removed from the index but changed in the
work tree it will not be added to the stash's saved work tree tree
object. When stash then resets the work tree to match HEAD, any changes
will be lost.

To be complete, any work tree file which differs from HEAD needs to be
saved, regardless of whether it still appears in the index or not.

This is achieved with a combination of a diff against HEAD and a call to
update-index with an explicit list of paths that have changed.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-18 15:00:03 -07:00
Ramkumar Ramachandra
d43427d3d9 Documentation/remote-helpers: Fix typos and improve language
Fix some typos and errors in grammar and tense.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-18 13:56:29 -07:00
Ramkumar Ramachandra
272a36b67b Fixup: Second argument may be any arbitrary string
This is intended to be a fixup for commit ad466d1 in pu. As Jonathan
Neider pointed out, the second argument may be any arbitrary string,
and need not conform to any URL-like shape.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-18 13:56:24 -07:00
Ramkumar Ramachandra
b6c8d2d663 Documentation/remote-helpers: Add invocation section
Add an 'Invocation' section to specify what the command line arguments
mean. Also include a link to git-remote in the 'See Also' section.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-18 13:56:17 -07:00
Ramkumar Ramachandra
5ce4f4e3bf Documentation/urls: Rewrite to accomodate <transport>::<address>
Rewrite the first part of the document to explicitly show differences
between the URLs that can be used with different transport
protocols. Mention <transport>::<address> format to explicitly invoke
a remote helper.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-18 13:56:05 -07:00
Ramkumar Ramachandra
00b84e9dbf Documentation/remote-helpers: Rewrite description
Rewrite the description section to describe what exactly remote
helpers are and the need for them. Also mention the curl family of
remote helpers as an example.

[jc: with readability fixes from Jonathan squashed in]

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-18 13:55:41 -07:00
Charles Bailey
03aa87ed99 Documentation: Describe other situations where -z affects git diff
-z also alters the behaviour of --name-only and --name-status.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-18 13:43:53 -07:00
Jeff King
77bc694907 rebase-interactive: silence warning when no commits rewritten
If you do a "rebase -i" and don't change any commits,
nothing is rewritten, and we have no REWRITTEN_LIST. The
shell prints out an ugly message:

  $ GIT_EDITOR=true git rebase -i HEAD^
  /path/to/git-rebase--interactive: 1: cannot open
    /path/to/repo/.git/rebase-merge/rewritten-list: No such file
  Successfully rebased and updated refs/heads/master.

We can fix it by not running "notes copy" at all if nothing
was rewritten.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-18 11:41:53 -07:00
Junio C Hamano
636db2c036 t3301: add tests to use --format="%N"
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-18 11:19:39 -07:00
Shawn O. Pearce
0da8b2e7c8 http.c: Don't store destination name in request structures
The destination name within the object store is easily computed
on demand, reusing a static buffer held by sha1_file.c.  We don't
need to copy the entire path into the request structure for safe
keeping, when it can be easily reformatted after the download has
been completed.

This reduces the size of the per-request structure, and removes
yet another PATH_MAX based limit.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-17 13:55:46 -07:00
Shawn O. Pearce
3065274c58 http.c: Drop useless != NULL test in finish_http_pack_request
The test preq->packfile != NULL is always true.  If packfile was
actually NULL when entering this function the ftell() above would
crash out with a SIGSEGV, resulting in never reaching this point.

Simplify the code by just removing the conditional.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-17 13:55:46 -07:00
Shawn O. Pearce
021ab6f00b http.c: Tiny refactoring of finish_http_pack_request
Always remove the struct packed_git from the active list, even
if the rename of the temporary file fails.

While we are here, simplify the code a bit by using a common
local variable name ("p") to hold the relevant packed_git.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-17 13:55:45 -07:00
Shawn O. Pearce
d761b2ac0e t5550-http-fetch: Use subshell for repository operations
Change into the server repository's directory using a subshell,
so we can return back to the top of the trash directory before
doing anything more in the test script.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-17 13:55:45 -07:00