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

6280 Commits

Author SHA1 Message Date
Jakub Narebski
eee08903b2 gitweb: Use git-diff-tree patch output for commitdiff
Get rid of git_diff_print invocation in git_commitdiff and therefore
external diff (/usr/bin/diff) invocation, and use only git-diff-tree
to generate patch.

git_commitdiff and git_commitdiff_plain are collapsed into one
subroutine git_commitdiff, with format (currently 'html' which is
default format corresponding to git_commitdiff, and 'plain'
corresponding to git_commitdiff_plain) specified in argument.

Separate patch (diff) pretty-printing into git_patchset_body.
It is used in git_commitdiff.

Separate patch (diff) line formatting from git_diff_print into
format_diff_line function. It is used in git_patchset_body.

While at it, add $hash parameter to git_difftree_body, according to
rule that inner functions should use parameter passing, and not global
variables.

CHANGES TO OUTPUT:
 * "commitdiff" now products patches with renaming and copying
   detection (git-diff-tree is invoked with -M and -C options).
   Empty patches (mode changes and pure renames and copying)
   are not written currently. Former version broke renaming and
   copying, and didn't notice mode changes, like this version.

 * "commitdiff" output is now divided into several div elements
   of class "log", "patchset" and "patch".

 * "commitdiff_plain" now only generates X-Git-Tag: line only if there
   is tag pointing to the current commit. Former version which wrote
   first tag following current commit was broken[*1*]; besides we are
   interested rather in tags _preceding_ the commit, and _heads_
   following the commit. X-Git-Url: now is current URL; former version
   tried[*2*] to output URL to HTML version of commitdiff.

 * "commitdiff_plain" is generated by git-diff-tree, and has therefore
   has git specific extensions to diff format: "git diff" header and
   optional extended header lines.

FOOTNOTES
[*1*] First it generated rev-list starting from HEAD even if hash_base
parameter was set, second it wasn't corrected according to changes
made in git_get_references (formerly read_info_ref) output, third even
for older version of read_info_ref output it didn't work for multiple
tags pointing to the current commit (rare).

[*2*] It wrote URL for commitdiff without hash_parent, which produces
diff to first parent and is not the same as current diff if it is diff
of merge commit to non-first parent.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 19:28:18 -07:00
Jonas Fonseca
0ea4d4c94b git-svn(1): improve asciidoc markup
Use list continuation to have better wrapping. This accounts for most of
the changes because it reindents a lot of text without applying other
changes.

Use cross-referencing for interlinking and the gitlink macro for pointing
to other tools in the git suite.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 19:26:29 -07:00
Jonas Fonseca
5bab25fd91 gitview.txt: improve asciidoc markup
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 19:26:27 -07:00
Jonas Fonseca
8b70004b8f git(7): put the synopsis in a verse style paragraph
... so it wraps properly in small terminals.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 19:26:21 -07:00
Jonas Fonseca
5164b6cd3c gitk(1): expand the manpage to look less like a template
Add a short description and document a few selected options additionally to
the different "entities" in the standard calling convention. Advertise
other git repository browsers. Lastly, climb Mount Ego.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 19:26:11 -07:00
Jonas Fonseca
26e8c5d385 git-blame(1): mention options in the synopsis and advertise pickaxe
Inspired by the cvs annotate documentation improve and expand the man page
to also mention the limitations of file annotations. Since people coming
from the SVN/CVS world might first look here, also briefly advertise how
the pickaxe interface makes it easy to go beyond these limitation.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 19:26:05 -07:00
Jonas Fonseca
0dde68998c git-ls-remote(1): document --upload-pack
... and mention that '.' will list the local repo references.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 19:25:58 -07:00
Jonas Fonseca
5684ed6d32 git-apply(1): document missing options and improve existing ones
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-25 19:25:46 -07:00
Junio C Hamano
7099c9c7c9 update-index -g
I often find myself typing this but the common abbreviation "g" for
"again" has not been supported so far for some unknown reason.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 21:24:47 -07:00
Pierre Habouzit
5df7dbbae4 n is in fact unused, and is later shadowed.
date.c::approxidate_alpha() counts the number of alphabets
while moving the pointer but does not use the count.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 18:47:39 -07:00
Pierre Habouzit
dd305c8462 use name[len] in switch directly, instead of creating a shadowed variable.
builtin-apply.c defines a local variable 'c' which is used only
once and then later gets shadowed by another instance of 'c'.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 18:47:39 -07:00
Junio C Hamano
599f8d6314 builtin-grep.c: remove unused debugging piece.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 18:47:39 -07:00
Pierre Habouzit
d828f6ddf8 remove ugly shadowing of loop indexes in subloops.
builtin-mv.c and git.c has a nested loop that is governed by a
variable 'i', but they shadow it with another instance of 'i'.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 18:47:39 -07:00
Pierre Habouzit
b5bf7cd6b7 missing 'static' keywords
builtin-tar-tree.c::git_tar_config() and http-push.c::add_one_object()
are not used outside their own files.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 18:47:38 -07:00
Pierre Habouzit
c5fba16c50 git_dir holds pointers to local strings, hence MUST be const.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 18:47:38 -07:00
Pierre Habouzit
60b7f38e0e avoid to use error that shadows the function name, use err instead.
builtin-apply.c and builtin-push.c uses a local variable called 'error'
which shadows the error() function.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 18:47:38 -07:00
Junio C Hamano
87cb004e42 hashcpy/hashcmp remaining bits.
This fixes up merge-recursive.c for hashcpy/hashcmp changes.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 14:31:20 -07:00
Shawn Pearce
8da7149394 Convert memcpy(a,b,20) to hashcpy(a,b).
This abstracts away the size of the hash values when copying them
from memory location to memory location, much as the introduction
of hashcmp abstracted away hash value comparsion.

