gitweb.git
git.c: two fixes, gitsetenv type and off-by-one error.Junio C Hamano Sun, 4 Dec 2005 22:59:58 +0000 (14:59 -0800)

git.c: two fixes, gitsetenv type and off-by-one error.

gitsetenv as implemented in compat/setenv.c takes two const char*
and int; match that.

Also fix an incorrect attempt in prepend_to_path() to
NUL-terminate the string which stuffed the NUL character at one
past the end of allocation, and was not needed to begin with (we
copy the old_path string including the NUL which terminates it).

Signed-off-by: Junio C Hamano <junkio@cox.net>

compat/setenv: do not free what we fed putenv(3).Junio C Hamano Sun, 4 Dec 2005 22:41:35 +0000 (14:41 -0800)

compat/setenv: do not free what we fed putenv(3).

Signed-off-by: Junio C Hamano <junkio@cox.net>

Warn when send-pack does nothingDaniel Barkalow Sun, 4 Dec 2005 16:59:37 +0000 (11:59 -0500)

Warn when send-pack does nothing

If you try to push into an empty repository with no ref arguments to
git push, it doesn't do anything and doesn't say anything. This adds a
warning when send-pack isn't going to push anything, so you don't
assume that it silently did what you wanted.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>

[PATCH] daemon.c and path.enter_repo(): revamp path... Junio C Hamano Sat, 3 Dec 2005 09:45:57 +0000 (01:45 -0800)

[PATCH] daemon.c and path.enter_repo(): revamp path validation.

The whitelist of git-daemon is checked against return value from
enter_repo(), and enter_repo() used to return the value obtained
from getcwd() to avoid directory aliasing issues as discussed
earier (mid October 2005).

Unfortunately, it did not go well as we hoped.

For example, /pub on a kernel.org public machine is a symlink to
its real mountpoint, and it is understandable that the
administrator does not want to adjust the whitelist every time
/pub needs to point at a different partition for storage
allcation or whatever reasons. Being able to keep using
/pub/scm as the whitelist is a desirable property.

So this version of enter_repo() reports what it used to chdir()
and validate, but does not use getcwd() to canonicalize the
directory name. When it sees a user relative path ~user/path,
it internally resolves it to try chdir() there, but it still
reports ~user/path (possibly after appending .git if allowed to
do so, in which case it would report ~user/path.git).

What this means is that if a whitelist wants to allow a user
relative path, it needs to say "~" (for all users) or list user
home directories like "~alice" "~bob". And no, you cannot say
/home if the advertised way to access user home directories are
~alice,~bob, etc. The whole point of this is to avoid
unnecessary aliasing issues.

Anyway, because of this, daemon needs to do a bit more work to
guard itself. Namely, it needs to make sure that the accessor
does not try to exploit its leading path match rule by inserting
/../ in the middle or hanging /.. at the end. I resurrected the
belts and suspender paranoia code HPA did for this purpose.

This check cannot be done in the enter_repo() unconditionally,
because there are valid callers of enter_repo() that want to
honor /../; authorized users coming over ssh to run send-pack
and fetch-pack should be allowed to do so.

Signed-off-by: Junio C Hamano <junkio@cox.net>

A few more options for git-cat-fileH. Peter Anvin Sun, 4 Dec 2005 01:57:48 +0000 (17:57 -0800)

A few more options for git-cat-file

This adds '-e' option to git-cat-file, to test for the existence
of the object.

This also cleans up the option-parsing in git-cat-file slightly.

[jc: HPA version had -n option which did rev-parse --verify; the
real value of this patch is the option parsing cleanup.]

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>

Add compat/setenv.c, use in git.c.Jason Riedy Fri, 2 Dec 2005 23:08:28 +0000 (15:08 -0800)

Add compat/setenv.c, use in git.c.

There is no setenv() in Solaris 5.8. The trivial calls to
setenv() were replaced by putenv() in a much earlier patch,
but setenv() was used again in git.c. This patch just adds
a compat/setenv.c.

The rule for building git$(X) also needs to include compat.
objects and compiler flags. Those are now in makefile vars
COMPAT_OBJS and COMPAT_CFLAGS.

Signed-off-by: E. Jason Riedy <ejr@cs.berkeley.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>

New test case: Criss-cross mergeFredrik Kuivinen Sat, 3 Dec 2005 10:41:54 +0000 (11:41 +0100)

New test case: Criss-cross merge

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>

New test case: merge with directory/file conflictsFredrik Kuivinen Sat, 3 Dec 2005 10:41:20 +0000 (11:41 +0100)

New test case: merge with directory/file conflicts

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>

test-lib.sh: Add new function, test_expect_codeFredrik Kuivinen Sat, 3 Dec 2005 10:40:39 +0000 (11:40 +0100)

test-lib.sh: Add new function, test_expect_code

The test is considered OK if it exits with code $1

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>

