Commit graph

2621 commits

Author SHA1 Message Date
Junio C Hamano 9ef2b3cbf6 write_name_quoted(): make one of the path a counted string.
This is to prepare for ls-tree updates.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28 22:55:25 -08:00
Junio C Hamano ffb1a4bed5 Documentation: Describe merge operation a bit better.
In git-merge documentation, add a section to describe what happens to
the index and working tree during merge, and what their cleanliness
requirements are before the merge.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28 22:54:30 -08:00
Jan Andres 3e2f62bebf Fix typo in http-push.c
Typo resulted in accessing past the beginning of a string causing segfaults.

[jc: signoffs?]
2005-11-28 21:56:30 -08:00
Junio C Hamano f2e6f1c976 name-rev: fix parent counting.
Noticed by linux@horizon.com.  The first merge parent (typically
"our branch") is ^1, not ^0, and the first other branch is ^2.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28 20:51:44 -08:00
Junio C Hamano 7f4bd5d831 rebase: one safety net, one bugfix and one optimization.
When a .dotest from a previously failed rebase or patch
application exists, rebase got confused and tried to apply
mixture of what was already there and what is being rebased.
Check the existence of the directory and barf.

It failed with an mysterious "fatal: cannot read mbox" message
if the branch being rebased is fully in sync with the base.
Also if the branch is a proper descendant of the base, there is
no need to run rebase logic.  Prevent these from happening by
checking where the merge-base is.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28 13:00:31 -08:00
Junio C Hamano 36d277c72d Merge http://www.kernel.org/pub/scm/gitk/gitk 2005-11-28 03:11:11 -08:00
Junio C Hamano 90109b320d git-mv: quote $src in regexp properly.
Noticed and fixed by Matthias Urlichs and Josef Weidendorfer.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28 02:54:05 -08:00
Junio C Hamano 671bc1538a [PATCH] gitk: Use i18n.commitencoding configuration item.
Hardcoding "utf-8" in the script breaks projects that use local
encoding, so allow setting i18n.commitEncoding.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-28 20:46:49 +11:00
Junio C Hamano 0dccc7dcee config.c: constness tightening to avoid compilation warning.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28 01:46:15 -08:00
Paul Mackerras d327244a84 gitk: Fix diff this->selected and selected->this functions
The change in 8b7e5d76e8, which makes
a couple of git-diff-tree calls supply only one id rather than two,
fixes the display when showing what a single commit did with dense
revlists, but broke the diff this->selected and diff selected->this
right-click menu functions.

Yann Dirson pointed this out and had a patch that fixed the diff
menu functions by passing a "singlecommit" flag around.  This fixes
it a bit differently, by making the ids and diffids variables be
either a single id, in the case of showing what a commit did, or
{oldid newid}, in the case of the diff menu functions.  That way
we can just pass $ids to git-diff-tree as is.  Most of the changes
in fact are just reversing the order of ids in $ids and $diffids,
because they used to be {child parent}, but git-diff-tree requires
old id before new id.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-28 20:41:56 +11:00
Junio C Hamano 9f63892b38 mailinfo: Do not use -u=<encoding>; say --encoding=<encoding>
Specifying the value for a single letter, single dash option
parameter with equal sign looked funny, and more importantly
calling the flag to override encoding from utf-8 to something
else "-u" (obviously abbreviated from "utf-8") did not make any
sense.  So spell it out.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28 01:29:52 -08:00
Junio C Hamano f1f909e318 mailinfo: Use i18n.commitencoding
This uses i18n.commitencoding configuration item to pick up the
default commit encoding for the repository when converting form
e-mail encoding to commit encoding (the default is utf8).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 16:29:38 -08:00
Junio C Hamano 650e4be59b mailinfo: allow -u to fall back on latin1 to utf8 conversion.
When the message body does not identify what encoding it is in,
-u assumes it is in latin-1 and converts it to utf8, which is
the recommended encoding for git commit log messages.

With -u=<encoding>, the conversion is made into the specified
one, instead of utf8, to allow project-local policies.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 16:26:50 -08:00
Junio C Hamano 4e72dcec89 Introduce i18n.commitencoding.
This is to hold what the project-local rule as to the
charset/encoding for the commit log message is.  Lack of it
defaults to utf-8.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 16:09:40 -08:00
Yann Dirson 55d1eb047d Fix gitk this->selected diffs
The change made in 8b7e5d76e8 to
accomodate dense revlists in single-commit diffs has broken computing
of diffs between arbitrary trees, which does need to consider two
commit ids.

