1
0
mirror of https://github.com/git/git.git synced 2024-10-05 10:22:22 +02:00
Commit Graph

11806 Commits

Author SHA1 Message Date
Pierre Habouzit
917c9a7133 New strbuf APIs: splice and attach.
* strbuf_splice replace a portion of the buffer with another.
* strbuf_attach replace a strbuf buffer with the given one, that should be
  malloc'ed. Then it enforces strbuf's invariants. If alloc > len, then this
  function has negligible cost, else it will perform a realloc, possibly
  with a cost.

Also some style issues are fixed now.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-16 17:30:03 -07:00
Junio C Hamano
f3caeb9ac2 Merge branch 'maint' of git://linux-nfs.org/~bfields/git into maint
* 'maint' of git://linux-nfs.org/~bfields/git:
  core-tutorial: minor cleanup
  documentation: replace Discussion section by link to user-manual chapter
  user-manual: todo updates and cleanup
  user-manual: fix introduction to packfiles
  user-manual: move packfile and dangling object discussion
  user-manual: rewrite object database discussion
  user-manual: reorder commit, blob, tree discussion
  user-manual: rewrite index discussion
  user-manual: create new "low-level git operations" chapter
  user-manual: rename "git internals" to "git concepts"
  user-manual: move object format details to hacking-git chapter
  user-manual: adjust section levels in "git internals"
2007-09-15 23:18:05 -07:00
J. Bruce Fields
a85fecafe6 core-tutorial: minor cleanup
Revise the introduction for concision, add pointers to the tutorial and
user manual as appropriate, delete cvsimport note from the end, as that
work's been done elsewhere already.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-09-15 22:17:24 -04:00
J. Bruce Fields
40dac517ee documentation: replace Discussion section by link to user-manual chapter
The "Discussion" section has a lot of useful information, but is a
little wordy, especially for an already-long man page, and is designed
for an audience more of potential git hackers than users, which probably
doesn't make as much sense as git matures.  Also, I (perhaps foolishly)
forked a version in the user manual, which has been significantly
rewritten in an attempt to address some of the above problems.

So, remove this section and replace it by a (very terse) summary of the
original material--my attempt at the World's Shortest Git Overview--and
a reference to the appropriate chapter of the user manual.  It's
unfortunate to remove something that's been in this place for a long
time, as some people may still depend on finding it there.  But I think
we'll want to do this some day anyway.