git-merge: Exit with code 2 if no strategy was able... Fredrik Kuivinen Sat, 3 Dec 2005 10:40:21 +0000 (11:40 +0100)

git-merge: Exit with code 2 if no strategy was able to handle the merge.

This way it is possible to test in scripts if the merge was non-clean
or if the strategy had other problems with the merge.

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>

documentation: git-tagNo name Fri, 2 Dec 2005 11:37:13 +0000 (06:37 -0500)

documentation: git-tag

[jc: light edit applied on top of the original]

Signed-off-by: Junio C Hamano <junkio@cox.net>

documentation: git-bisect (help HTML break man)Junio C Hamano Fri, 2 Dec 2005 20:15:23 +0000 (12:15 -0800)

documentation: git-bisect (help HTML break man)

Use the same trick Josef used to introduce line breaks for
git-mv documentation for now, to help HTML rendering. This
breaks manpages and we need to come up with a better solution.

Noticed by linux@horizon.com (No Name).

Signed-off-by: Junio C Hamano <junkio@cox.net>

documentation: clarify read-tree --resetNo name Fri, 2 Dec 2005 11:37:13 +0000 (06:37 -0500)

documentation: clarify read-tree --reset

[jc: light edit applied on top of the original]

Signed-off-by: Junio C Hamano <junkio@cox.net>

git-merge documentation: conflicting merge leaves highe... Junio C Hamano Fri, 2 Dec 2005 09:05:35 +0000 (01:05 -0800)

git-merge documentation: conflicting merge leaves higher stages in index

This hopefully concludes the latest updates that changes the
behaviour of the merge on an unsuccessful automerge. Instead of
collapsing the conflicted path in the index to show HEAD, we
leave it unmerged, now that diff-files can compare working tree
files with higher stages.

Signed-off-by: Junio C Hamano <junkio@cox.net>

merge-one-file: make sure we do not mismerge symbolic... Junio C Hamano Fri, 2 Dec 2005 08:54:50 +0000 (00:54 -0800)

merge-one-file: make sure we do not mismerge symbolic links.

We ran "merge" command on O->A, O->B, A!=B case without
verifying the path involved is not a symlink.

Signed-off-by: Junio C Hamano <junkio@cox.net>

merge-one-file: make sure we create the merged file.Junio C Hamano Fri, 2 Dec 2005 08:50:59 +0000 (00:50 -0800)

merge-one-file: make sure we create the merged file.

The "update-index followed by checkout-index" chain served two
purposes -- to collapse the index to "our" version, and make
sure that file exists in the working tree. In the recent update
to leave the index unmerged on conflicting path, we wanted to
stop doing the former, but we still need to do the latter (we
allow merging to work in an un-checked-out working tree).

Signed-off-by: Junio C Hamano <junkio@cox.net>

t3100: add ls-tree -t and -d tests.Junio C Hamano Fri, 2 Dec 2005 06:49:52 +0000 (22:49 -0800)

t3100: add ls-tree -t and -d tests.

Signed-off-by: Junio C Hamano <junkio@cox.net>

merge-recursive: adjust git-ls-tree use for the latest.Junio C Hamano Fri, 2 Dec 2005 05:39:41 +0000 (21:39 -0800)

merge-recursive: adjust git-ls-tree use for the latest.

You need to pass -t flag if you want to see tree objects in
"git-ls-tree -r" output these days. This change broke the tree
structure reading code in git-merge-recursive used to detect D/F
conflicts.

Signed-off-by: Junio C Hamano <junkio@cox.net>

git wrapper: more careful argument stuffingAlex Riesen Thu, 1 Dec 2005 12:48:35 +0000 (13:48 +0100)

git wrapper: more careful argument stuffing

- Use stderr for error output
- Build git_command more careful
- ENOENT is good enough for check of failed exec to show usage, no
access() check needed

[jc: Originally from Alex Riesen with inputs from Sven
Verdoolaege mixed in.]

Signed-off-by: Junio C Hamano <junkio@cox.net>

git-merge-one-file: do not worry about 'rmdir -p' not... Junio C Hamano Fri, 2 Dec 2005 01:02:04 +0000 (17:02 -0800)

git-merge-one-file: do not worry about 'rmdir -p' not removing directory.

9ae2172aed289f2706a0e88288909fa47eddd7e7 used "rmdir -p"
carelessly, causing the more important "git-update-index
--remove" to be skipped.

Signed-off-by: Junio C Hamano <junkio@cox.net>

ls-tree: --name-onlyJunio C Hamano Thu, 1 Dec 2005 22:54:00 +0000 (14:54 -0800)

ls-tree: --name-only

Fingers of some "git diff" users are trained to do --name-only
which git-ls-tree unfortunately does not take. With this,

cd sub/directory && git-ls-tree -r --name-only ..

would show only the names not object names nor modes. I threw
in another synonym --name-status only for usability, but
obviously ls-tree does not do any comparison so what it does is
the same as --name-only.

