1
0
mirror of https://github.com/git/git.git synced 2024-10-03 19:51:31 +02:00
Commit Graph

12255 Commits

Author SHA1 Message Date
Junio C Hamano
5e389c430d Merge branch 'jc/stash-create'
* jc/stash-create:
  git-stash: Fix listing stashes
  git-merge: no reason to use cpio anymore
  Revert "rebase: allow starting from a dirty tree."
  rebase: allow starting from a dirty tree.
  stash: implement "stash create"
2007-11-14 14:05:47 -08:00
Junio C Hamano
55571f7861 Merge branch 'bg/format-patch-N'
* bg/format-patch-N:
  Rearrange git-format-patch synopsis to improve clarity.
  format-patch: Test --[no-]numbered and format.numbered
  format-patch: Add configuration and off switch for --numbered
2007-11-14 14:04:25 -08:00
Junio C Hamano
03edb0a753 Merge branch 'np/progress'
* np/progress:
  nicer display of thin pack completion
  make display of total transferred fully accurate
  remove dead code from the csum-file interface
  git-fetch: be even quieter.
  make display of total transferred more accurate
  sideband.c: ESC is spelled '\033' not '\e' for portability.
  fix display overlap between remote and local progress
2007-11-14 14:04:19 -08:00
Junio C Hamano
dcb83ec18d Merge branch 'js/rebase-detached'
* js/rebase-detached:
  rebase: fix "rebase --continue" breakage
  rebase: operate on a detached HEAD
2007-11-14 14:04:06 -08:00
Junio C Hamano
37ec2b4c26 Merge branch 'rs/pretty'
* rs/pretty:
  Fix preprocessor logic that determines the availablity of strchrnul().
  Simplify strchrnul() compat code
  --format=pretty: avoid calculating expensive expansions twice
  add strbuf_adddup()
  --pretty=format: parse commit message only once
  --pretty=format: on-demand format expansion
  Add strchrnul()
2007-11-14 14:03:50 -08:00
Junio C Hamano
4356736571 Merge branch 'rr/cvsexportcommit-w'
* rr/cvsexportcommit-w:
  cvsexportcommit: Add switch to specify CVS workdir
2007-11-14 14:03:40 -08:00
Junio C Hamano
e318f60723 Merge branch 'gh/cvsimport-user'
* gh/cvsimport-user:
  git-cvsimport: fix handling of user name when it is not set in CVSROOT
2007-11-14 14:03:27 -08:00
Sergei Organov
93cbbd7121 user-manual: minor rewording for clarity.
Junio screwed up when applying the previous round of the patch;
rewording from "previous" to "old" does make the description
clearer.

Also revert the rewording from head to branch.  The description
is talking about the branch's tip commit and using the word head
is clearer.

Based on input from Sergei and Bruce.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 12:08:15 -08:00
Junio C Hamano
fb5fd01148 Merge branch 'maint'
* maint:
  git-clean: honor core.excludesfile
  Documentation: Fix man page breakage with DocBook XSL v1.72
  git-remote.txt: fix typo
  core-tutorial.txt: Fix argument mistake in an example.
  replace reference to git-rm with git-reset in git-commit doc
  Grammar fixes for gitattributes documentation
  Don't allow fast-import tree delta chains to exceed maximum depth
  revert/cherry-pick: allow starting from dirty work tree.
  t/t3404: fix test for a bogus todo file.

Conflicts:

	fast-import.c
2007-11-14 03:37:18 -08:00
Alex Riesen
481424e1f1 Fix dependencies of parse-options test program
A stale test-parse-options can break t0040 otherwise.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 02:05:19 -08:00
Sergei Organov
2f29dac5a9 user-manual.txt: fix a few mistakes
Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 02:04:46 -08:00
Junio C Hamano
b57321f57b git-clean: honor core.excludesfile
git-clean did not honor core.excludesfile configuration
variable, although some other commands such as git-add and
git-status did.  Fix this inconsistency.

