Commit graph

6173 commits

Author SHA1 Message Date
Linus Torvalds 5d44cd1c8b Fix git-fsck-objects SIGSEGV/divide-by-zero
If you try to fsck a repository that isn't entirely empty, but that has no
inter-object references (ie all the objects are blobs, and don't refer to
anything else), git-fsck-objects currently fails.

This probably cannot happen in practice, but can be tested with something
like

	git init-db
	touch dummy
	git add dummy
	git fsck-objects

where the fsck will die by a divide-by-zero when it tries to look up the
references from the one object it found (hash_obj() will do a modulus by
refs_hash_size).

On some other archiectures (ppc, sparc) the divide-by-zero will go
unnoticed, and we'll instead SIGSEGV when we hit the "refs_hash[j]"
access.

So move the test that should protect against this from mark_reachable()
into lookup_object_refs(), which incidentally in the process also fixes
mark_reachable() itself (it used to not mark the one object that _was_
reachable, because it decided that it had no refs too early).

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-04 15:24:10 -07:00
Jakub Narebski f2e609473c gitweb: Change the name of diff to parent link in "commit" view to "diff
Change the name of diff to parent (current commit to one of parents)
link in "commit" view (git_commit subroutine) from "commitdiff" to
"diff".  Let's leave "commitdiff" for equivalent of git-show, or
git-diff-tree with one revision, i.e. diff for a given commit to its
parent (parents).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-03 16:15:11 -07:00
Christian Couder 2886bdb118 Update GIT_TRACE documentation.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-03 14:18:55 -07:00
Junio C Hamano 1bbb2cff62 Merge branch 'master' into cc/trace
* master:
  Trace into a file or an open fd and refactor tracing code.
  Replace uses of strdup with xstrdup.
  consolidate two copies of new style object header parsing code.
  Documentation: Fix howto/revert-branch-rebase.html generation
  fmt-merge-msg: fix off-by-one bug
  git-rev-list(1): group options; reformat; document more options
  Constness tightening for move/link_temp_to_file()
  gitweb: Fix git_blame
  Include config.mak.autogen in the doc Makefile
  Use xmalloc instead of malloc
  git(7): move gitk(1) to the list of porcelain commands
  gitk: Fix some bugs in the new cherry-picking code
  gitk: Improve responsiveness while reading and layout out the graph
  gitk: Update preceding/following tag info when creating a tag
  gitk: Add a menu item for cherry-picking commits
  gitk: Fix a couple of buglets in the branch head menu items
  gitk: Add a context menu for heads
  gitk: Add a row context-menu item for creating a new branch
  gitk: Recompute ancestor/descendent heads/tags when rereading refs
  gitk: Minor cleanups
2006-09-02 17:10:16 -07:00
Christian Couder 6ce4e61f1b Trace into a file or an open fd and refactor tracing code.
If GIT_TRACE is set to an absolute path (starting with a
'/' character), we interpret this as a file path and we
trace into it.

Also if GIT_TRACE is set to an integer value greater than
1 and lower than 10, we interpret this as an open fd value
and we trace into it.

Note that this behavior is not compatible with the
previous one.

We also trace whole messages using one write(2) call to
make sure messages from processes do net get mixed up in
the middle.

This patch makes it possible to get trace information when
running "make test".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-02 14:47:53 -07:00
Shawn Pearce 9befac470b Replace uses of strdup with xstrdup.
Like xmalloc and xrealloc xstrdup dies with a useful message if
the native strdup() implementation returns NULL rather than a
valid pointer.

I just tried to use xstrdup in new code and found it to be missing.
However I expected it to be present as xmalloc and xrealloc are
already commonly used throughout the code.

[jc: removed the part that deals with last_XXX, which I am
 finding more and more dubious these days.]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-02 03:24:37 -07:00