Signed-off-by: Junio C Hamano <junkio@cox.net>

ls-tree: resurrect '-d' to mean 'show trees only'Junio C Hamano Thu, 1 Dec 2005 21:15:20 +0000 (13:15 -0800)

ls-tree: resurrect '-d' to mean 'show trees only'

With this:

git-ls-tree -d HEAD -- drivers/net/

shows only immediate subtrees of drivers/net.

git-ls-tree -d -t HEAD -- drivers/net/

shows drivers, drivers/net and immediate subtrees of
drivers/net.

git-ls-tree -d -r HEAD -- drivers/net/

shows drivers, drivers/net and all subtrees of drivers/net (but
not blobs).

Signed-off-by: Junio C Hamano <junkio@cox.net>

git-ls-tree: add "-t" option to always show the tree... Linus Torvalds Thu, 1 Dec 2005 18:35:51 +0000 (10:35 -0800)

git-ls-tree: add "-t" option to always show the tree entries

The old (new) behaviour was that it only shows trees if the object is
specified exactly, and recursive is not set. That makes sense, because
there is obviously nothing else it can show for that case.

However, with the new "-t" option, it will show the tree even with "-r",
as it traverses down into it.

NOTE! This also means that it will show all trees leading up to that tree.

For example, if you do a

git-ls-tree -t HEAD -- drivers/char/this/file/does/not/exist

it will show the trees that lead up to the files that do not exist:

[torvalds@g5 linux]$ git-ls-tree -t HEAD -- drivers/char/this/file/does/not/exist
040000 tree 9cb687b77dcd64bf82e9a73214db467c964c1266 drivers
040000 tree 298e2fadf0ff3867d1ef49936fd2c7bf6ce1eb66 drivers/char
[torvalds@g5 linux]$

and note how this is true even though I didn't specify "-r": the fact that
I supplied a pathspec automatically implies "enough recursion" for that
particular pathspec.

I think the code is cleaner and easier to understand too: the patch looks
bigger, but it's really just splitting up the "should we recurse into this
tree" into a function of its own.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>

Makefile: say the default target upfront.Junio C Hamano Thu, 1 Dec 2005 20:26:41 +0000 (12:26 -0800)

Makefile: say the default target upfront.

Alex Riesen wants to keep extra makefile targets in config.mak, but
the file is included before any of our real targets. Having this
at the beginning allows you to do so.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Documentation: describe '-f' option to git-fetch.Junio C Hamano Thu, 1 Dec 2005 20:24:51 +0000 (12:24 -0800)

Documentation: describe '-f' option to git-fetch.

The option description header was there without body text, confusingly
getting rendered as if the description for --tags applied to the option.

Noticed by Carl Baldwin.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Move couple of ifdefs after "include config.mk"Timo Hirvonen Thu, 1 Dec 2005 01:32:01 +0000 (03:32 +0200)

Move couple of ifdefs after "include config.mk"

This makes it possible to define WITH_SEND_EMAIL etc. in config.mak.

Also remove GIT_LIST_TWEAK because it isn't used anymore.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Merge branch 'jc/subdir'Junio C Hamano Wed, 30 Nov 2005 19:09:33 +0000 (11:09 -0800)

Merge branch 'jc/subdir'

Merge branches 'jc/apply', 'lt/ls-tree', 'lt/bisect... Junio C Hamano Wed, 30 Nov 2005 19:05:48 +0000 (11:05 -0800)

Merge branches 'jc/apply', 'lt/ls-tree', 'lt/bisect' and 'lt/merge'

Do not attempt to access literal dirname "GIT_OBJECT_DI... Tommi Virtanen Wed, 30 Nov 2005 15:37:10 +0000 (17:37 +0200)

Do not attempt to access literal dirname "GIT_OBJECT_DIRECTORY".

Dereference the environment variable before using it.

Signed-off-by: Tommi Virtanen <tv@inoi.fi>
Signed-off-by: Junio C Hamano <junkio@cox.net>

Tutorial: adjust merge example to recursive strategy.Junio C Hamano Wed, 30 Nov 2005 10:38:24 +0000 (02:38 -0800)

Tutorial: adjust merge example to recursive strategy.

Current default, merge-recursive, gives slightly different
message while working from merge-resolve which was used to
prepare the illustration in the tutorial.

Signed-off-by: Junio C Hamano <junkio@cox.net>

merge-recursive: match the unmerged index entry behavio... Junio C Hamano Wed, 30 Nov 2005 10:37:06 +0000 (02:37 -0800)

merge-recursive: match the unmerged index entry behaviour with merge-resolve

This minimally changes merge-recursive to match what happens
when O->A, O->B, A!=B 3-way filelevel merge leaves conflicts to
the new merge-resolve behaviour.

Signed-off-by: Junio C Hamano <junkio@cox.net>

