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

11702 commits

Author SHA1 Message Date
Pierre Habouzit
7a604f16b7 Simplify strbuf uses in archive-tar.c using strbuf API
This is just cleaner way to deal with strbufs, using its API rather than
reinventing it in the module (e.g. strbuf_append_string is just the plain
strbuf_addstr function, and it was used to perform what strbuf_addch does
anyways).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 23:57:44 -07:00
Pierre Habouzit
b449f4cfc9 Rework strbuf API and semantics.
The gory details are explained in strbuf.h. The change of semantics this
patch enforces is that the embeded buffer has always a '\0' character after
its last byte, to always make it a C-string. The offs-by-one changes are all
related to that very change.

  A strbuf can be used to store byte arrays, or as an extended string
library. The `buf' member can be passed to any C legacy string function,
because strbuf operations always ensure there is a terminating \0 at the end
of the buffer, not accounted in the `len' field of the structure.

  A strbuf can be used to generate a string/buffer whose final size is not
really known, and then "strbuf_detach" can be used to get the built buffer,
and keep the wrapping "strbuf" structure usable for further work again.

  Other interesting feature: strbuf_grow(sb, size) ensure that there is
enough allocated space in `sb' to put `size' new octets of data in the
buffer. It helps avoiding reallocating data for nothing when the problem the
strbuf helps to solve has a known typical size.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 23:57:44 -07:00
Lars Hjemli
4dbfe2e9bd git-svn: always use --first-parent
This makes git-svn unconditionally invoke git-log with --first-parent when
it is trying to discover its upstream subversion branch and collecting the
commit ids which should be pushed to it with dcommit. The reason for always
using --first-parent is to make git-svn behave in a predictable way when the
ancestry chain contains merges with other git-svn branches.

Since git-svn now always uses 'git-log --first-parent' there is no longer
any need for the --first-parent option to git-svn, so this is removed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 22:53:16 -07:00
René Scharfe
38c9c9b798 archive: rename attribute specfile to export-subst
As suggested by Junio and Johannes, change the name of the former
attribute specfile to export-subst to indicate its function rather
than purpose and to make clear that it is not applied to working tree
files.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 22:51:41 -07:00
René Scharfe
df4a394f91 archive: specfile syntax change: "$Format:%PLCHLDR$" instead of just "%PLCHLDR" (take 2)
As suggested by Johannes, --pretty=format: placeholders in specfiles
need to be wrapped in $Format:...$ now.  This syntax change restricts
the expansion of placeholders and makes it easier to use with files
that contain non-placeholder percent signs.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 22:51:31 -07:00
René Scharfe
b21b9f1de3 add memmem()
memmem() is a nice GNU extension for searching a length limited string
in another one.

This compat version is based on the version found in glibc 2.2 (GPL 2);
I only removed the optimization of checking the first char by hand, and
generally tried to keep the code simple.  We can add it back if memcmp
shows up high in a profile, but for now I prefer to keep it (almost
trivially) simple.

Since I don't really know which platforms beside those with a glibc
have their own memmem(), I used a heuristic: if NO_STRCASESTR is set,
then NO_MEMMEM is set, too.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 22:46:00 -07:00
Junio C Hamano
d4bb43ee27 Invoke "git gc --auto" from commit, merge, am and rebase.
The point of auto gc is to pack new objects created in loose
format, so a good rule of thumb is where we do update-ref after
creating a new commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 00:08:56 -07:00
Junio C Hamano
2c3c439947 Implement git gc --auto
This implements a new option "git gc --auto".  When gc.auto is
set to a positive value, and the object database has accumulated
roughly that many number of loose objects, this runs a
lightweight version of "git gc".  The primary difference from
the full "git gc" is that it does not pass "-a" option to "git
repack", which means we do not try to repack _everything_, but
only repack incrementally.  We still do "git prune-packed".  The
default threshold is arbitrarily set by yours truly to:

 - not trigger it for fully unpacked git v0.99 history;

 - do trigger it for fully unpacked git v1.0.0 history;

 - not trigger it for incremental update to git v1.0.0 starting
   from fully packed git v0.99 history.