Original report and patch from Shun'ichi Fuji.  Rewritten by me
and bugs and tests are mine.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 02:03:29 -08:00
Jonas Fonseca
7f55cf451c Documentation: Fix man page breakage with DocBook XSL v1.72
From version 1.72 it will replace all dots in roff requests with U+2302
("house" character), and add escaping in output for all instances of dot
that are not in roff requests. This caused the ".ft" hack forcing
monospace font in listingblocks to end up as "\&.ft" and being visible
in the resulting man page.

The fix adds a DOCBOOK_XSL_172 build variable that will disable the
hack. To allow this variable to be defined in config.mak it also moves
build variable handling below the inclusion of config.mak.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 02:01:54 -08:00
Shawn O. Pearce
f141bd804d Handle broken vsnprintf implementations in strbuf
Solaris 9's vsnprintf implementation returns -1 if we pass it a
buffer of length 0.  The only way to get it to give us the actual
length necessary for the formatted string is to grow the buffer
out to have at least 1 byte available in the strbuf and then ask
it to compute the length.

If the available space is 0 I'm growing it out by 64 to ensure
we will get an accurate length estimate from all implementations.
Some callers may need to grow the strbuf again but 64 should be a
reasonable enough initial growth.

We also no longer silently fail to append to the string when we are
faced with a broken vsnprintf implementation.  On Solaris 9 this
silent failure caused me to no longer be able to execute "git clone"
as we tried to exec the empty string rather than "git-clone".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 02:00:13 -08:00
Sergei Organov
cb5c49b9af git-remote.txt: fix typo
Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 01:59:22 -08:00
Sergei Organov
065c5ac168 core-tutorial.txt: Fix argument mistake in an example.
One of examples has wrong output given the arguments provided.
Fix arguments to match the output.

Fix a minor syntax mistake in another place.

Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 01:59:12 -08:00
Jing Xue
97e9a2216f replace reference to git-rm with git-reset in git-commit doc
The message in git-commit suggesting to use 'git rm --cached'
to unstage is just plain wrong. It really should mention 'git reset'.

Suggested by Jan Hudec.

Signed-off-by: Jing Xue <jingxue@digizenstudio.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 01:58:03 -08:00
Wincent Colaiuta
c05ef93879 Grammar fixes for gitattributes documentation
Tweak the "filter" section of the gitattributes documentation to add
some
missing articles and improve some word choices without changing the
semantics of the section.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 01:56:32 -08:00
Shawn O. Pearce
436e7a74c6 Don't allow fast-import tree delta chains to exceed maximum depth
Brian Downing noticed fast-import can produce tree depths of up
to 6,035 objects and even deeper.  Long delta chains can create
very small packfiles but cause problems during repacking as git
needs to unpack each tree to count the reachable blobs.

What's happening here is the active branch cache isn't big enough.
We're swapping out the branch and thus recycling the tree information
(struct tree_content) back into the free pool.  When we later reload
the tree we set the delta_depth to 0 but we kept the tree we just
reloaded as a delta base.

So if the tree we reloaded was already at the maximum depth we
wouldn't know it and make the new tree a delta.  Multiply the
number of times the branch cache has to swap out the tree times
max_depth (10) and you get the maximum delta depth of a tree created
by fast-import.  In Brian's case above the active branch cache had
to swap the branch out 603/604 times during this import to produce
a tree with a delta depth of 6035.

Acked-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-13 21:57:53 -08:00
Junio C Hamano
71aa2b8f0e Resurrect git-revert.sh example and add comment to builtin-revert.c
I had to scratch my head for quite some time figuring out why we
cannot optimize out write_tree() we do when --no-commit option
is given, whose purpose seem to be only to check if the index is
unmerged, with a simple loop over the active_cache[].