Cc: Andreas Ericsson <ae@op5.se>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-09-15 22:17:24 -04:00
J. Bruce Fields
ecd95b536e user-manual: todo updates and cleanup
Format a couple lists.  Reminder that we may want to add submodule
documentation some day.
2007-09-15 22:17:23 -04:00
J. Bruce Fields
9644ffdd65 user-manual: fix introduction to packfiles
Actually I don't think we've previously mentioned .git/objects, so we
need a different introduction here.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-09-15 22:17:23 -04:00
J. Bruce Fields
09eff7b0f7 user-manual: move packfile and dangling object discussion
The discussions of packfiles and dangling objects both belong in the
object database section.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-09-15 22:17:23 -04:00
J. Bruce Fields
1bbf1c7900 user-manual: rewrite object database discussion
Rewrite the introduction.  Rewrite each section completely to make them
work in the new order, to add some examples, and to move plumbing
commands (like git-commit-tree) to the following chapter.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-09-15 22:17:23 -04:00
J. Bruce Fields
513d419c59 user-manual: reorder commit, blob, tree discussion
The bottom-up blog, tree, commit order makes sense unless you want to
give explicit examples--it's easier to discover objects to examine if
you go in the other order....,

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-09-15 22:17:23 -04:00
J. Bruce Fields
1c097891e4 user-manual: rewrite index discussion
Add an example using git-ls-files, standardize on the new "index"
terminology (as opposed to "cache"), attempt to clarify discussion and
make it a little shorter, avoid some unnecessary jargon ("write-back
cache").

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-09-15 22:17:23 -04:00
J. Bruce Fields
1c6045fffa user-manual: create new "low-level git operations" chapter
The low-level index operations aren't as important to regular users as
the rest of this "git concepts" chapter; so move it into a separate
chapter, and do some minor cleanup.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-09-15 22:17:05 -04:00
J. Bruce Fields
036f81997c user-manual: rename "git internals" to "git concepts"
"git internals" sounds like something only git developers must know
about, but this stuff should be of wider interest.  Rename the chapter
and give it a slightly friendlier introduction.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-09-15 22:13:31 -04:00
J. Bruce Fields
f2327c6c52 user-manual: move object format details to hacking-git chapter
Most of this is probably only of interest to git developers.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-09-15 22:13:31 -04:00
J. Bruce Fields
971aa71fc6 user-manual: adjust section levels in "git internals"
The descriptions of the various object types should all be a subsection
of the "Object Database" section.

I cribbed most of this chapter from the README (now core-intro.txt and
git(7)), because there's stuff in there people need to know and I was
too lazy to rewrite it.  The audience isn't quite right, though--the
chapter is a mixture of user- and developer- level documentation that
isn't as appropriate now as it was originally.

So, reserve this chapter for stuff users need to know, and move the
source code introduction into a new "git hacking" chapter where we'll
also move any hacker-only technical details.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-09-15 22:13:31 -04:00
Johannes Schindelin
023756f4eb revision walker: --cherry-pick is a limited operation
We used to rely on the fact that cherry-pick would trigger the code path
to set limited = 1 in handle_commit(), when an uninteresting commit was
encountered.

However, when cherry picking between two independent branches, i.e. when
there are no merge bases, and there is only linear development (which can
happen when you cvsimport a fork of a project), no uninteresting commit
will be encountered.

So set limited = 1 when --cherry-pick was asked for.

Noticed by Martin Bähr.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-15 16:34:11 -07:00
Junio C Hamano
e598c5177e git-sh-setup: typofix in comments
Noticed by Anupam Srivastava.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-15 16:33:22 -07:00
Junio C Hamano
d3392f7e86 Merge branch 'js/remote'
* js/remote:
  Teach "git remote" a mirror mode
2007-09-14 22:38:06 -07:00
Junio C Hamano
07efafef2b Merge branch 'js/tag'
* js/tag:
  verify-tag: also grok CR/LFs in the tag signature
2007-09-14 22:37:55 -07:00
Junio C Hamano
23d23385b3 Merge branch 'lh/svn-first-parent'
* lh/svn-first-parent:
  git-svn: always use --first-parent
  git-svn: add support for --first-parent
2007-09-14 22:37:43 -07:00
Junio C Hamano
d225ae59c9 Merge branch 'np/delta'
* np/delta:
  builtin-pack-objects.c: avoid bogus gcc warnings
  threaded delta search: proper locking for cache accounting
  threaded delta search: add pack.threads config variable
  fix threaded delta search locking
  threaded delta search: specify number of threads at run time
  threaded delta search: better chunck split point
  threaded delta search: refine work allocation
  basic threaded delta search
  rearrange delta search progress reporting
  localize window memory usage accounting
  straighten the list of objects to deltify
2007-09-14 22:33:28 -07:00
Junio C Hamano
e1ef867328 builtin-pack-objects.c: avoid bogus gcc warnings
These empty statement marcos can solicit bogus "statement with no effect"
warnings; squelch them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 22:30:20 -07:00
Junio C Hamano
357c5e086c Merge branch 'jc/pack'
* jc/pack:
  Keep last used delta base in the delta window
2007-09-14 18:33:45 -07:00
Junio C Hamano
eb6d54fc79 Merge branch 'dk/diff-delta'
* dk/diff-delta:
  diff-delta.c: Rationalize culling of hash buckets
  diff-delta.c: pack the index structure
2007-09-14 18:33:15 -07:00
Junio C Hamano
04222b245c Merge branch 'jc/partial-remove'
* jc/partial-remove:
  Document ls-files --with-tree=<tree-ish>
  git-commit: partial commit of paths only removed from the index
  git-commit: Allow partial commit of file removal.
2007-09-14 18:23:01 -07:00
Junio C Hamano
a7a0f3d3f8 Document ls-files --with-tree=<tree-ish>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 16:59:04 -07:00
Junio C Hamano
db33af0a7f git-commit: partial commit of paths only removed from the index
Because a partial commit is meant to be a way to ignore what are
staged in the index, "git rm --cached A && git commit A" should
just record what is in A on the filesystem.  The previous patch
made the command sequence to barf, saying that A has not been
added yet.  This fixes it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 16:53:58 -07:00
Junio C Hamano
f6336167e9 Merge branch 'jc/grep-c'
* jc/grep-c:
  Split grep arguments in a way that does not requires to add /dev/null.
  Documentation/git-config.txt: AsciiDoc tweak to avoid leading dot
  Add test to check recent fix to "git add -u"
  Documentation/git-archive.txt: a couple of clarifications.
  Fix the rename detection limit checking
  diff --no-index: do not forget to run diff_setup_done()
2007-09-14 15:17:07 -07:00
Junio C Hamano
d99ebf0817 Split grep arguments in a way that does not requires to add /dev/null.
In order to (almost) always show the name of the file without
relying on "-H" option of GNU grep, we used to add /dev/null to
the argument list unless we are doing -l or -L.  This caused
"/dev/null:0" to show up when -c is given in the output.

It is not enough to add -c to the set of options we do not pass
/dev/null for.  When we have too many files, we invoke grep
multiple times and we need to avoid giving a widow filename to
the last invocation -- otherwise we will not see the name.

This keeps two filenames when the argv[] buffer is about to
overflow and we have not finished iterating over the index, so
that the last round will always have at least two paths to work
with (and not require /dev/null).

An obvious and the only exception is when there is only 1 file
that is given to the underlying grep, and in that case we avoid
passing /dev/null and let the external "grep -c" report only the
number of matches.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 15:16:43 -07:00
Junio C Hamano
7c8b5eaf22 Documentation/git-config.txt: AsciiDoc tweak to avoid leading dot
Bram Schoenmakers noticed that git-config document was formatted
incorrectly.  Depending on the version of AsciiDoc and docbook
toolchain, it is sometimes taken as a numbered example by AsciiDoc,
some other times passed intact to roff format to confuse "man".

Since we refer to the repository metadata directory as $GIT_DIR
elsewhere, work it around by using that symbolic name.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 14:51:08 -07:00
Benoit Sigoure
43b98acc23 Add test to check recent fix to "git add -u"
An earlier commit fixed type-change case in "git add -u".
This adds a test to make sure we do not introduce regression.

At the same time, it fixes a stupid typo in the error message.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 14:30:05 -07:00
Jari Aalto
42b5f8693e Documentation/git-archive.txt: a couple of clarifications.
The description of the option gave impression that there
were several formats available by using three dots. There are
no other formats than tar and gzip currently supported.

Clarify that the archive goes to the standard output.

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 12:17:11 -07:00
Linus Torvalds
0024a54923 Fix the rename detection limit checking
This adds more proper rename detection limits. Instead of just checking
the limit against the number of potential rename destinations, we verify
that the rename matrix (which is what really matters) doesn't grow
ridiculously large, and we also make sure that we don't overflow when
doing the matrix size calculation.

This also changes the default limits from unlimited, to a rename matrix
that is limited to 100 entries on a side. You can raise it with the config
entry, or by using the "-l<n>" command line flag, but at least the default
is now a sane number that avoids spending lots of time (and memory) in
situations that likely don't merit it.

The choice of default value is of course very debatable. Limiting the
rename matrix to a 100x100 size will mean that even if you have just one
obvious rename, but you also create (or delete) 10,000 files, the rename
matrix will be so big that we disable the heuristics. Sounds reasonable to
me, but let's see if people hit this (and, perhaps more importantly,
actually *care*) in real life.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 12:12:57 -07:00
Junio C Hamano
b78281f721 diff --no-index: do not forget to run diff_setup_done()
Code inspection by Linus found this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 12:12:32 -07:00
Junio C Hamano
58f6fb53dd Merge branch 'jc/cachetree' into cr/reset
* jc/cachetree:
  Simplify cache API
  git-format-patch --in-reply-to: accept <message@id> with angle brackets
  git-add -u: do not barf on type changes
  Remove duplicate note about removing commits with git-filter-branch
  git-clone: improve error message if curl program is missing or not executable
  git.el: Allow the add and remove commands to be applied to ignored files.
  git.el: Allow selecting whether to display uptodate/unknown/ignored files.
  git.el: Keep the status buffer sorted by filename.
  hooks--update: Explicitly check for all zeros for a deleted ref.