diff-files: show diffs with stage0 and unmerged stage... Junio C Hamano Wed, 30 Nov 2005 10:16:36 +0000 (02:16 -0800)

diff-files: show diffs with stage0 and unmerged stage at the same time.

After thinking about it more, I realized that much of the change
I did on top of Linus' version does not make much sense. This
commit reverts it so that it by default shows diffs with stage0
paths or stage2 paths with working tree; the unmerged stage to
use can be overridden with -1/-2/-3 option (-2 is the default so
essentially is a no-op).

When the index file is unmerged, we are by definition in the
middle of a conflicting merge, and we should show the diff with
stage 2 by default. More importantly, paths without conflicts
are updated in the working tree and collapsed to stage0 in the
index, so showing diff with stage0 at the same time does not
hurt. In normal cases, stage0 entries should be in sync with
the working tree files and does not clutter the output. It even
helps the user to realize that the working tree has local
changes unrelated to the merge and remember to be careful not to
do a "git-commit -a" after resolving the conflicts.

When there is no unmerged entries, giving diff_unmerged_stage a
default value of 2 does not cause any harm, because it would not
be used anyway. So in all, always showing diff between stage0
paths and unmerged entries from a stage (defaulting to 2) is the
right thing to do, as Linus originally did.

Signed-off-by: Junio C Hamano <junkio@cox.net>

merge-one-file: leave unmerged index entries upon autom... Linus Torvalds Wed, 30 Nov 2005 05:06:10 +0000 (21:06 -0800)

merge-one-file: leave unmerged index entries upon automerge failure.

When automerge fails, we used to collapse the path to stage0
from "our" branch, to help "diff-files" users to view the
half-merged state against the current HEAD. Now diff-files has
been taught how to compare with unmerged stage2,leaving them
unmerged is a better thing to do, especially this prevents the
unresolved conflicts to be committed by mistake.

Signed-off-by: Junio C Hamano <junkio@cox.net>

diff-files: -1/-2/-3 to diff against unmerged stage.Linus Torvalds Wed, 30 Nov 2005 05:06:10 +0000 (21:06 -0800)

diff-files: -1/-2/-3 to diff against unmerged stage.

While resolving conflicted merge, it was not easy to compare the
working tree file with unmerged index entries. This commit
introduces new options -1/-2/-3 (with synonyms --base, --ours,
and --theirs) to compare working tree files with specified
stages.

When none of these options are given, the command defaults to -2
if the index file is unmerged, otherwise it acts as before.

[jc: majorly butchered from the version Linus originally posted.]

Signed-off-by: Junio C Hamano <junkio@cox.net>

git-diff: do not turn off -p/-M with any diff options.Junio C Hamano Wed, 30 Nov 2005 05:59:04 +0000 (21:59 -0800)

git-diff: do not turn off -p/-M with any diff options.

When the user gives a diff option (e.g. --cached) to "git diff",
we turned off the built-in default option -p, which is usually
not what user wants to see.

This commit makes lack of --name-status, --name-only nor -r to
add -p, and lack of -B*, -C* nor -M* to add -M to the flags
given to the underlying diff.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Merge http://www.kernel.org/pub/scm/gitk/gitkJunio C Hamano Tue, 29 Nov 2005 23:47:32 +0000 (15:47 -0800)

Merge http://www.kernel.org/pub/scm/gitk/gitk

[PATCH] Add tests for git-mv in subdirectoriesAlex Riesen Tue, 29 Nov 2005 22:10:24 +0000 (23:10 +0100)

[PATCH] Add tests for git-mv in subdirectories

Junio C Hamano, Sat, Nov 26, 2005 03:45:52 +0100:

> I haven't seriously used git-mv myself, so
> somebody needs to test it, and if it actually works and Ack on
> it, please.

It actually works in subdirs.

Signed-off-by: Junio C Hamano <junkio@cox.net>

[PATCH] Make git-mv work in subdirectories, tooJohannes Schindelin Sat, 26 Nov 2005 02:45:52 +0000 (18:45 -0800)

[PATCH] Make git-mv work in subdirectories, too

Turns out, all git programs git-mv uses are capable of operating in
a subdirectory just fine. So don't complain about it.

