Commit graph

6989 commits

Author SHA1 Message Date
Alexandre Julliard d64d6c9fc7 get_shallow_commits: Avoid memory leak if a commit has been reached already.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:50 -08:00
Alexandre Julliard d158631549 git-fetch: Reset shallow_depth before auto-following tags.
Otherwise fetching the tags could also fetch commits up to the
specified depth, which isn't the expected behavior.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:50 -08:00
Alexandre Julliard 1f2de76981 upload-pack: Check for NOT_SHALLOW flag before sending a shallow to the client.
A commit may have been put on the shallow list, and then reached from
another branch and marked NOT_SHALLOW without being removed from the
list.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:50 -08:00
Alexandre Julliard d6491e3a21 fetch-pack: Properly remove the shallow file when it becomes empty.
The code was unlinking the lock file instead.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:49 -08:00
Junio C Hamano 176d45cb20 shallow clone: unparse and reparse an unshallowed commit
Otherwise we would not read the real parents from the commit
object.
2006-11-24 15:42:49 -08:00
Junio C Hamano c6702f4b95 Why didn't we mark want_obj as ~UNINTERESTING in the old code?
Is this something we would want to do regardless of shallow clone?
2006-11-24 15:42:49 -08:00
Junio C Hamano fcd1e31906 Why does it mean we do not have to register shallow if we have one? 2006-11-24 15:42:49 -08:00
Junio C Hamano cf01bd52ef We should make sure that the protocol is still extensible.
This just reformats if .. else if .. else chain to make it clear we
are handling extended response from the other end.
2006-11-24 15:42:49 -08:00
Johannes Schindelin 16ad357910 add tests for shallow stuff
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:49 -08:00
Alexandre Julliard abef3a1625 Shallow clone: do not ignore shallowness when following tags
Tags should be considered when truncating the
commit list. The patch below fixes it, and fetches the right number of
commits for each tag. However the correct fix is probably to not fetch
historical tags at all.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:49 -08:00
Johannes Schindelin f53514bc2d allow deepening of a shallow repository
Now, by saying "git fetch -depth <n> <repo>" you can deepen
a shallow repository.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:49 -08:00
Johannes Schindelin 016e6ccbe0 allow cloning a repository "shallowly"
By specifying a depth, you can now clone a repository such that
all fetched ancestor-chains' length is at most "depth". For example,
if the upstream repository has only 2 branches ("A" and "B"), which
are linear, and you specify depth 3, you will get A, A~1, A~2, A~3,
B, B~1, B~2, and B~3. The ends are automatically made shallow
commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:49 -08:00
Johannes Schindelin ed09aef06f support fetching into a shallow repository
A shallow commit is a commit which has parents, which in turn are
"grafted away", i.e. the commit appears as if it were a root.

Since these shallow commits should not be edited by the user, but
only by core git, they are recorded in the file $GIT_DIR/shallow.

A repository containing shallow commits is called shallow.

The advantage of a shallow repository is that even if the upstream
contains lots of history, your local (shallow) repository needs not
occupy much disk space.

The disadvantage is that you might miss a merge base when pulling
some remote branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:49 -08:00
Johannes Schindelin 9b8dc263e1 upload-pack: no longer call rev-list
It is trivial to do now, and it is needed for the upcoming shallow
clone stuff.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:49 -08:00
Junio C Hamano 7002243f7e gitweb: (style) use chomp without parentheses consistently.
It seems that gitweb tries to consistently use chomp without parentheses
around its operands, but there were two places that said "chomp($var);".

Let's be consistent.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 14:07:41 -08:00
Jakub Narebski 793c400cc1 gitweb: Replace SPC with &nbsp; also in tag comment
Commit messages had SPC replaced with &nbsp; entity;
make it so also in tag message (tag comment).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 14:01:23 -08:00
Junio C Hamano 634b8d0514 Merge branch 'jn/web'
* jn/web:
  gitweb: Finish restoring "blob" links in git_difftree_body
  gitweb: Refactor feed generation, make output prettier, add Atom feed
  gitweb: Add an option to href() to return full URL
  gitweb: New improved formatting of chunk header in diff
  gitweb: Default to $hash_base or HEAD for $hash in "commit" and "commitdiff"
  gitweb: Buffer diff header to deal with split patches + git_patchset_body refactoring
  gitweb: Protect against possible warning in git_commitdiff