Junio C Hamano ad1ed5ee89 consolidate two copies of new style object header parsing code.
Also while we are at it, remove redundant typename[] array from
unpack_sha1_header.  The only reason it is different from the
type_names[] array in object.c module is that this code cares
about the subset of object types that are valid in a loose
object, so prepare a separate array of boolean that tells us
which types are valid, and share the name translation with the
others.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-01 15:17:01 -07:00
Sergey Vlasov 501524e938 Documentation: Fix howto/revert-branch-rebase.html generation
The rule for howto/*.html used "$?", which expands to the list of all
newer prerequisites, including asciidoc.conf added by another rule.
"$<" should be used instead.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-01 12:41:34 -07:00
Johannes Schindelin af04b12710 fmt-merge-msg: fix off-by-one bug
Thanks to the recent malloc()->xmalloc() change, and XMALLOC_POISON, this bug
was found.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-01 05:20:03 -07:00
Jonas Fonseca 8c02eee29e git-rev-list(1): group options; reformat; document more options
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-01 05:19:45 -07:00
Junio C Hamano 0f2ca9d5c9 Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Fix some bugs in the new cherry-picking code
  gitk: Improve responsiveness while reading and layout out the graph
  gitk: Update preceding/following tag info when creating a tag
  gitk: Add a menu item for cherry-picking commits
  gitk: Fix a couple of buglets in the branch head menu items
  gitk: Add a context menu for heads
  gitk: Add a row context-menu item for creating a new branch
  gitk: Recompute ancestor/descendent heads/tags when rereading refs
  gitk: Minor cleanups
2006-09-01 00:54:01 -07:00
Junio C Hamano 839837b953 Constness tightening for move/link_temp_to_file()
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-01 00:24:06 -07:00
Aneesh Kumar K.V 1d3fc68ae7 gitweb: Fix git_blame
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 21:10:17 -07:00
Jonas Fonseca 95676853b2 Include config.mak.autogen in the doc Makefile
... to install documentation relative to the path set with configure's
--prefix option.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 16:24:40 -07:00
Jonas Fonseca 2d7320d0b0 Use xmalloc instead of malloc
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 16:24:39 -07:00
Jonas Fonseca ef1186228d git(7): move gitk(1) to the list of porcelain commands
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 16:24:30 -07:00
Christian Couder 7cf67205ca Trace into open fd and refactor tracing code.
Now if GIT_TRACE is set to an integer value greater than 1
and lower than 10, we interpret this as an open fd value
and we trace into it. Note that this behavior is not
compatible with the previous one.

We also trace whole messages using one write(2) call to
make sure messages from processes do net get mixed up in
the middle.

It's now possible to run the tests like this:

	GIT_TRACE=9 make test 9>/var/tmp/trace.log

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 14:16:38 -07:00
Junio C Hamano 2c6d22df9f t5710: fix two thinkos.
The intention of the test seems to be to build a long chain of
clones that locally borrow objects from their parents and see the
system give up dereferencing long chains.  There were two problems:

 (1) it did not test the right repository;
 (2) it did not build a chain long enough to trigger the limitation.

I do not think it is a good test to make sure the limitation the
current implementation happens to have still exists, but that is
a topic at a totally different level.

At least this fixes the broken test.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 14:16:09 -07:00
Junio C Hamano 1efca00ad8 Merge early part of branch 'jc/daemon' 2006-08-31 13:00:39 -07:00
Jakub Narebski 0edcb37d67 gitweb: Extend parse_difftree_raw_line to save commit info
Extend parse_difftree_raw_line to save commit info from when
git-diff-tree is given only one <tree-ish>, for example when fed
from git-rev-list using --stdin option.

git-diff-tree outputs a line with the commit ID when applicable.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 12:58:31 -07:00
Jakub Narebski fa702003e4 gitweb: Separate printing of git_tree row into git_print_tree_entry
This is preparation for "tree blame" (similar to what ViewVC shows)
output, i.e. for each entry give commit where it was changed.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 12:58:07 -07:00
Jakub Narebski cb849b46ac gitweb: Move git-ls-tree output parsing to parse_ls_tree_line
Add new subroutine parse_ls_tree_line and use it in git_tree.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 12:57:52 -07:00
Dennis Stosberg 4b5dc988c0 use do() instead of require() to include configuration
When run under mod_perl, require() will read and execute the configuration
file on the first invocation only.  On every subsequent invocation, all
configuration variables will be reset to their default values.  do() reads
and executes the configuration file unconditionally.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 12:57:08 -07:00
Dennis Stosberg 3a36bc8469 gitweb: Remove forgotten call to git_to_hash
On Aug 27th, Jakub Narebski sent a patch which removed the git_to_hash()
function and this call to it. The patch did not apply cleanly and had to
be applied manually. Removing the last chunk has obviously been forgotten.

See: commit  0aea33762b and
     message <200608272345.26722.jnareb@gmail.com>

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 12:48:37 -07:00
Franck Bui-Huu fc1c75ec74 log-tree.c: cleanup a bit append_signoff()
This patch clean up append_signoff() by moving specific code that
looks up for "^[-A-Za-z]+: [^@]+@" pattern into a function.

It also stops the primary search when the cursor oversteps
'buf + at' limit.

This patch changes slightly append_signoff() behaviour too. If we
detect any Signed-off-by pattern during the primary search, we
needn't to do a pattern research after.

Signed-off-by: Franck Bui-Huu <vagabon.xyz@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-30 00:19:42 -07:00
Johannes Schindelin 28f5c70b85 Remove uneeded #include
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-29 14:28:41 -07:00
Johannes Schindelin 104ff34a74 Makefile: fix typo
We checked NO_SETENV instead of NO_UNSETENV to decide if unsetenv
is available.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-29 14:26:14 -07:00
Johannes Schindelin c9b0597d3d unpack-objects: remove unused variable "eof"
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-29 14:26:04 -07:00
Linus Torvalds 071fa89e25 git-fsck-objects: lacking default references should not be fatal
The comment added says it all: if we have lost all references in a git
archive, git-fsck-objects should still work, so instead of dying it should
just notify the user about that condition.

This change was triggered by me just doing a "git-init-db" and then
populating that empty git archive with a pack/index file to look at it.
Having git-fsck-objects not work just because I didn't have any references
handy was rather irritating, since part of the reason for running
git-fsck-objects in the first place was to _find_ the missing references.

However, "--unreachable" really doesn't make sense in that situation, and
we want to turn it off to protect anybody who uses the old "git prune"
shell-script (rather than the modern built-in). The old pruning script
used to remove all objects that were reported as unreachable, and without
any refs, that obviously means everything - not worth it.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-29 11:56:39 -07:00
Matthias Kestenholz 9e84801396 Check if pack directory exists prior to descending into it
This fixes the following warning:

git-repack: line 42: cd: .git/objects/pack: No such file or directory

This happens only, when git-repack -a is run without any packs in the
repository.

Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-29 02:17:15 -07:00
Jakub Narebski a44465ccd9 gitweb: Add local time and timezone to git_print_authorship
Add local time (hours and minutes) and local timezone to the output of
git_print_authorship command, used by git_commitdiff.  The code was
taken from git_commit subroutine.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-28 16:44:14 -07:00
Jakub Narebski b4657e7759 gitweb: Add diff tree, with links to patches, to commitdiff view
Added/uncommented git_difftree_body invocation in git_commitdiff.
Added anchors (via 'id' attribute) to patches in patchset.
git_difftree_body is modified to link to patch anchor when called from
git_commitdiff, instead of link to blobdiff.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-28 16:21:35 -07:00
Jakub Narebski fba20b429a gitweb: git_print_log: signoff line is non-empty line
This correct minor error in git_print_log that didn't add final empty
line when requested, if commit log ended with signoff.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-28 16:21:35 -07:00
Jakub Narebski 6fd92a28eb gitweb: Add author information to commitdiff view
Add subroutine git_print_authorship to print author and date of
commit, div.author_date style to CSS, and use them in git_commitdiff.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-28 16:21:34 -07:00
Jakub Narebski d50a9398fe gitweb: Do not remove signoff lines in git_print_simplified_log
Remove '-remove_signoff => 1' option to git_print_log call in the
git_print_simplified_log subroutine.  This means that in "log" and
"commitdiff" views (git_log and git_commitdiff subroutines) signoff
lines will be shown.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-28 16:21:34 -07:00
Jakub Narebski b7f9253df9 gitweb: Make git_print_log generic; git_print_simplified_log uses it
Collapse git_print_log and git_print_simplified_log into one
subroutine git_print_log.  git_print_simplified_log now simply calls
git_print_log with proper options.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-28 16:21:34 -07:00
Dennis Stosberg 25691fbe6d gitweb: Use --git-dir parameter instead of setting $ENV{'GIT_DIR'}
This makes it possible to run gitweb under mod_perl's Apache::Registry.

It needs a fairly new git version, with --git-dir=<path>
parameter to git wrapper, i.e. post v1.4.2-rc2-g6acbcb9 version.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-28 16:21:34 -07:00
Jonas Fonseca 3dfb9278df Add --relative-date option to the revision interface
Exposes the infrastructure from 9a8e35e987.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-28 16:20:33 -07:00
Junio C Hamano b17fda5c07 Merge branch 'gl/web'
* gl/web: (46 commits)
  gitweb: Use @diff_opts, default ('M'), as git-diff and git-diff-tree paramete
  gitweb: Remove git_to_hash function
  gitweb: Remove unused git_get_{preceding,following}_references
  gitweb: Fix typo in git_patchset_body
  gitweb: Fix typo in git_difftree_body
  gitweb: blobs defined by non-textual hash ids can be cached
  gitweb: Improve comments about gitweb features configuration
  gitweb: Remove workaround for git-diff bug fixed in f82cd3c
  gitweb: Remove creating directory for temporary files
  gitweb: Remove git_diff_print subroutine
  gitweb: git_blobdiff_plain is git_blobdiff('plain')
  gitweb: Use git-diff-tree or git-diff patch output for blobdiff
  gitweb: Change here-doc back for style consistency in git_blobdiff
  gitweb: Always display link to blobdiff_plain in git_blobdiff
  gitweb: Add invisible hyperlink to from-file/to-file diff header
  gitweb: Parse two-line from-file/to-file diff header in git_patchset_body
  gitweb: Allow for pre-parsed difftree info in git_patchset_body
  gitweb: Add support for hash_parent_base parameter for blobdiffs
  gitweb: Use git_get_name_rev_tags for commitdiff_plain X-Git-Tag: header
  gitweb: Add git_get_rev_name_tags function
  ...
2006-08-28 16:20:28 -07:00
Paul Mackerras 561d038ab8 gitk: Fix some bugs in the new cherry-picking code
When inserting the new commit row for the cherry-picked commit, we weren't
advancing the selected line (if there is one), and we weren't updating
commitlisted properly.
2006-08-28 22:41:09 +10:00
Junio C Hamano d819e4e682 daemon: prepare for multiple services.
This adds an infrastructure to selectively enable and disable
more than one services in git-daemon.  Currently upload-pack
service, which serves the git-fetch-pack and git-peek-remote
clients, is the only service that is defined.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-27 23:32:36 -07:00
Rene Scharfe 370e0966ef Add git-zip-tree to .gitignore
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-27 23:32:07 -07:00
Junio C Hamano 4cac42b132 free(NULL) is perfectly valid.
Jonas noticed some places say "if (X) free(X)" which is totally
unnecessary.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-27 21:19:39 -07:00
Jonas Fonseca b3c952f838 Use xcalloc instead of calloc
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-27 20:49:43 -07:00
Jonas Fonseca c470701a98 Use fstat instead of fseek
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-27 20:49:35 -07:00
Junio C Hamano 5ff9d11409 Merge branch 'gl/cleanup-next'
* gl/cleanup-next:
  hashcpy/hashcmp remaining bits.
  Convert memcpy(a,b,20) to hashcpy(a,b).
2006-08-27 20:34:09 -07:00
Junio C Hamano 1e49cb8ad4 Merge branch 'js/c-merge-recursive'
* js/c-merge-recursive: (21 commits)
  discard_cache(): discard index, even if no file was mmap()ed
  merge-recur: do not die unnecessarily
  merge-recur: try to merge older merge bases first
  merge-recur: if there is no common ancestor, fake empty one
  merge-recur: do not setenv("GIT_INDEX_FILE")
  merge-recur: do not call git-write-tree
  merge-recursive: fix rename handling
  .gitignore: git-merge-recur is a built file.
  merge-recur: virtual commits shall never be parsed
  merge-recur: use the unpack_trees() interface instead of exec()ing read-tree
  merge-recur: fix thinko in unique_path()
  Makefile: git-merge-recur depends on xdiff libraries.
  merge-recur: Explain why sha_eq() and struct stage_data cannot go
  merge-recur: Cleanup last mixedCase variables...
  merge-recur: Fix compiler warning with -pedantic
  merge-recur: Remove dead code
  merge-recur: Get rid of debug code
  merge-recur: Convert variable names to lower_case
  Cumulative update of merge-recursive in C
  recur vs recursive: help testing without touching too many stuff.
  ...

This is an evil merge that removes TEST script from the toplevel.
2006-08-27 20:33:46 -07:00
Junio C Hamano d5d0a0e748 Merge branch 'ts/daemon'
* ts/daemon:
  Added support for dropping privileges to git-daemon.
2006-08-27 17:51:42 -07:00
Junio C Hamano b32d37a3a6 Merge branch 'jc/apply'
* jc/apply:
  git-apply --reject: finishing touches.
  apply --reject: count hunks starting from 1, not 0
  git-apply --verbose
  git-apply --reject: send rejects to .rej files.
  git-apply --reject
  apply --reverse: tie it all together.
  diff.c: make binary patch reversible.
  builtin-apply --reverse: two bugfixes.
2006-08-27 17:51:05 -07:00
Junio C Hamano 8938045a4e git-apply --reject: finishing touches.
After a failed "git am" attempt:

	git apply --reject --verbose .dotest/patch

applies hunks that are applicable and leaves *.rej files the
rejected hunks, and it reports what it is doing.  With --index,
files with a rejected hunk do not get their index entries
updated at all, so "git diff" will show the hunks that
successfully got applied.

Without --verbose to remind the user that the patch updated some
other paths cleanly, it is very easy to lose track of the status
of the working tree, so --reject implies --verbose.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-27 15:53:20 -07:00