git.git
18 years agoUse xcalloc instead of calloc
Jonas Fonseca [Mon, 28 Aug 2006 00:26:07 +0000 (02:26 +0200)]
Use xcalloc instead of calloc

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoUse fstat instead of fseek
Jonas Fonseca [Sun, 27 Aug 2006 23:55:46 +0000 (01:55 +0200)]
Use fstat instead of fseek

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'gl/cleanup-next'
Junio C Hamano [Mon, 28 Aug 2006 03:34:09 +0000 (20:34 -0700)]
Merge branch 'gl/cleanup-next'

* gl/cleanup-next:
  hashcpy/hashcmp remaining bits.
  Convert memcpy(a,b,20) to hashcpy(a,b).

18 years agoMerge branch 'js/c-merge-recursive'
Junio C Hamano [Mon, 28 Aug 2006 03:18:58 +0000 (20:18 -0700)]
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.

18 years agoMerge branch 'ts/daemon'
Junio C Hamano [Mon, 28 Aug 2006 00:51:42 +0000 (17:51 -0700)]
Merge branch 'ts/daemon'

* ts/daemon:
  Added support for dropping privileges to git-daemon.

18 years agoMerge branch 'jc/apply'
Junio C Hamano [Mon, 28 Aug 2006 00:51:05 +0000 (17:51 -0700)]
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.

18 years agogit-apply --reject: finishing touches.
Junio C Hamano [Sun, 27 Aug 2006 22:53:20 +0000 (15:53 -0700)]
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>
18 years agogit-reset: remove unused variable
Rene Scharfe [Sun, 27 Aug 2006 11:19:58 +0000 (13:19 +0200)]
git-reset: remove unused variable

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-cherry: remove unused variable
Rene Scharfe [Sun, 27 Aug 2006 11:19:45 +0000 (13:19 +0200)]
git-cherry: remove unused variable

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoRelative timestamps in git log
Linus Torvalds [Sat, 26 Aug 2006 22:45:26 +0000 (15:45 -0700)]
Relative timestamps in git log

I noticed that I was looking at the kernel gitweb output at some point
rather than just do "git log", simply because I liked seeing the
simplified date-format, ie the "5 days ago" rather than a full date.

This adds infrastructure to do that for "git log" too. It does NOT add the
actual flag to enable it, though, so right now this patch is a no-op, but
it should now be easy to add a command line flag (and possibly a config
file option) to just turn on the "relative" date format.

