Commit graph

2742 commits

Author SHA1 Message Date
Junio C Hamano 2a1ddc58e4 git-sh-setup: move the repository check to a core program.
Any core commands that use setup_git_directory() now check if
given GIT_DIR is really a valid repository, so the same check in
git-sh-setup can use it without reimplementing it in shell.
This commit changes git-sh-setup to use git-var command for
that, although any other commands would do.

Note that we export GIT_DIR explicitly when calling git-var;
without it, the caller of this script would use GIT_DIR that we
return (which is to assume ./.git unless the caller has it
elsewhere) while git-var would go up to find a .git directory in
our parent directories, which would be checking a different
directory from what our callers will be using.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 15:55:50 -08:00
Junio C Hamano 5e7bfe2567 setup_git_directory: make sure GIT_DIR is a valid repository.
setup_git_directory() always trusted what the user told where
GIT_DIR was, and assumed that is a valid .git/ directory.  This
commit changes it to at least do the same level validation as
is_toplevel_directory() does -- has refs/, has objects/ unless
GIT_OBJECT_DIRECTORY is set, and has valid HEAD symlink or
symref.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 15:43:41 -08:00
Junio C Hamano 5d318ce6a9 git-var: make it work in subdirectory.
Use setup_git_directory() so that it can find its .git
directory.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 15:16:35 -08:00
Junio C Hamano ae2b0f1518 git-sh-setup: die if outside git repository.
Now all the users of this script detect its exit status and die,
complaining that it is outside git repository.  So move the code
that dies from all callers to git-sh-setup script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 13:49:17 -08:00
Junio C Hamano e8cc80d039 parse-remote and ls-remote clean-up.
There is no reason to use git-sh-setup from git-ls-remote.
git-parse-remote can help the caller to use .git/remotes
shortcut if it is run inside a git repository, but can still be
useful outside a git repositoryas long as the caller does not
use any shortcut.  Use "git-rev-parse --git-dir" to figure out
where the GIT_DIR is, instead of using git-sh-setup.

This also makes "git-ls-remote origin" to work from inside a
subdirectory of a git managed repository as a side effect.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 13:49:17 -08:00
Junio C Hamano f678dd180a Prevent "git-commit -a path1 path2..."
When you want to create a partial commit, giving -a by mistake
would ignore the given path.  Prevent it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 13:33:14 -08:00
Junio C Hamano 3a2f2bb354 config.c: avoid shadowing global.
This is purely cosmetic, but avoid shadowing "FILE *config_file"
global in git_config_set_multivar() function.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 11:10:49 -08:00
YOSHIFUJI Hideaki / 吉藤英明 874fbc3323 Fix a warning about unused value.
Fix a warning:
  git.c:276: warning: value computed is not used

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 03:38:41 -08:00
Andreas Ericsson 2c52a42dd7 cvsimport: Don't let local settings hinder cvs user-migration.
Avoid this by passing "--norc" to cvsps.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 03:38:18 -08:00
Johannes Schindelin ee72aeaf00 Rename git-config-set to git-repo-config
... and adjust all references.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-24 11:10:40 -08:00
Junio C Hamano a50b870aa1 diff-tree: teach single-commit diff-tree to honour grafts
We used to read the commit objects by hand and ignored the grafts.
Rewrite it using lookup_commit() API, to make it grafts-aware.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-23 22:25:55 -08:00
Junio C Hamano 9c20a47067 Teach update-index to read from ls-tree.
git-update-index --index-info can almost be usable to read from ls-tree
output to update the index (and not the working tree file) to HEAD commit,
but not quite.  It was designed to read from git-apply --index-info
output, and does not want " blob " in ls-tree output.  Accept that as well.

This lets us update "git-checkout <ent> <path>" that used to filter the
extra " blob " string out.  Noted by Luben.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-23 22:25:55 -08:00
Junio C Hamano b7884981f8 git-revert: make --edit default.
Revert always should explain why, so make --edit the default,
unless stdin is not a terminal.  If you really don't want to say
anything, you can say "git-revert --no-edit $commit", or if you
are really sick, you could also say "git-revert $commit </dev/null".
But please don't.

You can also say "git-cherry-pick --edit $commit".  Not editting
the commit log message is the default for cherry-pick.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-23 17:19:37 -08:00
Linus Torvalds 30c7bb249e Allow editing of a revert-message
I think all commit operations should allow editing of the message (ie we
should do this for merges too), but that's _particularly_ true of doing a
"git revert".