So add a comment to describe why the write_tree() is there, and
resurrect the last scripted version as a reference material in
contrib/example directory with others.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-13 13:45:11 -08:00
Junio C Hamano
245de36f03 revert/cherry-pick: allow starting from dirty work tree.
There is no reason to forbid a dirty work tree when reverting or
cherry-picking a change, as long as the index is clean.

The scripted version used to allow it:

    case "$no_commit" in
    t)
    	# We do not intend to commit immediately.  We just want to
    	# merge the differences in.
    	head=$(git-write-tree) ||
    		die "Your index file is unmerged."
    	;;
    *)
    	head=$(git-rev-parse --verify HEAD) ||
    		die "You do not have a valid HEAD"
    	files=$(git-diff-index --cached --name-only $head) || exit
    	if [ "$files" ]; then
    		die "Dirty index: cannot $me (dirty: $files)"
    	fi
    	;;
    esac

but C rewrite tightened the check, probably by mistake.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-13 13:25:51 -08:00
Junio C Hamano
aac5bf0b48 t/t3404: fix test for a bogus todo file.
The test wants to see if there are still remaining tasks, but checked
a wrong file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-13 13:25:23 -08:00
Johannes Sixt
726c8ef5a5 Fix preprocessor logic that determines the availablity of strchrnul().
Apart from the error in the condition (&& should actually be ||), the
construct

    #if !defined(A) || !A

leads to a syntax error in the C preprocessor if A is indeed not defined.

Tested-by: David Symonds <dsymonds@gmail.com>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-12 18:16:34 -08:00
Johannes Sixt
f192c5d0fb git-clean: Fix error message if clean.requireForce is not set.
It was distracting to see this error message:

     clean.requireForce set and -n or -f not given; refusing to clean

even though clean.requireForce was not set at all. This patch distinguishes
the cases and gives a different message depending on whether the
configuration variable is not set or set to true.

While we are here, we also divert the error messages to stderr.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-12 17:49:49 -08:00
Johannes Schindelin
3f735b6654 rebase: fix "rebase --continue" breakage
The --skip case was handled properly when rebasing without --merge,
but the --continue case was not.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-12 16:23:09 -08:00
Eric Wong
cfbe7ab333 git-svn: support for funky branch and project names over HTTP(S)
SVN requires that paths be URI-escaped for HTTP(S) repositories.
file:// and svn:// repositories do not need these rules.

Additionally, accessing individual paths inside repositories
(check_path() and get_log() do NOT require escapes to function
and in fact it breaks things).

Noticed-by: Michael J. Cohen <mjc@cruiseplanners.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-12 00:22:49 -08:00
Jonas Fonseca
a4e57e75c9 Documentation: Fix references to deprecated commands
... by changing git-tar-tree reference to git-archive and removing
seemingly unrelevant footnote about git-ssh-{fetch,upload}.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-12 00:18:44 -08:00
Junio C Hamano
35865ca245 Merge branch 'maint'
* maint:
  for-each-ref: fix off by one read.
  git-branch: remove mention of non-existent '-b' option
  git-svn: prevent dcommitting if the index is dirty.
  Fix memory leak in traverse_commit_list
2007-11-12 00:14:15 -08:00
Junio C Hamano
9b2a182124 Merge branch 'sp/maint-plug-traverse-commit-list-leak' into maint
* sp/maint-plug-traverse-commit-list-leak:
  Fix memory leak in traverse_commit_list
2007-11-12 00:00:00 -08:00
Christian Couder
a74fa1106d for-each-ref: fix off by one read.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 23:40:33 -08:00
Jeff King
53e780c8f6 git-branch: remove mention of non-existent '-b' option
This looks like a cut and paste error from the git-checkout
explanation of --no-track.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 23:40:32 -08:00
Benoit Sigoure
c8cfa3e4a5 git-svn: prevent dcommitting if the index is dirty.
dcommit uses rebase to sync the history with what has just been pushed to
SVN.  Trying to dcommit with a dirty index is troublesome for rebase, so now
the user will get an error message if he attempts to dcommit with a dirty
index.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 23:40:32 -08:00
Junio C Hamano
40e2524da9 Merge branch 'js/upload-pack'
* js/upload-pack:
  upload-pack: Use finish_{command,async}() instead of waitpid().