The exact cut-off points when it switches from days to weeks etc are
totally arbitrary, but are picked somewhat to avoid the "1 weeks ago"
thing (by making it show "10 days ago" rather than "1 week", or "70
minutes ago" rather than "1 hour ago").

[jc: with minor fix and tweak around "month" and "week" area.]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoAdd git-zip-tree
Rene Scharfe [Sat, 26 Aug 2006 21:19:21 +0000 (23:19 +0200)]
Add git-zip-tree

In the Windows world ZIP files are better supported than tar files.
Windows even includes built-in support for ZIP files nowadays.

git-zip-tree is similar to git-tar-tree; it creates ZIP files out of
git trees.  It stores the commit ID (if available) in a ZIP file comment
which can be extracted by unzip.

There's still quite some room for improvement: this initial version
supports no symlinks, calls write() way too often (three times per file)
and there is no unit test.

[jc: with a minor typefix to avoid void* arithmetic]

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-svn: stop repeatedly reusing the first commit message with dcommit
Eric Wong [Sat, 26 Aug 2006 16:52:25 +0000 (09:52 -0700)]
git-svn: stop repeatedly reusing the first commit message with dcommit

Excessive use of global variables got me into trouble.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoUse xrealloc instead of realloc
Jonas Fonseca [Sat, 26 Aug 2006 14:16:18 +0000 (16:16 +0200)]
Use xrealloc instead of realloc

Change places that use realloc, without a proper error path, to instead use
xrealloc. Drop an erroneous error path in the daemon code that used errno
in the die message in favour of the simpler xrealloc.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoUse PATH_MAX instead of MAXPATHLEN
Jonas Fonseca [Sat, 26 Aug 2006 14:09:17 +0000 (16:09 +0200)]
Use PATH_MAX instead of MAXPATHLEN

According to sys/paramh.h it's a "BSD name" for values defined in
<limits.h>. Besides PATH_MAX seems to be more commonly used.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoConvert unpack_entry_gently and friends to use offsets.
Shawn Pearce [Sat, 26 Aug 2006 08:12:27 +0000 (04:12 -0400)]
Convert unpack_entry_gently and friends to use offsets.

Change unpack_entry_gently and its helper functions to use offsets
rather than addresses and left counts to supply pack position
information.  In most cases this makes the code easier to follow,
and it reduces the number of local variables in a few functions.
It also better prepares this code for mapping partial segments of
packs and altering what regions of a pack are mapped while unpacking
an entry.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoCleanup unpack_object_header to use only offsets.
Shawn Pearce [Sat, 26 Aug 2006 08:12:04 +0000 (04:12 -0400)]
Cleanup unpack_object_header to use only offsets.

If we're always incrementing both the offset and the pointer we
aren't gaining anything by keeping both.  Instead just use the
offset since that's what we were given and what we are expected
to return.  Also using offset is likely to make it easier to remap
the pack in the future should partial mapping of very large packs
get implemented.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoCleanup unpack_entry_gently and friends to use type_name array.
Shawn Pearce [Sat, 26 Aug 2006 08:11:36 +0000 (04:11 -0400)]
Cleanup unpack_entry_gently and friends to use type_name array.

[PATCH 3/5] Cleanup unpack_entry_gently and friends to use type_name array.

This change allows combining all of the non-delta entries into a
single case, as well as to remove an unnecessary local variable
in unpack_entry_gently.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoReuse compression code in unpack_compressed_entry.
Shawn Pearce [Sat, 26 Aug 2006 08:11:02 +0000 (04:11 -0400)]
Reuse compression code in unpack_compressed_entry.

[PATCH 2/5] Reuse compression code in unpack_compressed_entry.

This cleans up the code by reusing a perfectly good decompression
implementation at the expense of 1 extra byte of memory allocated in
temporary memory while the delta is being decompressed and applied
to the base.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoReorganize/rename unpack_non_delta_entry to unpack_compressed_entry.
Shawn Pearce [Sat, 26 Aug 2006 08:10:43 +0000 (04:10 -0400)]
Reorganize/rename unpack_non_delta_entry to unpack_compressed_entry.

This function was moved above unpack_delta_entry so we can call it
from within unpack_delta_entry without a forward declaration.

This change looks worse than it is.  Its really just a relocation
of unpack_non_delta_entry to earlier in the file and renaming the
function to unpack_compressed_entry.  No other changes were made.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'gl/cleanup'
Junio C Hamano [Sat, 26 Aug 2006 08:06:22 +0000 (01:06 -0700)]
Merge branch 'gl/cleanup'

* gl/cleanup:
  Convert memset(hash,0,20) to hashclr(hash).
  Convert memcpy(a,b,20) to hashcpy(a,b).

18 years agogitweb: git_annotate didn't expect negative numeric timezone
Jakub Narebski [Sat, 26 Aug 2006 00:13:05 +0000 (02:13 +0200)]
gitweb: git_annotate didn't expect negative numeric timezone

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-svn: add the 'dcommit' command
Eric Wong [Sat, 26 Aug 2006 07:01:23 +0000 (00:01 -0700)]
git-svn: add the 'dcommit' command

This is a high-level wrapper around the 'commit-diff' command
and used to produce cleaner history against the mirrored repository
through rebase/reset usage.

It's basically a more polished version of this:

for i in `git rev-list --no-merges remotes/git-svn..HEAD | tac`; do
git-svn commit-diff $i~1 $i
done
git reset --hard remotes/git-svn

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-svn: recommend rebase for syncing against an SVN repo
Eric Wong [Fri, 25 Aug 2006 19:48:23 +0000 (12:48 -0700)]
git-svn: recommend rebase for syncing against an SVN repo

Does this make sense to other git-svn users out there?

pull can give funky history unless you understand how git-svn works
internally, which users should not be expected to do.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-svn: establish new connections on commit after fork
Eric Wong [Fri, 25 Aug 2006 19:28:18 +0000 (12:28 -0700)]
git-svn: establish new connections on commit after fork

SVN seems to have a problem with https:// repositories from
time-to-time when doing multiple, sequential commits.  This
problem is not consistently reproducible without the patch,
but it should go away entirely with this patch...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agodescribe: fix off-by-one error in --abbrev=40 handling
Jonas Fonseca [Fri, 25 Aug 2006 00:48:04 +0000 (02:48 +0200)]
describe: fix off-by-one error in --abbrev=40 handling

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-svn(1): improve asciidoc markup
Jonas Fonseca [Fri, 25 Aug 2006 01:07:46 +0000 (03:07 +0200)]
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>
18 years agogitview.txt: improve asciidoc markup
Jonas Fonseca [Fri, 25 Aug 2006 01:06:50 +0000 (03:06 +0200)]
gitview.txt: improve asciidoc markup

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit(7): put the synopsis in a verse style paragraph
Jonas Fonseca [Fri, 25 Aug 2006 01:05:48 +0000 (03:05 +0200)]
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>
18 years agogitk(1): expand the manpage to look less like a template
Jonas Fonseca [Fri, 25 Aug 2006 01:04:58 +0000 (03:04 +0200)]
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>
18 years agogit-blame(1): mention options in the synopsis and advertise pickaxe
Jonas Fonseca [Fri, 25 Aug 2006 01:01:49 +0000 (03:01 +0200)]
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>
18 years agogit-ls-remote(1): document --upload-pack
Jonas Fonseca [Fri, 25 Aug 2006 00:58:20 +0000 (02:58 +0200)]
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>
18 years agogit-apply(1): document missing options and improve existing ones
Jonas Fonseca [Fri, 25 Aug 2006 00:56:55 +0000 (02:56 +0200)]
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>
18 years agoupdate-index -g
Junio C Hamano [Thu, 24 Aug 2006 04:24:47 +0000 (21:24 -0700)]
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>
18 years agon is in fact unused, and is later shadowed.
Pierre Habouzit [Wed, 23 Aug 2006 10:39:16 +0000 (12:39 +0200)]
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>
18 years agouse name[len] in switch directly, instead of creating a shadowed variable.
Pierre Habouzit [Wed, 23 Aug 2006 10:39:15 +0000 (12:39 +0200)]
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>
18 years agobuiltin-grep.c: remove unused debugging piece.
Junio C Hamano [Thu, 24 Aug 2006 01:39:49 +0000 (18:39 -0700)]
builtin-grep.c: remove unused debugging piece.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoremove ugly shadowing of loop indexes in subloops.
Pierre Habouzit [Wed, 23 Aug 2006 10:39:13 +0000 (12:39 +0200)]
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>
18 years agomissing 'static' keywords
Pierre Habouzit [Wed, 23 Aug 2006 10:39:12 +0000 (12:39 +0200)]
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>
18 years agogit_dir holds pointers to local strings, hence MUST be const.
Pierre Habouzit [Wed, 23 Aug 2006 10:39:11 +0000 (12:39 +0200)]
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>
18 years agoavoid to use error that shadows the function name, use err instead.
Pierre Habouzit [Wed, 23 Aug 2006 10:39:10 +0000 (12:39 +0200)]
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>
18 years agohashcpy/hashcmp remaining bits.
Junio C Hamano [Wed, 23 Aug 2006 21:31:20 +0000 (14:31 -0700)]
hashcpy/hashcmp remaining bits.

This fixes up merge-recursive.c for hashcpy/hashcmp changes.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoConvert memcpy(a,b,20) to hashcpy(a,b).
Shawn Pearce [Wed, 23 Aug 2006 06:49:00 +0000 (02:49 -0400)]
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>
18 years agoMerge branch 'gl/cleanup' into gl/cleanup-next
Junio C Hamano [Wed, 23 Aug 2006 21:18:24 +0000 (14:18 -0700)]
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"
  ...

18 years agoConvert memset(hash,0,20) to hashclr(hash).
Junio C Hamano [Wed, 23 Aug 2006 20:57:23 +0000 (13:57 -0700)]
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>
18 years agoConvert memcpy(a,b,20) to hashcpy(a,b).
Shawn Pearce [Wed, 23 Aug 2006 06:49:00 +0000 (02:49 -0400)]
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>
18 years agoFix a comparison bug in diff-delta.c
Pierre Habouzit [Wed, 23 Aug 2006 09:17:55 +0000 (11:17 +0200)]
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>
18 years agogit-send-email: Don't set author_not_sender from Cc: lines
Haavard Skinnemoen [Wed, 23 Aug 2006 10:02:59 +0000 (03:02 -0700)]
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>
18 years agoAdded support for dropping privileges to git-daemon.
Tilman Sauerbeck [Tue, 22 Aug 2006 17:37:41 +0000 (19:37 +0200)]
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>
18 years agoapply --reject: count hunks starting from 1, not 0
Junio C Hamano [Tue, 22 Aug 2006 22:49:28 +0000 (15:49 -0700)]
apply --reject: count hunks starting from 1, not 0

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoRemove unnecessary forward declaration of unpack_entry.
Shawn Pearce [Mon, 21 Aug 2006 07:10:36 +0000 (03:10 -0400)]
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>
18 years agoVerify we know how to read a pack before trying to using it.
Shawn Pearce [Mon, 21 Aug 2006 07:10:02 +0000 (03:10 -0400)]
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>
18 years agoAdd write_or_die(), a helper function
Rene Scharfe [Mon, 21 Aug 2006 18:43:43 +0000 (20:43 +0200)]
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>
18 years agoAxe the last ent
Rene Scharfe [Mon, 21 Aug 2006 18:11:48 +0000 (20:11 +0200)]
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>
18 years agoMerge branch 'maint'
Junio C Hamano [Mon, 21 Aug 2006 21:16:38 +0000 (14:16 -0700)]
Merge branch 'maint'

* maint:
  builtin-mv: readability patch
  git-mv: fix off-by-one error
  git-mv: special case destination "."

18 years agobuiltin-mv: readability patch
Johannes Schindelin [Sat, 19 Aug 2006 14:52:21 +0000 (16:52 +0200)]
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>
18 years agogit-mv: fix off-by-one error
Johannes Schindelin [Mon, 21 Aug 2006 20:22:25 +0000 (22:22 +0200)]
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>
18 years agogit-mv: special case destination "."
Johannes Schindelin [Fri, 18 Aug 2006 10:42:39 +0000 (12:42 +0200)]
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>
18 years agobuiltin-mv: readability patch
Johannes Schindelin [Sat, 19 Aug 2006 14:52:21 +0000 (16:52 +0200)]
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>
18 years agogit-apply --verbose
Junio C Hamano [Fri, 18 Aug 2006 10:14:48 +0000 (03:14 -0700)]
git-apply --verbose

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-apply --reject: send rejects to .rej files.
Junio C Hamano [Fri, 18 Aug 2006 10:10:19 +0000 (03:10 -0700)]
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>
18 years agoIndentation fix.
Tilman Sauerbeck [Thu, 17 Aug 2006 18:44:16 +0000 (20:44 +0200)]
Indentation fix.

Signed-off-by: Tilman Sauerbeck <tilman@code-monkey.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDo not use memcmp(sha1_1, sha1_2, 20) with hardcoded length.
David Rientjes [Thu, 17 Aug 2006 18:54:57 +0000 (11:54 -0700)]
Do not use memcmp(sha1_1, sha1_2, 20) with hardcoded length.

Introduces global inline:

hashcmp(const unsigned char *sha1, const unsigned char *sha2)

Uses memcmp for comparison and returns the result based on the length of
the hash name (a future runtime decision).

Acked-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: Uniquify version info output, add meta generator in page header
Jakub Narebski [Thu, 17 Aug 2006 09:21:28 +0000 (11:21 +0200)]
gitweb: Uniquify version info output, add meta generator in page header

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-apply --reject
Junio C Hamano [Thu, 17 Aug 2006 00:55:29 +0000 (17:55 -0700)]
git-apply --reject

With the new flag "--reject", hunks that do not apply are sent to
the standard output, and the usable hunks are applied.  The command
itself exits with non-zero status when this happens, so that the
user or wrapper can take notice and sort the remaining mess out.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoapply --reverse: tie it all together.
Junio C Hamano [Wed, 16 Aug 2006 23:09:25 +0000 (16:09 -0700)]
apply --reverse: tie it all together.

Add a few tests, usage string, and documentation.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agodiff.c: make binary patch reversible.
Junio C Hamano [Wed, 16 Aug 2006 23:08:14 +0000 (16:08 -0700)]
diff.c: make binary patch reversible.

This matches the format previous "git-apply --reverse" update
expects.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agobuiltin-apply --reverse: two bugfixes.
Junio C Hamano [Wed, 16 Aug 2006 23:07:20 +0000 (16:07 -0700)]
builtin-apply --reverse: two bugfixes.

Parsing of a binary hunk did not consume the terminating blank
line.  When applying in reverse, it did not use the second,
reverse binary hunk.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'jc/format-patch'
Junio C Hamano [Thu, 17 Aug 2006 02:27:03 +0000 (19:27 -0700)]
Merge branch 'jc/format-patch'

* jc/format-patch:
  Add a newline before appending "Signed-off-by: " line

18 years agoBe nicer if git executable is not installed
Ville Skyttä [Wed, 16 Aug 2006 20:12:26 +0000 (23:12 +0300)]
Be nicer if git executable is not installed

This patch avoids problems if vc-git.el is installed and activated, but
the git executable is not available, for example
http://list-archive.xemacs.org/xemacs-beta/200608/msg00062.html

Signed-off-by: Ville Skyttä <scop@xemacs.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'jc/racy'
Junio C Hamano [Wed, 16 Aug 2006 21:00:34 +0000 (14:00 -0700)]
Merge branch 'jc/racy'

* jc/racy:
  Remove the "delay writing to avoid runtime penalty of racy-git avoidance"
  Add check program "git-check-racy"
  Documentation/technical/racy-git.txt
  avoid nanosleep(2)

18 years agoMerge branch 'maint'
Junio C Hamano [Wed, 16 Aug 2006 21:00:12 +0000 (14:00 -0700)]
Merge branch 'maint'

* maint:
  [PATCH] git-mv: add more path normalization

18 years agobuiltin-grep: remove unused debugging cruft.
Junio C Hamano [Wed, 16 Aug 2006 20:58:32 +0000 (13:58 -0700)]
builtin-grep: remove unused debugging cruft.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: Add support for per project git URLs
Jakub Narebski [Wed, 16 Aug 2006 12:50:34 +0000 (14:50 +0200)]
gitweb: Add support for per project git URLs

It is now possible for project to have individual clone/fetch URLs.
They are provided in new file 'cloneurl' added below project's
$GIT_DIR directory.

If there is no cloneurl file, concatenation of git base URLs with
project name is used.

This is merge of Jakub Narebski and David Rientjes
  gitweb: Show project's git URL on summary page
with Aneesh Kumar
  gitweb: Add support for cloneurl.
  gitweb: Support multiple clone urls
patches.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years ago[PATCH] git-mv: add more path normalization
Johannes Schindelin [Wed, 16 Aug 2006 08:44:02 +0000 (10:44 +0200)]
[PATCH] git-mv: add more path normalization

We already use the normalization from get_pathspec(), but now we also
remove a trailing slash. So,

git mv some_path/ into_some_path/

works now.

Also, move the "can not move directory into itself" test before the
subdirectory expansion.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoRemove the "delay writing to avoid runtime penalty of racy-git avoidance"
Junio C Hamano [Wed, 16 Aug 2006 04:40:43 +0000 (21:40 -0700)]
Remove the "delay writing to avoid runtime penalty of racy-git avoidance"

The work-around should not be needed.  Even if it turns out we
would want it later, git will remember the patch for us ;-).

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: consolidate action URL generation.
Martin Waitz [Tue, 15 Aug 2006 22:24:30 +0000 (00:24 +0200)]
gitweb: consolidate action URL generation.