We should always explain why we needed to revert something.

This patch adds a "-e" or "--edit" flag to "git revert", although I
actually suspect it should be on by default (and we should have a
"--no-edit" flag to disable it, probably together with an automatic
disable if stdin isn't a terminal).

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-23 16:52:52 -08:00
Josef Weidendorfer 073dab137a Fix git-mv for moving directories with 1 file
This is fixed by putting the file into @changedfiles/@addedfiles,
and not the directory this file is in.

Additionally, this fixes the behavior for attempting to overwrite
a file with a directory, and gives a message for all cases where
overwriting is not possible (file->dir,dir->file,dir->dir).

Thanks for Alexander Litvinov for noting this problem.

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-23 16:51:26 -08:00
Junio C Hamano fbf8ac212c git-merge: make recursive the default strategy
git-pull invoked merge with recursive as the default strategy
for some time now; match it in the git-merge itself.  Also avoid
listing more than one strategy on default because we have only
one strategy that can resolve an octopus and we are already
counting heads here.  This reduces the need to stash away local
modifications.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-23 16:23:11 -08:00
Junio C Hamano b99a394cd1 pack-redundant: type cleanups.
Binary representation of object names are unsigned char[20], not
signed.  Also verbose output had %lu format printing size_t
without (unsigned long) cast other places already had, so match
that.  Using format %zu was suggested but might not be supported
as widely.

Noted by Morten Welinder, fixed with input from H. Peter Anvin
and Hideaki Yoshifuji.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-23 16:10:11 -08:00
Pavel Roskin 495473c08a [PATCH] gitk: UTF-8 support
Add gitencoding variable and set it to "utf-8".  Use it for converting
git-rev-list output.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-23 21:21:33 +11:00
Jeff Hobbs 2ed49d5424 [PATCH] gitk: put braces around exprs
This braces all exprs.  It just seemed to be a few that were missed.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-23 21:21:27 +11:00
Paul Serice c61642185d Fixed git:// IPv4 address problem when compiled with -DNO_IPV6.
Failure to dereference a pointer caused incorrect initialization of
the IPv4 address when calling connect() when compiled with -DNO_IPV6.

With this patch and yesterday's patch for git-daemon, it should now be
possible to use the native git protocol for both the client and server
on Cygwin.

Signed-off-by: Paul Serice <paul@serice.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-22 12:38:27 -08:00
Alex Riesen d1ab157759 arguments cleanup and some formatting
Signed-off-by: Alex Riesen <ariesen@harmanbecker.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-22 12:38:25 -08:00
Alex Riesen 2b6e34c1a3 remove unused variable
It is just assigned, nothing more.

Signed-off-by: Alex Riesen <ariesen@harmanbecker.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-22 12:38:23 -08:00
Alex Riesen 60435f68bb speedup allocation in pack-redundant.c
Reuse discarded nodes of llists

Signed-off-by: Alex Riesen <ariesen@harmanbecker.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-22 12:38:21 -08:00
Lukas Sandström bb931cf9d7 Make git-pack-redundant take a list of unimportant objs on stdin
This lets us do "git-fsck-objects --full --unreachable | cut -d ' ' -f3 |
git-pack-redundant --all", which will keep git-pack-redundant from keeping
packs just because they contain unreachable objects.

Also add some more --verbose output.

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-22 12:38:16 -08:00
Junio C Hamano 302ebfe521 Merge http://www.kernel.org/pub/scm/gitk/gitk 2005-11-22 01:55:15 -08:00
Junio C Hamano c7d77dab93 git-var: constness and globalness cleanup.
var.c::git_var read function did not have to return writable
strings; make it and the functions it points at return const char *
instead.

ident.c::get_ident() did not need to be global, so make it
static.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 23:44:35 -08:00
Junio C Hamano 9ce392f482 Move diff.renamelimit out of default configuration.
Otherwise we would end up linking all the unneeded stuff into git-daemon
only to link with git_default_config.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 23:00:50 -08:00
Luben Tuikov 07f9247722 max-count in terms of intersection
When a path designation is given, max-count counts the number
of commits therein (intersection), not globally.

This avoids the case where in case path has been inactive
for the last N commits, --max-count=N and path designation
at git-rev-list is given, would give no commits.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 21:50:00 -08:00
YOSHIFUJI Hideaki / 吉藤英明 c3df856842 GIT: Fix compilation error in connect.c
Fix compilation error for gcc-2.95.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 20:51:22 -08:00
Andreas Ericsson d6ebd2590c Introduce $(ALL_PROGRAMS) for 'all:' and 'install:' to operate on.
Remove $(SIMPLE_PROGRAMS) from $(PROGRAMS) so buildrules don't have
to be overridden.

Put $(SCRIPTS) with the other target-macros so it doesn't get lonely.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 16:37:58 -08:00
H. Peter Anvin 1b1480ff6a rename/copy score parsing updates.
Better variant, which handles stuff like "4.5%" and rejects
"192.168.0.1".  Additionally, make sure numbers are unsigned (I'm making
them unsigned long just for the hell of it), to make sure that
artificial wraparound scenarios don't cause harm.

	-hpa

[jc: with this, -M100 changes its meaning back to 10%.  People
wanting to say "pure renames only" should now say -M100% or
-M1.0; sounds a bit like an earthquake, but arguably things are
more consistent this way ;-)]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 14:54:33 -08:00
Paul Serice f35230fb11 git-daemon not listening when compiled with -DNO_IPV6
git-daemon was not listening when compiled with -DNO_IPV6.
socksetup() was not returning socket count when compiled with -DNO_IPV6.