2006-11-24 03:54:57 -08:00
Junio C Hamano c7757948dc Merge branch 'pb/diffroot'
* pb/diffroot:
  config option log.showroot to show the diff of root commits
2006-11-24 03:49:57 -08:00
Junio C Hamano 9919b5ea8c Merge branch 'jc/pack-heuristics'
* jc/pack-heuristics:
  pack-objects: tweak "do not even attempt delta" heuristics
2006-11-24 03:46:44 -08:00
Junio C Hamano 54acddce99 Merge branch 'jc/numstat'
* jc/numstat:
  apply --numstat: mark binary diffstat with - -, not 0 0
2006-11-24 03:46:40 -08:00
Junio C Hamano 5b6be4ccb5 Merge branch 'ap/branch-ref-display'
* ap/branch-ref-display:
  Add support to git-branch to show local and remote branches
2006-11-24 03:43:46 -08:00
Junio C Hamano f3307deeec Merge branch 'ap/prune'
* ap/prune:
  Typefix builtin-prune.c::prune_object()
  Improve git-prune -n output
2006-11-24 03:42:36 -08:00
Junio C Hamano ac1471b39f Typefix builtin-prune.c::prune_object()
It passed (const char*) to a function that took a (char *); the
buffer itself was of course writable, so pass the buffer itself.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 02:54:37 -08:00
Peter Baumann 0f03ca9461 config option log.showroot to show the diff of root commits
This allows one to see a root commit as a diff in commands like git-log,
git-show and git-whatchanged.

Signed-off-by: Peter Baumann <Peter.B.Baumannn@stud.informatik.uni-erlangen.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 02:35:26 -08:00
Junio C Hamano 3fbe2d54d7 Merge branch 'jc/upload-pack'
* jc/upload-pack:
  upload-pack: stop the other side when they have more roots than we do.
2006-11-24 02:34:27 -08:00
Eric Wong 30d055aa1e git-svn: handle authentication without relying on cached tokens on disk
This is mostly gleaned off SVN::Mirror, with added support for
--no-auth-cache and --config-dir.

Even with this patch, git-svn does not yet support repositories
where the user only has partial read permissions.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 02:23:22 -08:00
Iñaki Arenaza 73bcf53342 git-cvsimport: add support for CVS pserver method HTTP/1.x proxying
This patch adds support for 'proxy' and 'proxyport' connection options
when using the pserver method for the CVS Root.

It has been tested with a Squid 2.5.x proxy server.

Quoting from the CVS info manual:

     The `gserver' and `pserver' connection methods all accept optional
  method options, specified as part of the METHOD string, like so:

       :METHOD[;OPTION=ARG...]:

     Currently, the only two valid connection options are `proxy', which
  takes a hostname as an argument, and `proxyport', which takes a port
  number as an argument.  These options can be used to connect via an HTTP
  tunnel style web proxy.  For example, to connect pserver via a web proxy
  at www.myproxy.net and port 8000, you would use a method of:

       :pserver;proxy=www.myproxy.net;proxyport=8000:

     *NOTE: The rest of the connection string is required to connect to
  the server as noted in the upcoming sections on password authentication,
  gserver and kserver.  The example above would only modify the METHOD
  portion of the repository name.*

     PROXY must be supplied to connect to a CVS server via a proxy
  server, but PROXYPORT will default to port 8080 if not supplied.
  PROXYPORT may also be set via the CVS_PROXY_PORT environment variable.

Signed-off-by: Iñaki Arenaza <iarenuno@eteo.mondragon.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 02:21:29 -08:00
Petr Baudis 7182135189 Make git-clone --use-separate-remote the default
We've talked about this for quite some time on the list, and it
is a sane thing to do for a repository with an associcated
working tree.