Use the href() function instead of string concatenation to generate
most URLs to our own CGI.
This is a work in progress, not everything has been converted yet.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: provide function to format the URL for an action link.
Martin Waitz [Tue, 15 Aug 2006 22:23:50 +0000 (00:23 +0200)]
gitweb: provide function to format the URL for an action link.

Provide a new function which can be used to generate an URL for the CGI.
This makes it possible to consolidate the URL generation in order to make
it easier to change the encoding of actions into URLs.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitweb: Show project's git URL on summary page
Jakub Narebski [Tue, 15 Aug 2006 21:03:17 +0000 (23:03 +0200)]
gitweb: Show project's git URL on summary page

From 31e4de9f22a3b17d4ad0ac800132e4e1a0a15006 Mon Sep 17 00:00:00 2001
From: David Rientjes <rientjes@google.com>
Date: Tue, 15 Aug 2006 11:43:04 -0700
Subject: [PATCH] gitweb: Show project's git URL on summary page

Add support for showing multiple clone/fetch git URLs for project on
a summary page. URL for project is created from base URL and project
name.

For example for XMMS2 project (xmms.se) the git base URL would be
git://git.xmms.se/xmms2.

With corrections from David Rientjes <rientjes@google.com>

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoAdd check program "git-check-racy"
Junio C Hamano [Wed, 16 Aug 2006 04:38:07 +0000 (21:38 -0700)]
Add check program "git-check-racy"