Signed-off-by: Paul Serice <paul@serice.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 14:36:43 -08:00
Linus Torvalds ef07618fdd git-repack: Properly abort in corrupt repository
In a corrupt repository, git-repack produces a pack that does not
contain needed objects without complaining, and the result of this
combined with -d flag can be very painful -- e.g. a lossage of one
tree object can lead to lossage of blobs reachable only through that
tree.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 14:08:49 -08:00
Johannes Schindelin b17e659dd4 Allow hierarchical section names
A .git/config like follows becomes valid with this patch:

	[remote.junio]
		url = git://git.kernel.org/pub/scm/git/git.git
		pull = master:junio todo:todo +pu:pu

	[remote.ibook]
		url = ibook:git/
		pull = master:ibook
		push = master:quetzal

(This patch only does the ini file thing, git-fetch and friends still
ignore these values).

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 14:04:28 -08:00
Johannes Schindelin 3dd94e3b2e git-config-set: Properly terminate strings with '\0'
When a lowercase version of the key was generated, it was not
terminated. Strangely enough, it worked on Linux and macosx anyway.
Just cygwin barfed.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 14:04:22 -08:00
Junio C Hamano e814bc4d15 git-proxy updates.
This builds on top of the git-proxy mechanism Paul Collins did,
and updates its configuration mechanism.

 * GIT_PROXY_COMMAND environment variable is used as the
   catch-all fallback, as in the original.  This has not
   changed.

 * Renames proxy configuration variables to core.gitproxy; this
   has become a multi-value variable per list discussion, most
   notably from suggestion by Linus.

	[core]
	;# matches www.kernel.org as well
	gitproxy = netcatter for kernel.org
	gitproxy = netscatter for sample.xz
	gitproxy = none for mydomain.xz
	gitproxy = netcatter-default

   The values are command names, followed by an optional " for "
   and domainname; the first tail-match of the domainname
   determines which proxy command is used.  An entry without "
   for " matches any domain and can be used as the default.

   The command name "none" is special -- it tells the mechanism
   not to use any proxy command and use the native git://
   connection.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 13:48:58 -08:00
Paul Collins f801477645 proxy-command support for git://
Here is an updated patch that first looks for GIT_PROXY_COMMAND
in the environment and then git.proxycommand in the repository's
configuration file.  I have left the calling convention the same
argv[1] is the host and argv[2] is the port.

I've taken the hostname parsing verbatim from git_tcp_connect(),
so it should now support an explicit port number and whatever
that business with the square brackets is.  (Should I move this
to a helper function?)

Regarding internal vs. external hosts, the proxy command can
simply run netcat locally to internal hosts, so perhaps that is
sufficient.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 13:48:58 -08:00
Junio C Hamano ce335fe04f daemon: further tweaks.
- Do validation only on canonicalized paths
 - Run upload-pack with "." as repository argument

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 13:47:00 -08:00
Andreas Ericsson 4dbd135279 git-daemon support for user-relative paths.
Dropped a fair amount of reundant code in favour of the library code
in path.c