2007-11-11 15:19:57 -08:00
Junio C Hamano
52b9b48a2c Merge branch 'js/reset'
* js/reset:
  builtin-reset: avoid forking "update-index --refresh"
  builtin-reset: do not call "ls-files --unmerged"
2007-11-11 15:19:24 -08:00
Junio C Hamano
91febfba6f Merge branch 'js/parseopt-abbrev-fix'
* js/parseopt-abbrev-fix:
  parse-options: abbreviation engine fix.
2007-11-11 15:12:06 -08:00
Junio C Hamano
82527cf33e Merge branch 'maint'
* maint:
  fix index-pack with packs >4GB containing deltas on 32-bit machines
  git-hash-object should honor config variables
  gitweb: correct month in date display for atom feeds
2007-11-11 15:00:05 -08:00
Steffen Prohaska
1b2486d737 push: teach push to pass --verbose option to transport layer
A --verbose option to push should also be passed to the
transport layer, i.e. git-send-pack, git-http-push.

git push is modified to do so.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 14:37:03 -08:00
Steffen Prohaska
05ee917a6e push: mention --verbose option in documentation
Before this commit, only '-v' was documented.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 14:37:03 -08:00
Andreas Ericsson
9e79f00f06 Simplify strchrnul() compat code
strchrnul() was introduced in glibc in April 1999 and included in
glibc-2.1. Checking for that version means the majority of all git
users would get to use the optimized version in glibc. Of the
remaining few some might get to use a slightly slower version
than necessary but probably not slower than what we have today.

Unfortunately, __GLIBC_PREREQ() macro was not available in glibc 2.1.1
which was short lived but already supported strchrnul().  Odd minority
users of that library needs to live with our compatibility inline version.

Rediffed-against-next-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 12:10:35 -08:00
Nicolas Pitre
a91ef6e75b fix index-pack with packs >4GB containing deltas on 32-bit machines
This probably hasn't been properly tested before.  Here's a script to
create a 8GB repo with the necessary characteristics (copy the
test-genrandom executable from the Git build tree to /tmp first):

-----
#!/bin/bash

git init
git config core.compression 0

# create big objects with no deltas
for i in $(seq -w 1 2 63)
do
	echo $i
	/tmp/test-genrandom $i 268435456 > file_$i
	git add file_$i
	rm file_$i
	echo "file_$i -delta" >> .gitattributes
done

# create "deltifiable" objects in between big objects
for i in $(seq -w 2 2 64)
do
	echo "$i $i $i" >> grow
	cp grow file_$i
	git add file_$i
	rm file_$i
done
rm grow

# create a pack with them
git commit -q -m "commit of big objects interlaced with small deltas"
git repack -a -d
-----

Then clone this repo over the Git protocol.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 02:57:13 -08:00
Nicolas Pitre
ff350ccf49 git-hash-object should honor config variables
... such as core.compression.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 02:51:53 -08:00
René Scharfe
b9c6232138 --format=pretty: avoid calculating expensive expansions twice
As Jeff King remarked, format strings with duplicate placeholders can
be slow to expand, because each instance is calculated anew.

This patch makes use of the fact that format_commit_message() and its
helper functions only ever add stuff to the end of the strbuf.  For
certain expensive placeholders, store the offset and length of their
expansion with the strbuf at the first occurrence.  Later they
expansion result can simply be copied from there -- no malloc() or
strdup() required.

These certain placeholders are the abbreviated commit, tree and
parent hashes, as the search for a unique abbreviated hash is quite
costly.  Here are the times for next (best of three runs):