This will help counting the racily clean paths, but it should be
useless for daily use.  Do not even enable it in the makefile.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/technical/racy-git.txt
Junio C Hamano [Tue, 15 Aug 2006 20:09:49 +0000 (13:09 -0700)]
Documentation/technical/racy-git.txt

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoremove unnecessary initializations
David Rientjes [Tue, 15 Aug 2006 17:23:48 +0000 (10:23 -0700)]
remove unnecessary initializations

[jc: I needed to hand merge the changes to the updated codebase,
 so the result needs to be checked.]

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge branch 'maint'
Junio C Hamano [Wed, 16 Aug 2006 04:15:32 +0000 (21:15 -0700)]
Merge branch 'maint'

* maint:
  finish_connect(): thinkofix
  git-mv: succeed even if source is a prefix of destination
  Solaris does not support C99 format strings before version 10

18 years agofinish_connect(): thinkofix
Junio C Hamano [Tue, 15 Aug 2006 23:28:08 +0000 (16:28 -0700)]
finish_connect(): thinkofix

All but one callers have ignore the return value from this
function, but the only caller, builtin-tar-tree.c::remote_tar(),
assumed it returns non-zero on failure and zero on success.  The
implementation however was returning either the waited pid
(which must be the same as its input) or -1 (an error).