This patch does not add invocation of the "auto repacking".  It
is left to key Porcelain commands that could produce tons of
loose objects to add a call to "git gc --auto" after they are
done their work.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 00:08:56 -07:00
Junio C Hamano
b5ef6ac978 Merge branch 'master' of git://repo.or.cz/git/git-p4
* 'master' of git://repo.or.cz/git/git-p4:
  git-p4: Added support for automatically importing newly appearing perforce branches.
  git-p4: Cleanup; moved the (duplicated) code for turning a branch into a git ref (for example foo -> refs/remotes/p4/<project>/foo) into a separate method.
  git-p4: Cleanup; moved the code for the initial #head or revision import into a separate function, out of P4Sync.run.
  git-p4: Cleanup; Turn self.revision into a function local variable (it's not used anywhere outside the function).
  git-p4: Cleanup; moved the code to import a list of p4 changes using fast-import into a separate member function of P4Sync.
  git-p4: Cleanup; moved the code for getting a sorted list of p4 changes for a list of given depot paths into a standalone method.
  git-p4: After submission to p4 always synchronize from p4 again (into refs/remotes). Whether to rebase HEAD or not is still left as question to the end-user.
  git-p4: Always call 'p4 sync ...' before submitting to Perforce.
2007-09-06 00:05:49 -07:00
Nicolas Pitre
8ecce684a3 basic threaded delta search
this is still rough, hence it is disabled by default.  You need to compile
with "make THREADED_DELTA_SEARCH=1 ..." at the moment.

Threading is done on different portions of the object list to be
deltified. This is currently done by spliting the list into n parts and
then a thread is spawned for each of them.  A better method would consist
of spliting the list into more smaller parts and have the n threads
pick the next part available.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 00:01:45 -07:00
Nicolas Pitre
e334977dfa rearrange delta search progress reporting
This is to help threadification of the delta search code, with a bonus
consistency check.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 00:01:44 -07:00
Nicolas Pitre
ef0316fcd9 localize window memory usage accounting
This is to help threadification of delta searching.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 23:49:28 -07:00
Nicolas Pitre
75d3985319 straighten the list of objects to deltify
Not all objects are subject to deltification, so avoid carrying those
along, and provide the real count to progress display.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 23:49:10 -07:00
Junio C Hamano
7e2e69b7f6 Merge branch 'maint'
* maint:
  Include a git-push example for creating a remote branch
  Cleanup unnecessary file modifications in t1400-update-ref
  Makefile: Add cache-tree.h to the headers list
  Don't allow contrib/workdir/git-new-workdir to trash existing dirs
  git-apply: do not read past the end of buffer
2007-09-05 23:37:02 -07:00
Shawn O. Pearce
4e560158c6 Include a git-push example for creating a remote branch
Many users get confused when `git push origin master:foo` works
when foo already exists on the remote repository but are confused
when foo doesn't exist as a branch and this form does not create
the branch foo.

This new example highlights the trick of including refs/heads/
in front of the desired branch name to create a branch.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 23:25:09 -07:00
Shawn O. Pearce
432e93a164 Cleanup unnecessary file modifications in t1400-update-ref
Kristian Høgsberg pointed out that the two file modifications
we were doing during the 'creating initial files' step are not even
used within the test suite.  This was actually confusing as we do
not even need these changes for the tests to pass.  All that really
matters here is the specific commit dates are used so that these
appear in the branch's reflog, and that the dates are different so
that the branch will update when asked and the reflog entry is
also updated.  There is no need for the file modification.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 23:17:04 -07:00
Dmitry V. Levin
6b1b40d9f4 Makefile: Add cache-tree.h to the headers list
The dependency was missing.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 23:08:22 -07:00
Shawn O. Pearce
ea09ea22d6 Don't allow contrib/workdir/git-new-workdir to trash existing dirs
Recently I found that doing a sequence like the following:

  git-new-workdir a b
  ...
  git-new-workdir a b

by accident will cause a (and now also b) to have an infinite cycle
in its refs directory.  This is caused by git-new-workdir trying
to create the "refs" symlink over again, only during the second
time it is being created within a's refs directory and is now also
pointing back at a's refs.

This causes confusion in git as suddenly branches are named things
like "refs/refs/refs/refs/refs/refs/refs/heads/foo" instead of the
more commonly accepted "refs/heads/foo".  Plenty of commands start
to see ambiguous ref names and others just take ages to compute.

git-clone has the same safety check, so git-new-workdir should
behave just like it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 22:24:54 -07:00
Junio C Hamano
6b763c424e git-apply: do not read past the end of buffer
When the preimage we are patching is shorter than what the patch
text expects, we tried to match the buffer contents at the
"original" line with the fragment in full, without checking we
have enough data to match in the preimage.  This caused the size
of a later memmove() to wrap around and attempt to scribble
almost the entire address space.  Not good.

The code that follows the part this patch touches tries to match
the fragment with line offsets.  Curiously, that code does not
have the problem --- it guards against reading past the end of
the preimage.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 21:58:40 -07:00
Lars Hjemli
05b4df3153 git-svn: add support for --first-parent
When git-svn uses git-log to find embedded 'git-svn-id'-lines in commit
messages, it can get confused when local history contains merges with
other git-svn branches. But if --first-parent is supplied to git-log,
working_head_info() will only see 'branch-local' commits and thus the
first commit containing a 'git-svn-id' line should refer to the correct
subversion branch.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 15:24:16 -07:00
Junio C Hamano
ad00a3b8f8 Merge branch 'ds/sendmail'
* ds/sendmail:
  send-email: Add support for SSL and SMTP-AUTH
2007-09-05 15:23:36 -07:00
Carlos Rica
3d9f037c60 Function for updating refs.
A function intended to be called from builtins updating refs
by locking them before write, specially those that came from
scripts using "git update-ref".

[jc: with minor fixups]

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-05 11:29:33 -07:00
Shawn O. Pearce
047d94d505 git-gui: Properly set the state of "Stage/Unstage Hunk" action
Today I found yet another way for the "Stage Hunk" and "Unstage
Hunk" context menu actions to leave the wrong state enabled in
the UI.  The problem this time was that I connected the state
determination to the value of $::current_diff_side (the side the
diff is from).  When the user was last looking at a diff from the
index side and unstages everything the diff panel goes empty, but
the action stayed enabled as we always assumed unstaging was a
valid action.

This change moves the logic for determining when the action is
enabled away from the individual side selection, as they really
are two unrelated concepts.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-03 23:03:52 -04:00
Shawn O. Pearce
881d8f24ca git-gui: Fix detaching current branch during checkout
If the user tried to detach their HEAD while keeping the working
directory on the same commit we actually did not completely do
a detach operation internally.  The problem was caused by git-gui
not forcing the HEAD symbolic ref to be updated to a SHA-1 hash
when we were not switching revisions.  Now we update the HEAD ref
if we aren't currently detached or the hashes don't match.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-03 23:01:44 -04:00
Shawn O. Pearce
6e4ba05c7f git-gui: Correct starting of git-remote to handle -w option
Current versions of git-remote apparently are passing the -w option
to Perl as part of the shbang line:

  #!/usr/bin/perl -w

this caused a problem in git-gui and gave the user a Tcl error with
the message: "git-remote not supported: #!/usr/bin/perl -w".

The fix for this is to treat the shbang line as a Tcl list and look
at the first element only for guessing the executable name.  Once
we know the executable name we use the remaining elements (if any
exist) as arguments to the executable, before the script filename.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-03 23:01:44 -04:00
René Scharfe
89b4256cfb Remove unused function convert_sha1_file()
convert_sha1_file() became unused by the previous patch -- remove it.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-03 16:46:23 -07:00
René Scharfe
8460b2fcd4 archive: specfile support (--pretty=format: in archive files)
Add support for a new attribute, specfile.  Files marked as being
specfiles are expanded by git-archive when they are written to an
archive.  It has no effect on worktree files.  The same placeholders
as those for the option --pretty=format: of git-log et al. can be
used.

The attribute is useful for creating auto-updating specfiles.  It is
limited by the underlying function format_commit_message(), though.
E.g. currently there is no placeholder for git-describe like output,
and expanded specfiles can't contain NUL bytes.  That can be fixed
in format_commit_message() later and will then benefit users of
git-log, too.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-03 16:46:16 -07:00
Ren,bi(B Scharfe
7b95089c0f Export format_commit_message()
Drop the parameter "msg" of format_commit_message() (as it can be
inferred from the parameter "commit"), add a parameter "template"
in order to avoid accessing the static variable user_format
directly and export the result.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-03 16:46:02 -07:00
Johannes Schindelin
fec60a261d verify-tag: also grok CR/LFs in the tag signature
On some people's favorite platform, gpg outputs signatures
with CR/LF line endings.  So verify-tag has to play nice with
them.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-03 16:44:35 -07:00
Simon Hausmann
1ca3d71069 git-p4: Added support for automatically importing newly appearing perforce branches.
If a change in a p4 "branch" appears that hasn't seen any previous commit and
that has a known branch mapping we now try to import it properly. First we
find the p4 change of the source branch that the new p4 branch is based on. Then
we using git rev-list --bisect to locate the corresponding git commit to that change.
Finally we import all changes in the new p4 branch up to the current change and resume
with the regular import.

Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:39 +02:00
Simon Hausmann
8134f69c21 git-p4: Cleanup; moved the (duplicated) code for turning a branch into a git ref (for example foo -> refs/remotes/p4/<project>/foo) into a separate method.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:37 +02:00
Simon Hausmann
c208a24310 git-p4: Cleanup; moved the code for the initial #head or revision import into a separate function, out of P4Sync.run.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:25 +02:00
Simon Hausmann
1c49fc197b git-p4: Cleanup; Turn self.revision into a function local variable (it's not used anywhere outside the function).
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:35:13 +02:00
Simon Hausmann
e87f37ae42 git-p4: Cleanup; moved the code to import a list of p4 changes using fast-import into a separate member function of P4Sync.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:34:56 +02:00
Simon Hausmann
4f6432d8cc git-p4: Cleanup; moved the code for getting a sorted list of p4 changes for a list of given depot paths into a standalone method.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:34:32 +02:00
Simon Hausmann
14594f4b57 git-p4: After submission to p4 always synchronize from p4 again (into refs/remotes). Whether to rebase HEAD or not is still left as question to the end-user.
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03 20:27:02 +02:00
Simon Hausmann
31f9ec129e git-p4: Always call 'p4 sync ...' before submitting to Perforce.
Acked-by: Marius Storm-Olsen <marius@trolltech.com>
Acked-by: Thiago Macieira <thiago@kde.org>
2007-09-03 20:27:02 +02:00
Johannes Schindelin
3894439022 Teach "git remote" a mirror mode
When using the "--mirror" option to "git remote add", the refs will not
be stored in the refs/remotes/ namespace, but in the same location as
on the remote side.

This option probably only makes sense in a bare repository.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-03 03:08:12 -07:00
Douglas Stockwell
34cc60ce2b send-email: Add support for SSL and SMTP-AUTH
Allows username and password to be given using --smtp-user
and --smtp-pass. SSL use is flagged by --smtp-ssl. These are
backed by corresponding defaults in the git configuration file.

This implements Junio's 'mail identity' suggestion in a slightly
more generalised manner. --identity=$identity, backed by
sendemail.identity indicates that the configuration subsection
[sendemail "$identity"] should take priority over the [sendemail]
section for all configuration values.

Signed-off-by: Douglas Stockwell <doug@11011.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-03 02:40:48 -07:00
Junio C Hamano
1e61b7640d Start 1.5.4 cycle
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-03 02:40:06 -07:00
Junio C Hamano
5587cac28b GIT 1.5.3.1: obsolete git-p4 in RPM spec file.
HPA noticed that yum does not like the newer git RPM set; it turns out
that we do not ship git-p4 anymore but existing installations do not
realize the package is gone if we do not tell anything about it.

David Kastrup suggests using Obsoletes in the spec file of the new
RPM to replace the old package, so here is a try.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-03 01:28:37 -07:00
Junio C Hamano
030e0e5fb7 Typofix: 1.5.3 release notes 2007-09-02 15:03:26 -07:00
Junio C Hamano
86bab9615c GIT 1.5.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-02 00:00:00 -07:00
Junio C Hamano
776398709d Keep last used delta base in the delta window
This is based on Martin Koegler's idea to keep the object that
was successfully used as the base of the delta when it is about
to fall off the edge of the window.  Instead of doing so only
for the objects at the edge of the window, this makes the window
a lru eviction mechanism.  If an entry is used as a base, it is
moved to the last of the queue to be evicted.

This is a quick-and-dirty implementation, as it keeps the original
implementation of the data structure used for the window.  This
originally was done as an array, not as an array of pointers,
because it was meant to be used as a cyclic FIFO buffer and a
plain array avoids an extra pointer indirection, while its FIFOness
eant that we are not "moving" the entries like this patch does.

The runtime from three versions were comparable.  It seems to
make the resulting chain even shorter, which can only be good.

(stock "master") 15782196 bytes
chain length = 1: 2972 objects
chain length = 2: 2651 objects
chain length = 3: 2369 objects
chain length = 4: 2121 objects
chain length = 5: 1877 objects
...
chain length = 46: 490 objects
chain length = 47: 515 objects
chain length = 48: 527 objects
chain length = 49: 570 objects
chain length = 50: 408 objects

(with your patch) 15745736 bytes (0.23% smaller)
chain length = 1: 3137 objects
chain length = 2: 2688 objects
chain length = 3: 2322 objects
chain length = 4: 2146 objects
chain length = 5: 1824 objects
...
chain length = 46: 503 objects
chain length = 47: 509 objects
chain length = 48: 536 objects
chain length = 49: 588 objects
chain length = 50: 357 objects

(with this patch) 15612086 bytes (1.08% smaller)
chain length = 1: 4831 objects
chain length = 2: 3811 objects
chain length = 3: 2964 objects
chain length = 4: 2352 objects
chain length = 5: 1944 objects
...
chain length = 46: 327 objects
chain length = 47: 353 objects
chain length = 48: 304 objects
chain length = 49: 298 objects
chain length = 50: 135 objects

[jc: this is with code simplification follow-up from Nico]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-01 23:53:47 -07:00
Junio C Hamano
4e837a98b6 Merge branch 'jp/send-email-cc'
* jp/send-email-cc:
  git-send-email --cc-cmd
2007-09-01 13:15:27 -07:00
Robin Rosenberg
a94eda65d3 Mention -m as an abbreviation for --merge
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-01 10:36:56 -07:00
Junio C Hamano
947ad2e1de Update my contact address as the maintainer. 2007-09-01 04:09:51 -07:00
Junio C Hamano
f368f5a6bc Documentation: minor AsciiDoc mark-up fixes.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-01 04:06:13 -07:00
Luben Tuikov
2e7766655a URL: allow port specification in ssh:// URLs
Allow port specification in ssh:// URLs in the
usual notation:

	ssh://[user@]host.domain[:<port>]/<path>

This allows git to be used over ssh-tunneling
networks.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-01 03:35:29 -07:00
Junio C Hamano
c7965afd3d Avoid one-or-more (\+) non BRE in sed scripts.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-01 02:35:30 -07:00