[jc: I think that sounds sane. You need to grab the exit status from
`git-rev-parse --git-dir`, which I added. Alex Riesen says this
worked fine.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>

gitk: Add a preferences dialog with some basic stuffPaul Mackerras Tue, 29 Nov 2005 22:28:16 +0000 (09:28 +1100)

gitk: Add a preferences dialog with some basic stuff

There is a lot more that could be put in, such as a selector for
the font family etc., but this is a start.

Signed-off-by: Paul Mackerras <paulus@samba.org>

format-patch: run diff in C localeJunio C Hamano Tue, 29 Nov 2005 21:51:27 +0000 (13:51 -0800)

format-patch: run diff in C locale

Otherwise it would show incomplete line and binary markers in
a locale dependent way.

Signed-off-by: Junio C Hamano <junkio@cox.net>

format-patch: do not abuse 3-dash marker line.Junio C Hamano Tue, 29 Nov 2005 21:51:27 +0000 (13:51 -0800)

format-patch: do not abuse 3-dash marker line.

Before GIT version at the end of output we used a 3-dash marker;
but 3-dash marker is special and should not be overused.
Instead, use "-- " which is a standard practice in e-mails to
signal the beginning of trailing garbage.

Signed-off-by: Junio C Hamano <junkio@cox.net>

format-patch: remove applies-to.Junio C Hamano Tue, 29 Nov 2005 21:51:27 +0000 (13:51 -0800)

format-patch: remove applies-to.

The attempt to help 3-way fallback by recording the tree object
id for the entire pre-image was unnecessary, and we already have
an better alternative in the form of per-blob "index" lines.

Signed-off-by: Junio C Hamano <junkio@cox.net>

applypatch: use "index" lines not "applies-to".Junio C Hamano Tue, 29 Nov 2005 21:53:30 +0000 (13:53 -0800)

applypatch: use "index" lines not "applies-to".

This matches the 3-way fallback used by applypatch to use
per-blob "index" lines, not "applies-to" tree object name, to
match what git-am does.

Signed-off-by: Junio C Hamano <junkio@cox.net>

applymbox: typofix to enable -m option.Junio C Hamano Tue, 29 Nov 2005 22:14:42 +0000 (14:14 -0800)

applymbox: typofix to enable -m option.

The -m option to fall back on 3-way merge was not honoured at
all because of a typo.

Signed-off-by: Junio C Hamano <junkio@cox.net>

SVN import: Use one log callMatthias Urlichs Tue, 29 Nov 2005 07:13:04 +0000 (08:13 +0100)

SVN import: Use one log call

One "svn log" (or its equivalent) per revision adds delay and server load.
Instead, open two SVN connections -- one for the log, and one for the files.

Positive side effect: Only those log entries which actually contain data
are committed => no more empty commits.

Also, change the "-l" option to set the maximum revision to be pulled,
not the number of revisions.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Fix typos and minor format issues.jdl@freescale.com Tue, 29 Nov 2005 14:59:56 +0000 (08:59 -0600)

Fix typos and minor format issues.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>

http-push cleanupNick Hengeveld Tue, 29 Nov 2005 17:33:36 +0000 (09:33 -0800)

http-push cleanup

The malloc patch from Jan Andres fixed the problem that was causing a
segfault when freeing the lock token, and Johannes Schindelin found
and fixed a problem when no URL is specified on the command line.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>

git-clone --shared should imply --localPavel Roskin Tue, 29 Nov 2005 06:20:49 +0000 (01:20 -0500)

git-clone --shared should imply --local

The "--shared" option to git-clone is silently ignored if "--local" is
not specified. The manual doesn't mention such dependency. Make
"--shared" imply "--local".

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>

hash-object.c: type-fix to squelch compiler warnings.Junio C Hamano Mon, 28 Nov 2005 11:19:03 +0000 (03:19 -0800)

hash-object.c: type-fix to squelch compiler warnings.

Signed-off-by: Junio C Hamano <junkio@cox.net>

define die() for scripts that use it.Junio C Hamano Mon, 28 Nov 2005 07:33:54 +0000 (23:33 -0800)

define die() for scripts that use it.

As a fallout from not using git-sh-setup in scripts that can
operate from a subdirectory, we lost definition of die() from
them. It might make sense to do some cleanup to consolidate
them back again, but this should suffice for now.

Signed-off-by: Junio C Hamano <junkio@cox.net>

verify-tag: make it operable from a subdirectory.Junio C Hamano Mon, 28 Nov 2005 07:19:58 +0000 (23:19 -0800)

verify-tag: make it operable from a subdirectory.

Signed-off-by: Junio C Hamano <junkio@cox.net>

tag: make it operable from a subdirectory.Junio C Hamano Mon, 28 Nov 2005 07:19:06 +0000 (23:19 -0800)

tag: make it operable from a subdirectory.

Signed-off-by: Junio C Hamano <junkio@cox.net>

lost-found: make it operable from a subdirectory.Junio C Hamano Mon, 28 Nov 2005 07:18:04 +0000 (23:18 -0800)

lost-found: make it operable from a subdirectory.

Signed-off-by: Junio C Hamano <junkio@cox.net>

branch: make it operable from a subdirectory.Junio C Hamano Mon, 28 Nov 2005 07:16:15 +0000 (23:16 -0800)

branch: make it operable from a subdirectory.

Signed-off-by: Junio C Hamano <junkio@cox.net>

ls-remote: define die() now we do not use git-sh-setupJunio C Hamano Mon, 28 Nov 2005 07:15:02 +0000 (23:15 -0800)

ls-remote: define die() now we do not use git-sh-setup

Another interesting "property" is that from inside a git managed
tree, "git-ls-remote ." names the current repository no matter
how deep a subdirectory you are in.

Signed-off-by: Junio C Hamano <junkio@cox.net>

count-objects: make it operable from a subdirectory.Junio C Hamano Mon, 28 Nov 2005 06:53:20 +0000 (22:53 -0800)

count-objects: make it operable from a subdirectory.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Make the rest of commands work from a subdirectory.Junio C Hamano Sat, 26 Nov 2005 08:50:02 +0000 (00:50 -0800)

Make the rest of commands work from a subdirectory.

These commands are converted to run from a subdirectory.

commit-tree convert-objects merge-base merge-index mktag
pack-objects pack-redundant prune-packed read-tree tar-tree
unpack-file unpack-objects update-server-info write-tree

Signed-off-by: Junio C Hamano <junkio@cox.net>

Make networking commands to work from a subdirectory.Junio C Hamano Sat, 26 Nov 2005 08:47:59 +0000 (00:47 -0800)

Make networking commands to work from a subdirectory.

These are whole-tree operations and there is not much point
making them operable from within a subdirectory, but it is easy
to do so, and using setup_git_directory() upfront helps git://
proxy specification picked up from the correct place.

Signed-off-by: Junio C Hamano <junkio@cox.net>

ls-tree: work from subdirectory.Junio C Hamano Sat, 26 Nov 2005 08:40:50 +0000 (00:40 -0800)

ls-tree: work from subdirectory.

This makes ls-tree to work from subdirectory. It defaults to
show the paths under the current subdirectory, and interprets
user-supplied paths as relative to the current subdirectory.

Signed-off-by: Junio C Hamano <junkio@cox.net>

hash-object: work within subdirectory.Junio C Hamano Sat, 26 Nov 2005 08:30:07 +0000 (00:30 -0800)

hash-object: work within subdirectory.

When -w is given, it needs to find out where the .git directory
is, so run the setup_git_directory() when we see a -w.

Signed-off-by: Junio C Hamano <junkio@cox.net>

checkout-index: work from subdirectory.Junio C Hamano Sat, 26 Nov 2005 08:22:48 +0000 (00:22 -0800)

checkout-index: work from subdirectory.

With this, git-checkout-index from a subdirectory works as
expected. Note that "git-checkout-index -a" checks out files
only in the current directory and under.

Signed-off-by: Junio C Hamano <junkio@cox.net>

fsck-objects: work from subdirectory.Junio C Hamano Sat, 26 Nov 2005 07:52:04 +0000 (23:52 -0800)

fsck-objects: work from subdirectory.

Not much point making it work from subdirectory, but for a
consistency make it so.

Signed-off-by: Junio C Hamano <junkio@cox.net>

peek-remote: honor proxy config even from subdirectory.Junio C Hamano Sat, 26 Nov 2005 07:50:21 +0000 (23:50 -0800)

peek-remote: honor proxy config even from subdirectory.

Use setup_git_directory_gently() at the beginning of peek-remote
so that git:// proxy can be picked up from the configuration
file.

Signed-off-by: Junio C Hamano <junkio@cox.net>

git-apply: work from subdirectory.Junio C Hamano Sat, 26 Nov 2005 07:14:15 +0000 (23:14 -0800)

git-apply: work from subdirectory.

When applying a patch to index file, we need to know where GIT_DIR is;
use setup_git_directory() to find it out. This also allows us to work
from a subdirectory if we wanted to.

When git-apply is run from a subdirectory, it applies the given patch
only to the files under the current directory and below.

Signed-off-by: Junio C Hamano <junkio@cox.net>

working from subdirectory: preparationJunio C Hamano Sat, 26 Nov 2005 07:14:15 +0000 (23:14 -0800)

working from subdirectory: preparation

- prefix_filename() is like prefix_path() but can be used to
name any file on the filesystem, not the files that might go
into the index file.

- setup_git_directory_gently() tries to find the GIT_DIR, but does
not die() if called outside a git repository.

Signed-off-by: Junio C Hamano <junkio@cox.net>

bisect: quote pathnames for eval safety.Junio C Hamano Mon, 28 Nov 2005 01:42:05 +0000 (17:42 -0800)

bisect: quote pathnames for eval safety.

... and make sure they are on the same line.

Signed-off-by: Junio C Hamano <junkio@cox.net>

bisect: limit the searchspace by pathspecsLinus Torvalds Sun, 27 Nov 2005 19:32:03 +0000 (11:32 -0800)

bisect: limit the searchspace by pathspecs

It was surprisingly easy to do.

git bisect start <pathspec>

followed by all the normal "git bisect good/bad" stuff.

Almost totally untested, and I guarantee that if your pathnames have
spaces in them (or your GIT_DIR has spaces in it) this won't work. I don't
know how to fix that, my shell programming isn't good enough.

This involves small changes to make "git-rev-list --bisect" work in the
presense of a pathspec limiter, and then truly trivial (and that's the
broken part) changes to make "git bisect" save away and use the pathspec.

I tried one bisection, and a "git bisect visualize", and it all looked
correct. But hey, don't be surprised if it has problems.

Linus

Signed-off-by: Junio C Hamano <junkio@cox.net>

ls-tree: match the test to the new semantics.Junio C Hamano Mon, 28 Nov 2005 10:32:42 +0000 (02:32 -0800)

ls-tree: match the test to the new semantics.

The diff for this commit is a good illustration of what changed
in ls-tree behaviour.

- With -r, tree nodes themselves are not shown anymore, but
blobs in subtrees are shown.

- The order of paths parameters do not matter, since they are
not like arguments to /bin/ls, but are filter patterns.

- When filter patterns overlap, unintuitive things happen.

Signed-off-by: Junio C Hamano <junkio@cox.net>

ls-tree: Resurrect funny name quoting lost during rewrite.Junio C Hamano Mon, 28 Nov 2005 10:30:04 +0000 (02:30 -0800)

ls-tree: Resurrect funny name quoting lost during rewrite.

The rewrite to match ls-files/diff-tree behaviour accidentally
lost the name quoting. I am not proud about this code, but this
would get the test going.

Signed-off-by: Junio C Hamano <junkio@cox.net>

ls-tree: further tweaks of the rewriteLinus Torvalds Mon, 28 Nov 2005 06:48:08 +0000 (22:48 -0800)

ls-tree: further tweaks of the rewrite

It modifies the selection a bit, so that a pathspec that is a superset of
a particular tree path will always cause it to recurse into that tree.

As an example, let's say that we do

git-ls-tree HEAD drivers/char

_without_ the "-r". What will happen is that it will start out doing all
the base tree, and for "drivers" it will notice that it's a proper subset
of "drivers/char", so it will always recurse into _that_ tree (but not
into other trees).

Then, it will not match anything else than "char" in that subdirectory,
and because that's not a proper superset (it's an exact match), it will
_not_ recurse into it, so you get:

[torvalds@g5 linux]$ ~/git/git-ls-tree HEAD drivers/char
040000 tree 9568cda453aae205bb58983747fa73b9696d9d51 drivers/char

which is what you got with the old git-ls-tree too.

But interestingly, if you add the slash, it will become a proper superset
and it will recurse into _that_ subdirectory (but no deeper: so if you
want all subdirectories _below_ drivers/char/, you still need to give
"-r"):

[torvalds@g5 linux]$ ~/git/git-ls-tree HEAD drivers/char/
100644 blob 2b6b1d772ed776fff87927fc34adc2e40500218e drivers/char/.gitignore
100644 blob 56b8a2e76ab10a5c21787cb7068a846075cbaffd drivers/char/ChangeLog
100644 blob 970f70d498f4c814e1cf3362e33d7e23ac53c299 drivers/char/Kconfig
...

See? This is on top of the previous two diffs, holler if you want a whole
new "everything combined" version..

It hasn't gotten lots of testing, but it should work.

Linus

ls-tree: further cleanup to parallel ls-files.Linus Torvalds Sun, 27 Nov 2005 19:00:09 +0000 (11:00 -0800)

ls-tree: further cleanup to parallel ls-files.

To get more a "git-ls-files" approach, this trivial patch (on top of my
previous one) enables recursion, and doesn't show partial trees.