Fix this thinko, while getting rid of an assignment of return
value from waitpid() into a variable of type int.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-mv: succeed even if source is a prefix of destination
Johannes Schindelin [Wed, 16 Aug 2006 00:20:32 +0000 (02:20 +0200)]
git-mv: succeed even if source is a prefix of destination

As noted by Fredrik Kuivinen, without this patch, git-mv fails on

git-mv README README-renamed

because "README" is a prefix of "README-renamed".

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agouse appropriate typedefs
David Rientjes [Tue, 15 Aug 2006 17:40:06 +0000 (10:40 -0700)]
use appropriate typedefs

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agomake inline is_null_sha1 global
David Rientjes [Tue, 15 Aug 2006 20:37:19 +0000 (13:37 -0700)]
make inline is_null_sha1 global

Replace sha1 comparisons to null_sha1 with a global inline (which previously an
unused static inline in builtin-apply.c)

[jc: with a fix from Jonas Fonseca.]

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoavoid nanosleep(2)
Junio C Hamano [Tue, 15 Aug 2006 10:39:47 +0000 (03:39 -0700)]
avoid nanosleep(2)

On Solaris nanosleep(2) is not available in libc; you need to
link with -lrt to get it.

The purpose of the loop is to wait until the next filesystem
timestamp granularity, and the code uses subsecond sleep in the
hope that it can shorten the delay to 0.5 seconds on average
instead of a full second.  It is probably not worth depending on
an extra library for this.