$ time git log --pretty=format:%h >/dev/null

real    0m0.611s
user    0m0.404s
sys     0m0.204s

$ time git log --pretty=format:%h%h%h%h >/dev/null

real    0m1.206s
user    0m0.744s
sys     0m0.452s

And here those with this patch (and the previous two); the speedup
of the single placeholder case is just noise:

$ time git log --pretty=format:%h >/dev/null

real    0m0.608s
user    0m0.416s
sys     0m0.192s

$ time git log --pretty=format:%h%h%h%h >/dev/null

real    0m0.639s
user    0m0.488s
sys     0m0.140s

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 02:04:46 -08:00
René Scharfe
91db267ec8 add strbuf_adddup()
Add a new function, strbuf_adddup(), that appends a duplicate of a
part of a struct strbuf to end of the latter.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 02:04:46 -08:00
René Scharfe
f29d59586c --pretty=format: parse commit message only once
As Jeff King pointed out, some placeholder expansions are related to
each other: the steps to calculate one go most of the way towards
calculating the other, too.

This patch makes format_commit_message() parse the commit message
only once, remembering the position of each item.  This speeds up
handling of format strings containing multiple placeholders from the
set %s, %a*, %c*, %e, %b.

Here are the timings for the git version in next.  The first one is
to estimate the overhead of the caching, the second one is taken
from http://svn.tue.mpg.de/tentakel/trunk/tentakel/Makefile as an
example of a format string found in the wild.  The times are the
fastest of three consecutive runs in each case:

$ time git log --pretty=format:%e >/dev/null

real    0m0.381s
user    0m0.340s
sys     0m0.024s

$ time git log --pretty=format:"* %cd %cn%n%n%s%n%b" >/dev/null

real    0m0.623s
user    0m0.556s
sys     0m0.052s

And here the times with this patch:

$ time git log --pretty=format:%e >/dev/null

real    0m0.385s
user    0m0.332s
sys     0m0.040s

$ time git log --pretty=format:"* %cd %cn%n%n%s%n%b" >/dev/null

real    0m0.563s
user    0m0.504s
sys     0m0.048s

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-11 02:04:46 -08:00
Vincent Zanotti
a62d6d84c6 gitweb: correct month in date display for atom feeds
Signed-off-by: Vincent Zanotti <vincent.zanotti@m4x.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-10 12:47:16 -08:00
Michele Ballabio
570f322669 test-lib.sh: move error line after error() declaration
This patch removes a spurious "command not found" error
and actually makes the "Test script did not set test_description."
string follow the command line option "--no-color".

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-10 11:04:56 -08:00
Lars Hjemli
c899a57c28 for-each-ref: fix setup of option-parsing for --sort
The option value for --sort is already a pointer to a pointer to struct
ref_sort, so just use it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-10 11:04:24 -08:00
Junio C Hamano
a130976b71 Merge branch 'maint'
* maint:
  print warning/error/fatal messages in one shot
2007-11-10 02:06:30 -08:00
Sergei Organov
2782c9355a core-tutorial.txt: Fix git-show-branch example and its description
Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-10 02:01:12 -08:00
Shawn O. Pearce
295dd2ad20 Fix memory leak in traverse_commit_list
If we were listing objects too then the objects were buffered in an
array only reachable from a stack allocated structure.  When this
function returns that array would be leaked as nobody would have
a reference to it anymore.

Historically this hasn't been a problem as the primary user of
traverse_commit_list() (the noble git-rev-list) would terminate
as soon as the function was finished, thus allowing the operating
system to cleanup memory.  However we have been leaking this data
in git-pack-objects ever since that program learned how to run the
revision listing internally, rather than relying on reading object
names from git-rev-list.

To better facilitate reuse of traverse_commit_list during other
builtin tools (such as git-fetch) we shouldn't leak temporary memory
like this and instead we need to clean up properly after ourselves.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-10 01:52:54 -08:00