[jc: after further discussion, this version enables recursion by default,
and you can disable it with "-d" flag.

git-ls-tree -d HEAD Documentation/no/such/directory

shows Documentation tree (without -d it shows nothing).

git-ls-tree HEAD

shows everything from the tree. Only to get the single level from the top

git-ls-tree -d HEAD

is needed. But there is no way to get the single level with pathspec.
You need to extract the object name of Documentation tree from the parent
tree and run

git-ls-tree -d $tree_id_of_Documentation_tree

to get something similar to what you can get from the current

git-ls-tree HEAD Documentation
]

ls-tree: major rewrite to do pathspecLinus Torvalds Sat, 26 Nov 2005 17:38:20 +0000 (09:38 -0800)

ls-tree: major rewrite to do pathspec

git-ls-tree should be rewritten to use a pathspec the same way everybody
else does. Right now it's the odd man out: if you do

git-ls-tree HEAD divers/char drivers/

it will show the same files _twice_, which is not how pathspecs in general
work.

How about this patch? It breaks some of the git-ls-tree tests, but it
makes git-ls-tree work a lot more like other git pathspec commands, and it
removes more than 150 lines by re-using the recursive tree traversal (but
the "-d" flag is gone for good, so I'm not pushing this too hard).

Linus

write_name_quoted(): make one of the path a counted... Junio C Hamano Tue, 29 Nov 2005 06:55:25 +0000 (22:55 -0800)

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>

Documentation: Describe merge operation a bit better.Junio C Hamano Tue, 29 Nov 2005 06:54:30 +0000 (22:54 -0800)

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>

Fix typo in http-push.cJan Andres Tue, 29 Nov 2005 00:51:54 +0000 (01:51 +0100)

Fix typo in http-push.c

Typo resulted in accessing past the beginning of a string causing segfaults.

[jc: signoffs?]

name-rev: fix parent counting.Junio C Hamano Tue, 29 Nov 2005 04:51:44 +0000 (20:51 -0800)

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>

rebase: one safety net, one bugfix and one optimization.Junio C Hamano Mon, 28 Nov 2005 21:00:31 +0000 (13:00 -0800)

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>

Merge http://www.kernel.org/pub/scm/gitk/gitkJunio C Hamano Mon, 28 Nov 2005 11:11:11 +0000 (03:11 -0800)

Merge http://www.kernel.org/pub/scm/gitk/gitk

git-mv: quote $src in regexp properly.Junio C Hamano Mon, 28 Nov 2005 10:54:05 +0000 (02:54 -0800)

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>

[PATCH] gitk: Use i18n.commitencoding configuration... Junio C Hamano Mon, 28 Nov 2005 00:12:51 +0000 (16:12 -0800)

[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>

config.c: constness tightening to avoid compilation... Junio C Hamano Mon, 28 Nov 2005 09:46:15 +0000 (01:46 -0800)

config.c: constness tightening to avoid compilation warning.

Signed-off-by: Junio C Hamano <junkio@cox.net>

gitk: Fix diff this->selected and selected->this functionsPaul Mackerras Mon, 28 Nov 2005 09:41:56 +0000 (20:41 +1100)

gitk: Fix diff this->selected and selected->this functions

The change in 8b7e5d76e836396a097bb6f61cf930ea872a7bd3, 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>

mailinfo: Do not use -u=<encoding>; say --encoding... Junio C Hamano Mon, 28 Nov 2005 09:29:52 +0000 (01:29 -0800)

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>

mailinfo: Use i18n.commitencodingJunio C Hamano Mon, 28 Nov 2005 00:29:38 +0000 (16:29 -0800)

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>

mailinfo: allow -u to fall back on latin1 to utf8 conve... Junio C Hamano Mon, 28 Nov 2005 00:22:16 +0000 (16:22 -0800)

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>

Introduce i18n.commitencoding.Junio C Hamano Mon, 28 Nov 2005 00:09:40 +0000 (16:09 -0800)

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>

Fix gitk this->selected diffsYann Dirson Sun, 27 Nov 2005 22:29:30 +0000 (23:29 +0100)

Fix gitk this->selected diffs

The change made in 8b7e5d76e836396a097bb6f61cf930ea872a7bd3 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>

Merge http://www.kernel.org/pub/scm/gitk/gitkJunio C Hamano Sun, 27 Nov 2005 22:42:15 +0000 (14:42 -0800)

Merge http://www.kernel.org/pub/scm/gitk/gitk

git-mv: follow -k request even on failing renamesJosef Weidendorfer Sun, 27 Nov 2005 21:11:33 +0000 (22:11 +0100)

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>

Small fixes in Documentation/git-mv.txtJosef Weidendorfer Sun, 27 Nov 2005 21:08:33 +0000 (22:08 +0100)

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>

git-mv: fully detect 'directory moved into itself'Josef Weidendorfer Sun, 27 Nov 2005 21:06:42 +0000 (22:06 +0100)

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>

git-mv: keep git index consistent with file system... Josef Weidendorfer Sun, 27 Nov 2005 21:04:14 +0000 (22:04 +0100)

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>

git-mv: shrink usage, no usage on errorJosef Weidendorfer Sun, 27 Nov 2005 20:58:52 +0000 (21:58 +0100)

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>

setup_git_directory(): check repository format version.Junio C Hamano Sat, 26 Nov 2005 00:08:48 +0000 (16:08 -0800)

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>

init-db: check template and repository format.Junio C Hamano Sat, 26 Nov 2005 00:03:56 +0000 (16:03 -0800)

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>

Check repository format version in enter_repo().Junio C Hamano Fri, 25 Nov 2005 18:48:26 +0000 (10:48 -0800)

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>

Repository format version check.Junio C Hamano Fri, 25 Nov 2005 23:59:09 +0000 (15:59 -0800)

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>

format-patch: output filename reported to stdout verbatim.Junio C Hamano Sat, 26 Nov 2005 20:09:07 +0000 (12:09 -0800)

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>

name-rev: fix off-by-one error in --stdin.Junio C Hamano Sat, 26 Nov 2005 07:36:58 +0000 (23:36 -0800)

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>

git-mv is not able to handle big directoriesAlexander Litvinov Wed, 23 Nov 2005 10:19:41 +0000 (16:19 +0600)

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>