For somebody who wants to use the traditional layout, there is a
backward compatibility option --use-immingled-remote, but it is
expected to be removed before the next major release.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 22:53:06 -08:00
Junio C Hamano 29561ad0ad refs outside refs/{heads,tags} match less strongly.
This changes the refname matching logic used to decide which ref
is updated with git-send-pack.  We used to error out when
pushing 'master' when the other end has both 'master' branch and
a tracking branch 'remotes/$name/master' but with this, 'master'
matches only 'refs/heads/master' when both and no other 'master'
exist.

Pushing 'foo' when both heads/foo and tags/foo exist at the
remote end is still considered an error and you would need to
disambiguate between them by being more explicit.

When neither heads/foo nor tags/foo exists at the remote,
pushing 'foo' when there is only remotes/origin/foo is not
ambiguous, while it still is ambiguous when there are more than
one such weaker match (remotes/origin/foo and remotes/alt/foo,
for example).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 22:52:52 -08:00
Andy Parkins f73da29fa2 Increase length of function name buffer
In xemit.c:xdl_emit_diff() a buffer for showing the function name as
commentary is allocated; this buffer was 40 characters.  This is a bit
small; particularly for C++ function names where there is often an
identical prefix (like void LongNamespace::LongClassName) on multiple
functions, which makes the context the same everywhere.  In other words
the context is useless.  This patch increases that buffer to 80
characters - which may still not be enough, but is better

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 22:51:41 -08:00
Eric Wong 4769489a41 git-svn: preserve uncommitted changes after dcommit
Using dcommit could cause the user to lose uncommitted changes
during the reset --hard operation, so change it to reset --mixed.

If dcommit chooses the rebase path, then git-rebase will already
error out when local changes are made.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 15:17:46 -08:00
Eric Wong e70dc780a4 git-svn: correctly handle revision 0 in SVN repositories
some SVN repositories have a revision 0 (committed by no author
and no date) when created; so when we need to ensure that we
check any revision variables are defined, and not just
non-zero.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 15:17:45 -08:00
Eric Wong 48d044b5fe git-svn: error out from dcommit on a parent-less commit
dcommit would unconditionally append "~1" to a commit in order
to generate a diff.  Now we generate a meaningful error message
if we try to generate an impossible diff.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 15:17:43 -08:00
René Scharfe 0ea865ce7a archive-zip: don't use sizeof(struct ...)
We can't rely on sizeof(struct zip_*) returning the sum of
all struct members.  At least on ARM padding is added at the
end, as Gerrit Pape reported.  This fixes the problem but
still lets the compiler do the summing by introducing
explicit padding at the end of the structs and then taking
its offset as the combined size of the preceding members.

As Junio correctly notes, the _end[] marker array's size
must be greater than zero for compatibility with compilers
other than gcc.  The space wasted by the markers can safely
be neglected because we only have one instance of each
struct, i.e. in sum 3 wasted bytes on i386, and 0 on ARM. :)

We still rely on the compiler to not add padding between the
struct members, but that's reasonable given that all of them
are unsigned char arrays.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 14:20:32 -08:00
Junio C Hamano e945f95157 GIT 1.4.4.1
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-22 16:57:34 -08:00
Junio C Hamano 2bbaaed9ee trust-executable-bit: fix breakage for symlinks
An earlier commit f28b34a broke symlinks when trust-executable-bit
is not set because it incorrectly assumed that everything was a
regular file.

Reported by Juergen Ruehle.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-22 16:36:49 -08:00
Chris Riddoch 5d1faf8791 Move --pretty options into Documentation/pretty-formats.txt
Asciidoc-include it into the manuals for programs that use the
--pretty command-line option, for consistency among the docs.

This describes all the pretty-formats currently listed in the cmit_fmt
enum in commit.h, and also briefly describes the presence and format
of the 'Merge: ' line in some pretty formats.