2007-09-14 01:19:30 -07:00
Junio C Hamano
09d5dc32fb Simplify cache API
Earlier, add_file_to_index() invalidated the path in the cache-tree
but remove_file_from_cache() did not, and the user of the latter
needed to invalidate the entry himself.  This led to a few bugs due to
missed invalidate calls already.  This patch makes the management of
cache-tree less error prone by making more invalidate calls from lower
level cache API functions.

The rules are:

 - If you are going to write the index, you should either maintain
   cache_tree correctly.

   - If you cannot, alternatively you can remove the entire cache_tree
     by calling cache_tree_free() before you call write_cache().

   - When you modify the index, cache_tree_invalidate_path() should be
     called with the path you are modifying, to discard the entry from
     the cache-tree structure.

 - The following cache API functions exported from read-cache.c (and
   the macro whose names have "cache" instead of "index")
   automatically call cache_tree_invalidate_path() for you:

   - remove_file_from_index();
   - add_file_to_index();
   - add_index_entry();

   You can modify the index bypassing the above API functions
   (e.g. find an existing cache entry from the index and modify it in
   place).  You need to call cache_tree_invalidate_path() yourself in
   such a case.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 01:02:21 -07:00
Junio C Hamano
611d8139e4 Merge branch 'maint'
* maint:
  git-format-patch --in-reply-to: accept <message@id> with angle brackets
  git-add -u: do not barf on type changes
  Remove duplicate note about removing commits with git-filter-branch
  git-clone: improve error message if curl program is missing or not executable
  hooks--update: Explicitly check for all zeros for a deleted ref.