This patch changes the two git-diff-tree calls to get the necessary
two ids in this case.  It does so by propagating a "singlecommit" flag
through all functions involved via an additional argument.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 14:42:51 -08:00
Junio C Hamano 56fc631939 Merge http://www.kernel.org/pub/scm/gitk/gitk 2005-11-27 14:42:15 -08:00
Josef Weidendorfer 26169747b8 git-mv: follow -k request even on failing renames
-k requests to keep running on an error condition.
Previously, git-mv stopped on failing renames even with -k.

There are some error conditions which are not checked in the
first phase of git-mv, eg. 'permission denied'. Still, option
-k should work.

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 14:40:29 -08:00
Josef Weidendorfer b933e818e9 Small fixes in Documentation/git-mv.txt
The two synopsis lines have to be prefixed with a space
so that asciidoc inserts a line break inbetween for the
manual page.

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 14:40:29 -08:00
Josef Weidendorfer ca203ee7db git-mv: fully detect 'directory moved into itself'
This gives a better error message when trying to move a directory
into some subdirectory of itself; ie. no real bug fix: renaming
already failed before, but with a strange "invalid argument".

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 14:40:29 -08:00
Josef Weidendorfer f6bc189a45 git-mv: keep git index consistent with file system on failed rename
When doing multiple renames, and a rename in the middle fails,
git-mv did not store the successful renames in the git index;
this is fixed by delaying the error message on a failed rename
to after the git updating.

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 14:40:28 -08:00
Josef Weidendorfer 3ae64dff68 git-mv: shrink usage, no usage on error
Small fixes to be consistent with other git scripts:
- usage message is only about options and arguments
- on error, exit(1) without the usage message

Additionally, "beautifies" output with -n a little bit

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 14:40:28 -08:00
Junio C Hamano 22752e4c43 setup_git_directory(): check repository format version.
After figuring out the GIT_DIR location, make sure the
repository is of the right vintage, by calling
check_repository_format(). .

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 01:32:59 -08:00
Junio C Hamano 4f629539cd init-db: check template and repository format.
This makes init-db repository version aware.

It checks if an existing config file says the repository being
reinitialized is of a wrong version and aborts before doing
further harm.

When copying the templates, it makes sure the they are of the
right repository format version.  Otherwise the templates are
ignored with an warning message.

It copies the templates before creating the HEAD, and if the
config file is copied from the template directory, reads it,
primarily to pick up the value of core.symrefsonly.

It changes the way the result of the filemode reliability test
is written to the configuration file using git_config_set().
The test is done even if the config file was copied from the
templates.

And finally, our own repository format version is written to the
config file.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 01:32:59 -08:00
Junio C Hamano 1644162ad5 Check repository format version in enter_repo().
After daemon, upload-pack and receive-pack find out where the
git directory is and chdir() there, make sure that repository is
in a format we understand, after putenv("GIT_DIR=.") so that it
knows to pick up the configuration file from there.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 01:32:59 -08:00
Junio C Hamano ab9cb76f66 Repository format version check.
This adds the repository format version code, first done by
Martin Atukunda.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-27 01:32:59 -08:00
Junio C Hamano 51b3c00e9d format-patch: output filename reported to stdout verbatim.
Prepending asterisk to the output was just adding noise, and
making scripts like proposed git-send-mail by Andreas Ericsson
do unnecessary work.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-26 12:09:07 -08:00
Junio C Hamano 2d76d0d151 name-rev: fix off-by-one error in --stdin.
It dropped the last hexdigit in the object name.

[jc: Noticed and patch supplied by ALASCM, reworked to apply at
the right place by me]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 23:36:58 -08:00
Alexander Litvinov f359ae42ac git-mv is not able to handle big directories
Use update-index --stdin to handle large number of files without
breaking exec() argument storage limit.

[jc: with minor cleanup from the version posted on the list]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 22:19:23 -08:00
Junio C Hamano ab5f86275c shell.c: complain on insufficient arguments.
Originally noticed by Tommi Virtanen, but done slightly differently.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 20:57:02 -08:00
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