There's a hedge that limiting your view of history can affect what
goes in the Merge: line, and that --abbrev/--no-abbrev do nothing to
the 'raw' format.

Signed-off-by: Chris Riddoch <chris@syntacticsugar.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-22 16:06:32 -08:00
Andy Parkins bfcc921430 Add support to git-branch to show local and remote branches
Instead of storing a list of refnames in append_ref, a list of
structures is created.  Each of these stores the refname and a
symbolic constant representing its type.

The creation of the list is filtered based on a command line
switch; no switch means "local branches only", "-r" means "remote
branches only" (as they always did); but now "-a" means "local
branches or remote branches".

As a side effect, the list is now not global, but allocated in
print_ref_list() where it used.

Also a memory leak is plugged, the memory allocated during the
list creation was never freed.

It lays a groundwork to also display tags, but the command being
'git branch' it is not currently used.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 21:26:12 -08:00
Andy Parkins 21f88ac84a Improve git-prune -n output
prune_object() in show_only mode would previously just show the path to the
object that would be deleted.  The path the object is stored in shouldn't be
shown to users, they only know about sha1 identifiers so show that instead.

Further, the sha1 alone isn't that useful for examining what is going to be
deleted.  This patch also adds the object type to the output, which makes it
easy to pick out, say, the commits and use git-show to display them.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 19:02:08 -08:00
Paolo Ciarrocchi 5942706357 Doc: Make comment about merging in tutorial.txt more clear
Rephrased a sentence in order to make more clear the concept of
pull . branch

Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 19:01:29 -08:00
Michal Rokos aa9098611f archive: use setvbuf() instead of setlinebuf()
This tiny patch makes GIT compile again on HP-UX 11i.