2007-09-14 00:55:32 -07:00
Junio C Hamano
8419d2ee9b git-format-patch --in-reply-to: accept <message@id> with angle brackets
This will allow RFC-literate users to say:

	format-patch --in-reply-to='<message.id@site.name>'

without forcing them to strip the surrounding angle brackets
like this:

	format-patch --in-reply-to='message.id@site.name'

We accept both forms, and the latter gets necessary < and >
around it as before.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 00:49:12 -07:00
Junio C Hamano
767c98a592 git-add -u: do not barf on type changes
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-14 00:45:29 -07:00
René Scharfe
760da9607e archive: fix subst file generation
Before the strbuf conversion, result was a char pointer.  The if
statement checked for it being not NULL, which meant that no
"$Format:...$" string had been found and no replacement had to be
made.  format_subst() returned NULL in that case -- the caller
then simply kept the original file content, as it was unaffected
by the expansion.

The length of the string being 0 is not the same as the string
being NULL (expansion to an empty string vs. no expansion at all),
so checking result.len != 0 is not a full replacement for the old
NULL check.

However, I doubt the subtle optimization explained above resulted
in a notable speed-up anyway.  Simplify the code and add the tail
of the file to the expanded string unconditionally.

[jc: added a test to expose the breakage this fixes]

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-13 23:20:47 -07:00
Ulrik Sverdrup
f5de79956b Remove duplicate note about removing commits with git-filter-branch
A duplicate of an already existing section in the documentation of
git-filter-branch was added in commit
f95eef15f2f8a336b9a42749f5458c841a5a5d63.
This patch removes that redundant section.