We might want to yank out the whole "racy-git avoidance is
costly later at runtime, so let's delay writing the index out"
codepath later, but that is a separate issue and needs some
testing on large trees to figure it out.  After playing with the
kernel tree, I have a feeling that the whole thing may not be
worth it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-apply --binary: clean up and prepare for --reverse
Junio C Hamano [Tue, 15 Aug 2006 09:23:06 +0000 (02:23 -0700)]
git-apply --binary: clean up and prepare for --reverse

This cleans up the implementation of "git-apply --binary", and
implements reverse application of binary patches (when git-diff
is converted to emit reversible binary patches).

Earlier, the types of encoding (either deflated literal or
deflated delta) were stored in is_binary field in struct patch,
which meant that we cannot store more than one fragment that
differ in the encoding for a patch.  This moves the information
to a field in struct fragment that is otherwise unused for
binary patches, and makes it possible to hang two (or more, but
two is enough) hunks for a binary patch.

The original "binary patch" output from git-diff is internally
parsed into an "is_binary" patch with one fragment.  Upcoming
reversible binary patch output will have two fragments, the
first one being the forward patch and the second one the reverse
patch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoFix detection of ipv6 on Solaris
Dennis Stosberg [Tue, 15 Aug 2006 09:01:27 +0000 (11:01 +0200)]
Fix detection of ipv6 on Solaris