[jc: The setlinebuf() is described as unportable to BSD before
 4.2; it's not even in POSIX, while setvbuf() is in ISO C.]

Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 16:57:55 -08:00
Jakub Narebski 897d1d2e2a gitweb: Finish restoring "blob" links in git_difftree_body
This finishes work started by commit 4777b0141a
  "gitweb: Restore object-named links in item lists"
by Petr Baudis. It brings back rest of "blob" links in difftree-raw
like part of "commit" and "commitdiff" views, namely in
git_difftree_body subroutine.

Now the td.link table cell has the following links:
 * link to diff ("blobdiff" view) in "commit" view, if applicable
   (there is no link to uninteresting creation/deletion diff), or
   link to patch anchor in "commitdiff" view.
 * link to current version of file ("blob" view), with the obvious
   exception of file deletion, where it is link to the parent
   version.
 * link to "blame" view, if it is enabled, and file was not just
   created (i.e. it has any history).
 * link to history of the file ("history" view), again with sole
   exception of the case of new file.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:41 -08:00
Jakub Narebski af6feeb229 gitweb: Refactor feed generation, make output prettier, add Atom feed
Add support for more modern Atom web feed format. Both RSS and Atom
feeds are generated by git_feed subroutine to avoid code duplication;
git_rss and git_atom are thin wrappers around git_feed. Add links to
Atom feed in HTML header and in page footer (but not in OPML; we
should use APP, Atom Publishing Proptocol instead).

Allow for feed generation for branches other than current (HEAD)
branch, and for generation of feeds for file or directory history.

Do not use "pre ${\sub_returning_scalar(...)} post" trick, but join
strings instead: "pre " . sub_returning_scalar(...) . " post".
Use href(-full=>1, ...) instead of hand-crafting gitweb urls.

Make output prettier:
* Use title similar to the title of web page
* Use project description (if exists) for description/subtitle
* Do not add anything (committer name, commit date) to feed entry title
* Wrap the commit message in <pre>
* Make file names into an unordered list
* Add links (diff, conditional blame, history) to the file list.

In addition to the above points, the attached patch emits a
Last-Changed: HTTP response header field, and doesn't compute the feed
body if the HTTP request type was HEAD. This helps keep the web server
load down for well-behaved feed readers that check if the feed needs
updating.

If browser (feed reader) sent Accept: header, and it prefers 'text/xml' type
to 'application/rss+xml' (in the case of RSS feed) or 'application/atom+xml'
(in the case of Atom feed), then use 'text/xml' as content type.

Both RSS and Atom feeds validate at http://feedvalidator.org
and at http://validator.w3.org/feed/

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Andreas Fuchs <asf@boinkor.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:41 -08:00
Jakub Narebski bd5d1e42fb gitweb: Add an option to href() to return full URL
href subroutine by default generates absolute URL (generated using
CGI::url(-absolute=>1), and saved in $my_uri) using $my_uri as base;
add an option to generate full URL using $my_url as base.

New feature usage: href(..., -full=>1)

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:41 -08:00
Jakub Narebski 59e3b14e08 gitweb: New improved formatting of chunk header in diff
If we have provided enough info, and diff is not combined diff,
and if provided diff line is chunk header, then:
* split chunk header into .chunk_info and .section span elements,
  first containing proper chunk header, second section heading
  (aka. which function), for separate styling: the proper chunk
  header is on non-white background, section heading part uses
  slightly lighter color.
* hyperlink from-file-range to starting line of from-file, if file
  was not created.
* hyperlink to-file-range to starting line of to-file, if file
  was not deleted.
Links are of invisible variety (and "list" class).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:40 -08:00
Jakub Narebski 9954f772eb gitweb: Default to $hash_base or HEAD for $hash in "commit" and "commitdiff"
Set $hash parameter to $hash_base || "HEAD" if it is not set (if it is
not true to be more exact). This allows [hand-edited] URLs with 'action'
"commit" or "commitdiff" but without 'hash' parameter.

If there is 'h' (hash) parameter provided, then gitweb tries
to use this. HEAD is used _only_ if nether hash, nor hash_base
are provided, i.e. for URL like below
  URL?p=project.git;a=commit
i.e. without neither 'h' nor 'hb'.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:40 -08:00
Jakub Narebski 6d55f05576 gitweb: Buffer diff header to deal with split patches + git_patchset_body refactoring
There are some cases when one line from "raw" git-diff output (raw format)
corresponds to more than one patch in the patchset git-diff output. To deal
with this buffer git diff header and extended diff header (everything up to
actual patch) to check from information from "index <hash>..<hash>" extended
header line if the patch corresponds to the same or next difftree raw line.

This could also be used to gather information needed for hyperlinking, and
used for printing gitweb quoted filenames, from extended diff header instead
of raw git-diff output.

While at it, refactor git_patchset_body subroutine from the event-driven,
AWK-like state-machine parsing to sequential parsing: for each patch
parse (and output) git diff header, parse extended diff header, parse two-line
from-file/to-file diff header, parse patch itself; patch ends with the end
of input [file] or the line matching m/^diff /.

For better understanding the code, there were added assertions in the
comments a la Carp::Assert module. Just in case there is commented out code
dealing with unexpected end of input (should not happen, hence commented
out).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:40 -08:00
Jakub Narebski 04408c3578 gitweb: Protect against possible warning in git_commitdiff
We may read an undef from <$fd> and unconditionally chomping it
would result in a warning.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 14:35:40 -08:00
Paolo Ciarrocchi 69945602f9 Teach SubmittingPatches about git-commit -s
As discussed on git mailing list let's teach the reader about
the possiblity to have automatically signed off the commit running
the git-commit -s command

Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-21 11:40:18 -08:00
Junio C Hamano ef06b91804 do_for_each_ref: perform the same sanity check for leftovers.
An earlier commit b37a562a added a check to see if the ref
points at a valid object (as a part of 'negative ref' support
which we currently do not use), but did so only while iterating
over both packed and loose refs, and forgot to apply the same
check while iterating over the remaining ones.

We might want to replace the "if null then omit it" check with
"eh --- what business does a 0{40} value have here?" complaint
later since we currently do not use negative refs, but that is
a separate issue.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-19 18:44:29 -08:00