Signed-off-by: Ulrik Sverdrup <ulrik.sverdrup@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-13 22:53:53 -07:00
Gerrit Pape
f28dd4774d git-clone: improve error message if curl program is missing or not executable
If the curl program is not available (or not executable), and git clone is
started to clone a repository through http, this is the output

 Initialized empty Git repository in /tmp/puppet/.git/
 /usr/bin/git-clone: line 37: curl: command not found
 Cannot get remote repository information.
 Perhaps git-update-server-info needs to be run there?

This patch improves the error message by checking the return code when
running curl to exit immediately if it's 126 or 127; the error output now
is

 Initialized empty Git repository in /tmp/puppet/.git/
 /usr/bin/git-clone: line 37: curl: command not found

Adrian Bridgett noticed this and reported through
 http://bugs.debian.org/440976

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-13 22:39:22 -07:00
Alexandre Julliard
568d2cde9b git.el: Allow the add and remove commands to be applied to ignored files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-13 22:37:54 -07:00
Alexandre Julliard
98acc3fabc git.el: Allow selecting whether to display uptodate/unknown/ignored files.
The default behavior for each state can be customized, and it can also
be toggled directly from the status buffer.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-13 22:37:54 -07:00
Alexandre Julliard
1b655040be git.el: Keep the status buffer sorted by filename.
This makes insertions and updates much more efficient.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-13 22:36:22 -07:00
Alexandre Julliard
c32da692de hooks--update: Explicitly check for all zeros for a deleted ref.
The previous check caused the hook to reject as unannotated any tag
whose SHA1 starts with a zero.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-13 22:33:11 -07:00
Junio C Hamano
cbb390cd8f An additional test for "git-reset -- path"
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-13 20:54:14 -07:00
Shawn O. Pearce
55bad4f096 git-gui: Paper bag fix "Commit->Revert" format arguments
The recent bug fix to correctly handle filenames with %s (or any
other valid Tcl format specifier) missed a \ on this line and
caused the remaining format arguments to not be supplied when we
updated the status bar.  This caused a Tcl error anytime the user
was trying to perform a file revert.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-13 20:08:53 -04:00
Shawn O. Pearce
042f53c569 git-gui: Provide 'uninstall' Makefile target to undo an installation
Several users have requested a "make uninstall" target be provided
in the stock git-gui Makefile so that they can undo an install
if git-gui goes to the wrong place during the initial install,
or if they are unhappy with the tool and want to remove it from
their system.

We currently assume that the complete set of files we need to delete
are those defined by our Makefile and current source directory.
This could differ from what the user actually has installed if they
installed one version then attempt to use another to perform the
uninstall.  Right now I'm just going to say that is "pilot error".
Users should uninstall git-gui using the same version of source
that they used to make the installation.  Perhaps in the future we
could read tclIndex and base our uninstall decisions on its contents.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-13 20:02:39 -04:00
Shawn O. Pearce
afe2098ddd git-gui: Font chooser to handle a large number of font families
Simon Sasburg noticed that on X11 if there are more fonts than can
fit in the height of the screen Tk's native tk_optionMenu does not
offer scroll arrows to the user and it is not possible to review
all choices or to select those that are off-screen.  On Mac OS X
the tk_optionMenu works properly but is awkward to navigate if the
list is long.

This is a rewrite of our font selection by providing a new modal
dialog that the user can launch from the git-gui Options panel.
The dialog offers the user a scrolling list of fonts in a pane.
An example text shows the user what the font looks like at the size
they have selected.  But I have to admit the example pane is less
than ideal.  For example in the case of our diff font we really
should show the user an example diff complete with our native diff
syntax coloring.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Acked-by: Simon Sasburg <simon.sasburg@gmail.com>
2007-09-13 19:07:46 -04:00
Shawn O. Pearce
e7034d66ec git-gui: Make backporting changes from i18n version easier
This is a very trivial hack to define a global mc procedure that
does not actually perform i18n translations on its input strings.
By declaring an mc procedure here in our maint version of git-gui
we can take patches that are intended for the latest development
version of git-gui and easily backport them without needing to
tweak the mc calls first.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-13 19:04:14 -04:00