A few call sites were using char* rather than unsigned char* so
I added the cast rather than open hashcpy to be void*.  This is a
reasonable tradeoff as most call sites already use unsigned char*
and the existing hashcmp is also declared to be unsigned char*.

[jc: this is a follow-up patch for merge-recursive.c which is
 not in "master" yet.  The original was sent-in for "next" so
 I splitted it out. ]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 14:27:00 -07:00
Junio C Hamano
2ad6ba353a Merge branch 'gl/cleanup' into gl/cleanup-next
* gl/cleanup: (160 commits)
  Convert memset(hash,0,20) to hashclr(hash).
  Convert memcpy(a,b,20) to hashcpy(a,b).
  Fix a comparison bug in diff-delta.c
  git-send-email: Don't set author_not_sender from Cc: lines
  Remove unnecessary forward declaration of unpack_entry.
  Verify we know how to read a pack before trying to using it.
  Add write_or_die(), a helper function
  Axe the last ent
  builtin-mv: readability patch
  git-mv: fix off-by-one error
  git-mv: special case destination "."
  builtin-mv: readability patch
  Indentation fix.
  Do not use memcmp(sha1_1, sha1_2, 20) with hardcoded length.
  gitweb: Uniquify version info output, add meta generator in page header
  Be nicer if git executable is not installed
  builtin-grep: remove unused debugging cruft.
  gitweb: Add support for per project git URLs
  [PATCH] git-mv: add more path normalization
  Remove the "delay writing to avoid runtime penalty of racy-git avoidance"
  ...
2006-08-23 14:18:24 -07:00
Junio C Hamano
a8e0d16d85 Convert memset(hash,0,20) to hashclr(hash).
In the same spirit as hashcmp() and hashcpy().

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 13:57:23 -07:00
Shawn Pearce
e702496e43 Convert memcpy(a,b,20) to hashcpy(a,b).
This abstracts away the size of the hash values when copying them
from memory location to memory location, much as the introduction
of hashcmp abstracted away hash value comparsion.

A few call sites were using char* rather than unsigned char* so
I added the cast rather than open hashcpy to be void*.  This is a
reasonable tradeoff as most call sites already use unsigned char*
and the existing hashcmp is also declared to be unsigned char*.

[jc: Splitted the patch to "master" part, to be followed by a
 patch for merge-recursive.c which is not in "master" yet.

 Fixed the cast in the latter hunk to combine-diff.c which was
 wrong in the original.

 Also converted ones left-over in combine-diff.c, diff-lib.c and
 upload-pack.c ]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 13:53:10 -07:00