Added option --strict-paths with documentation, with backwards
compatibility for whitelist entries with symlinks.

Everything that worked earlier still works insofar as I have
remembered testing it.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 13:47:00 -08:00
Junio C Hamano aa7f412abf tutorial: setting up a tree for subsystem maintainers
The "copying over packs" step is to prevent the objects
available in upstream repository to get expanted in the
subsystem maintainer tree, and is still valid if the upstream
repository do not live on the same machine.  But if they are on
the same machine using objects/info/alternates is cleaner.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 13:42:55 -08:00
Junio C Hamano 9f70b80692 rename detection with -M100 means "exact renames only".
When the user is interested in pure renames, there is no point
doing the similarity scores.  This changes the score argument
parsing to special case -M100 (otherwise, it is a precision
scaled value 0 <= v < 1 and would mean 0.1, not 1.0 --- if you
do mean 0.1, you can say -M1), and optimizes the diffcore_rename
transformation to only look at pure renames in that case.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 12:21:24 -08:00
Junio C Hamano 88b5a74883 format-patch: fix two-argument special case, and make it easier to pick single commits
Luben Tuikov noticed that sometimes being able to say
'git-format-patch <commit>' to format the change a single commit
introduces relative to its parent is handy.

This patch does not support that directly, but it makes sense to
interpret a single argument "rev" to mean "rev^1..rev".

With this, the backward compatibility syntaxes still apply:

 - "format-patch master" means "format-patch master..HEAD"
 - "format-patch origin master" means "format-patch origin..master"
 - "format-patch origin.." means "format-patch origin..HEAD"

But "format-patch a b c d e" formats the changes these five
commits introduce relative to their respective parents.  Earlier
it rejected these arguments not in "one..two" form.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 12:21:24 -08:00
Junio C Hamano 60abce3c0f Fix hooks/update template.
Make the example address RFC2606 (aka BCP0032) compliant.  Also
fix a couple of shell script errors.

Noted and fixed by Matthew Wilcox and Andreas Ericsson.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 12:21:06 -08:00
Junio C Hamano 924215024c Make sure heads/foo and tags/foo do not confuse things.
When both heads/foo and tags/foo exist, get_sha1_basic("foo")
picked up the tag without complaining, which is quite confusing.
Make sure we require unambiguous form, "heads/foo" or "tags/foo"
in such cases.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-21 00:43:12 -08:00
Junio C Hamano e0a87193d3 Fix "do not DWIM" patch to enter_repo"
We wanted --strict to mean "do not DWIM", but the code required to
see absolute path.  daemon does its own path verification and chdirs
to the verified repository, so enter_repo() called from upload-pack
will always enter ".".  Requiring absolute path does not make any sense.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-20 23:37:13 -08:00
Andreas Ericsson 936a23420c git-reset.txt: Small fix + clarifications.
This basically translates the man-page from 'git-developerish' to plain
english, adding some almost-sample output from git-status so users can
recognize what will happen.

Also mention explicitly that --mixed updates the index, while --soft
doesn't. I understood the old text to mean "--mixed is exactly like
--soft, but verbose".

Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-20 22:19:58 -08:00
Ryan Anderson 3d32051f4f Add Python version checks to the Makefile to automatically set WITH_OWN_SUBPROCESS_PY
Also rearrange some path settings in the Makefile in the process.

Signed-off-by: Ryan Anderson <ryan@michonline.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-20 22:17:56 -08:00
Timo Hirvonen bd22c904a0 Fix sparse warnings
Make some functions static and convert func() function prototypes to to
func(void).  Fix declaration after statement, missing declaration and
redundant declaration warnings.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-20 22:14:16 -08:00
Paul Mackerras 757f17bca5 gitk: Disable fastdate stuff for now
It has a fatal flaw in that it only handles timezones that are a
multiple of an hour.  It's really only needed with Tk8.5, where
the clock format command has been reimplemented in Tcl and is much
slower than in Tk8.4.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-21 09:56:07 +11:00
Junio C Hamano 8fc66df237 Merge http://www.kernel.org/pub/scm/gitk/gitk 2005-11-20 12:18:13 -08:00