The configuration script detects whether linking with -lsocket is
necessary but doesn't add -lsocket to LIBS.  This lets the ipv6 test
fail.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoLook for sockaddr_storage in sys/socket.h
Dennis Stosberg [Tue, 15 Aug 2006 09:01:25 +0000 (11:01 +0200)]
Look for sockaddr_storage in sys/socket.h

On Solaris and the BSDs the definition of "struct sockaddr_storage"
is not available from "netinet/in.h".  On Solaris "sys/socket.h" is
enough, at least OpenBSD needs "sys/types.h", too.

Using "sys/types.h" and "sys/socket.h" seems to be a more portable
way.

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoSolaris has strlcpy() at least since version 8
Dennis Stosberg [Tue, 15 Aug 2006 09:01:20 +0000 (11:01 +0200)]
Solaris has strlcpy() at least since version 8

See http://docs.sun.com/app/docs/doc/816-3321/6m9k23sjk?a=view

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoSolaris does not support C99 format strings before version 10
Dennis Stosberg [Tue, 15 Aug 2006 09:01:22 +0000 (11:01 +0200)]
Solaris does not support C99 format strings before version 10

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-apply --reverse: simplify reverse option.
Junio C Hamano [Tue, 15 Aug 2006 06:26:51 +0000 (23:26 -0700)]
git-apply --reverse: simplify reverse option.

Having is_reverse in each patch did not make sense.  This will hopefully
simplify the work needed to introduce reversible binary diff format.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agot4116 apply --reverse test
Junio C Hamano [Tue, 15 Aug 2006 06:24:55 +0000 (23:24 -0700)]
t4116 apply --reverse test

The binary patch test needs to be made more careful not to have
the postimage blob in the repository in which the patch is applied

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake sha1flush void and remove conditional return.
David Rientjes [Mon, 14 Aug 2006 20:32:01 +0000 (13:32 -0700)]
Make sha1flush void and remove conditional return.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake upload_pack void and remove conditional return.
David Rientjes [Mon, 14 Aug 2006 20:40:51 +0000 (13:40 -0700)]
Make upload_pack void and remove conditional return.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake track_tree_refs void.
David Rientjes [Mon, 14 Aug 2006 20:40:06 +0000 (13:40 -0700)]
Make track_tree_refs void.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake pack_objects void.
David Rientjes [Mon, 14 Aug 2006 20:38:50 +0000 (13:38 -0700)]
Make pack_objects void.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake fsck_dir void.
David Rientjes [Mon, 14 Aug 2006 20:36:18 +0000 (13:36 -0700)]
Make fsck_dir void.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake checkout_all void.
David Rientjes [Mon, 14 Aug 2006 20:20:12 +0000 (13:20 -0700)]
Make checkout_all void.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>