Pierre Habouzit
b05faa2da9 Fix a comparison bug in diff-delta.c
(1 << i) < hspace is compared in the `int` space rather that in the
unsigned one.  the result will be wrong if hspace is between 0x40000000
and 0x80000000.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 03:05:27 -07:00
Haavard Skinnemoen
68d42c41ef git-send-email: Don't set author_not_sender from Cc: lines
When an mbox-style patch contains a Cc: line in the header,
git-send-email will check the address against the sender specified
on the command line. If they don't match, sender_not_author will
be set to the address obtained from the Cc line.

When this happens, git-send-email inserts a From: line at the
beginning of the message body with the address obtained from the
Cc line in the header, and the sender might be accused of forging
patch authors.

This patch fixes this by only updating sender_not_author when
processing From: lines, not when processing Cc: lines.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 03:04:01 -07:00
Tilman Sauerbeck
678dac6b45 Added support for dropping privileges to git-daemon.
Signed-off-by: Tilman Sauerbeck <tilman@code-monkey.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-22 16:40:40 -07:00
Jakub Narebski
498fe00201 gitweb: Sort CGI parameters returned by href()
Restore pre-1c2a4f5addce479c619057c6cdc841802139982f
ordering of CGI parameters.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-22 16:12:27 -07:00
Jakub Narebski
1149fecfc2 gitweb: Drop the href() params which keys are not in %mapping
If someone would enter parameter name incorrectly, and some key of
%params is not found in %mapping hash, the parameter is now
ignored. Change introduced by Martin Waitz in commit
  756d2f064b2419fcdf9cd9c851f352e2a4f75103
tried to do that, but it left empty value and there was doubled ";;"
in returned string.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-22 16:12:26 -07:00
Jakub Narebski
59b9f61a3f gitweb: Use here-doc
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-22 16:10:56 -07:00
Jakub Narebski
77a153fd92 gitweb: Route rest of action subroutines through %actions
Route rest of action subroutines, namely git_project_list and git_opml
(both of which doesn't need $project) through %actions hash.

This has disadvantage that all parameters are read and validated;
earlier git_opml was called as soon as $action was parsed and
validated, git_project_list was called as soon as $project was parsed
and validated.  This has advantage that all action dispatch is grouped
in one place.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-22 16:06:31 -07:00
Jakub Narebski
134a6941ec gitweb: Use underscore instead of hyphen to separate words in HTTP headers names
Use underscore (which will be turned into hyphen) to separate words in
HTTP header names, in keys to CGI header() method, consistently.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-22 16:05:09 -07:00
Jakub Narebski
952c65fc02 gitweb: Whitespace cleanup: realign, reindent
This patch tries (but no too hard) to fit gitweb source in 80 columns,
for 2 columns wide tabs, and indent and align source for better
readibility.

While at it added comment to 'snapshot' entry defaults for %feature
hash, corrected "blobl" action in git_blame2 and git_blame to "blob",
key of argument to $cgi->a from 'class' to '-class'.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-22 15:51:45 -07:00
Jakub Narebski
63e4220b75 gitweb: Replace some presentational HTML by CSS
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-22 15:51:01 -07:00
Jakub Narebski
7c27801473 gitweb: bugfix: a.list formatting regression
Fix regression introduced by
commit 17d07443188909ef5f8b8c24043cb6d9fef51bca.

"a.list" being "bold", makes a myriad of things shown by
gitweb in bold font-weight, which is a regression from
pre-17d07443188909ef5f8b8c24043cb6d9fef51bca behavior.

The fix is to add "subject" class and use this class
to replace pre-format_subject_html formatting of subject
(comment) via using (or not) <b>...</b> element. This
should go back to the pre-17d0744318... style.

Regression noticed by Luben Tuikov.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-22 15:50:54 -07:00
Junio C Hamano
0e9ee32358 apply --reject: count hunks starting from 1, not 0
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-22 15:49:28 -07:00
Shawn Pearce
44c10841ea Remove unnecessary forward declaration of unpack_entry.
This declaration probably used to be necessary but the code has
been refactored since to use unpack_entry_gently instead.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-21 20:26:14 -07:00
Shawn Pearce
da7560110f Verify we know how to read a pack before trying to using it.
If the pack format were to ever change or be extended in the future
there is no assurance that just because the pack file lives in
objects/pack and doesn't end in .idx that we can read and decompress
its contents properly.

If we encounter what we think is a pack file and it isn't or we don't
recognize its version then die and suggest to the user that they
upgrade to a newer version of GIT which can handle that pack file.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-21 20:24:56 -07:00
Rene Scharfe
7230e6d042 Add write_or_die(), a helper function
The little helper write_or_die() won't come back with bad news about
full disks or broken pipes.  It either succeeds or terminates the
program, making additional error handling unnecessary.

This patch adds the new function and uses it to replace two similar
ones (the one in tar-tree originally has been copied from cat-file
btw.).  I chose to add the fd parameter which both lacked to make
write_or_die() just as flexible as write() and thus suitable for
lib-ification.

There is a regression: error messages emitted by this function don't
show the program name, while the replaced two functions did.  That's
acceptable, I think; a lot of other functions do the same.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-21 20:22:23 -07:00
Rene Scharfe
3f0073a2fa Axe the last ent
In the name of Standardization, this cleanses the last usage string of
mystical creatures.  But they still dwell deep within the source and in
some debug messages, it is said.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-21 20:19:45 -07:00
Jakub Narebski
e8e41a9383 gitweb: Use parse_difftree_raw_line in git_difftree_body
Use newly introduced parse_difftree_raw_line function in the
git_difftree_body subroutine.  While at it correct error in
parse_difftree_raw_line (unquote is unprototyped function), and
add comment explaining this function.

It also refactors git_difftree_body somewhat, and tries to fit
it in 80 columns.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-21 14:33:55 -07:00
Jakub Narebski
740e67f903 gitweb: Added parse_difftree_raw_line function for later use
Adds parse_difftree_raw_line function which parses one line of "raw"
format diff-tree output into a hash.

For later use in git_difftree_body, git_commitdiff and
git_commitdiff_plain, git_search.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-21 14:33:54 -07:00
Junio C Hamano
e866ffdf9b Merge branch 'maint'
* maint:
  builtin-mv: readability patch
  git-mv: fix off-by-one error
  git-mv: special case destination "."
2006-08-21 14:16:38 -07:00
Johannes Schindelin
60a6bf5f53 builtin-mv: readability patch
The old version was not liked at all. This is hopefully better. Oh, and it
gets rid of the goto.

Note that it does not change any functionality.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-21 14:15:52 -07:00
Johannes Schindelin
6e17886d37 git-mv: fix off-by-one error
Embarassing.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-21 14:15:45 -07:00
Johannes Schindelin
c5203bdf66 git-mv: special case destination "."
Since the normalized basename of "." is "", the check for directory
failed erroneously.

Noticed by Fredrik Kuivinen.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-21 14:15:43 -07:00
Johannes Schindelin
43134fcb35 builtin-mv: readability patch
The old version was not liked at all. This is hopefully better. Oh, and it
gets rid of the goto.

Note that it does not change any functionality.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-20 19:14:56 -07:00
Aneesh Kumar K.V
ddb8d90048 gitweb: Make blame and snapshot a feature.
This adds blame and snapshot to the feature associative array.  This
also helps in enabling or disabling these features via GITWEB_CONFIG
and overriding if allowed via project specfic config.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-20 15:51:59 -07:00
Junio C Hamano
a2bf404e28 git-apply --verbose
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-18 03:14:48 -07:00
Junio C Hamano
82e2765f59 git-apply --reject: send rejects to .rej files.
... just like everybody else does, instead of sending it to the standard
output, which was just silly.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-18 03:10:19 -07:00
Aneesh Kumar K.V
f0321866be gitweb: fix snapshot support
[jc: when I applied the patch I misread RFC 2616 which mildly
 recommended against using the name "gzip", which was there only
 for a historical reason.  This fixes the mistake up and uses
 the content-encoding "x-gzip" again.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-17 22:58:05 -07:00
Luben Tuikov
59fb1c9445 gitweb: bugfix: git_print_page_path() needs the hash base
If a file F exists in branch B, but doesn't exist
in master branch, then blob_plain needs the hash base in
order to properly get the file.  The hash base is passed
on symbolically so we still preserve the "latest" quality
of the link presented by git_print_page_path().

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-17 14:31:14 -07:00
Luben Tuikov
3899e7a329 gitweb: bugfix: commitdiff regression
Fix regression in git_commitdiff() introduced
by commit 756d2f064b2419fcdf9cd9c851f352e2a4f75103.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-17 14:30:21 -07:00