Code

git.git
16 years agoAllow frontends to bidirectionally communicate with fast-import
Shawn O. Pearce [Wed, 1 Aug 2007 14:23:08 +0000 (10:23 -0400)]
Allow frontends to bidirectionally communicate with fast-import

The existing checkpoint command is very useful to force fast-import
to dump the branches out to disk so that standard Git tools can
access them and the objects they refer to.  However there was not a
way to know when fast-import had finished executing the checkpoint
and it was safe to read those refs.

The progress command can be used to make fast-import output any
message of the frontend's choosing to standard out.  The frontend
can scan for these messages using select() or poll() to monitor a
pipe connected to the standard output of fast-import.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoMake trailing LF optional for all fast-import commands
Shawn O. Pearce [Wed, 1 Aug 2007 06:22:53 +0000 (02:22 -0400)]
Make trailing LF optional for all fast-import commands

For the same reasons as the prior change we want to allow frontends
to omit the trailing LF that usually delimits commands.  In some
cases these just make the input stream more verbose looking than
it needs to be, and its just simpler for the frontend developer to
get started if our parser is slightly more lenient about where an
LF is required and where it isn't.

To make this optional LF feature work we now have to buffer up to one
line of input in command_buf.  This buffering can happen if we look
at the current input command but don't recognize it at this point
in the code.  In such a case we need to "unget" the entire line,
but we cannot depend upon the stdio library to let us do ungetc()
for that many characters at once.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoMake trailing LF following fast-import `data` commands optional
Shawn O. Pearce [Wed, 1 Aug 2007 04:24:25 +0000 (00:24 -0400)]
Make trailing LF following fast-import `data` commands optional

A few fast-import frontend developers have found it odd that we
require the LF following a `data` command, especially in the exact
byte count format.  Technically we don't need this LF to parse
the stream properly, but having it here does make the stream more
readable to humans.  We can easily make the LF optional by peeking
at the next byte available from the stream and pushing it back into
the buffer if its not LF.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoTeach fast-import to ignore lines starting with '#'
Shawn O. Pearce [Wed, 1 Aug 2007 04:05:15 +0000 (00:05 -0400)]
Teach fast-import to ignore lines starting with '#'

Several frontend developers have asked that some form of stream
comments be permitted within a fast-import data stream.  This way
they can include information from their own frontend program about
where specific data was taken from in the source system, or about
a decision that their frontend may have made while creating the
fast-import data stream.

This change introduces comments in the Bourne-shell/Tcl/Perl style.
Lines starting with '#' are ignored, up to and including the LF.
Unlike the above mentioned three languages however we do not look for
and ignore leading whitespace.  This just simplifies the definition
of the comment format and the code that parses them.

To make comments work we had to stop using read_next_command() within
cmd_data() and directly invoke read_line() during the inline variant
of the function.  This is necessary to retain any lines of the
input data that might otherwise look like a comment to fast-import.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoUse handy ALLOC_GROW macro in fast-import when possible
Shawn O. Pearce [Wed, 1 Aug 2007 04:32:36 +0000 (00:32 -0400)]
Use handy ALLOC_GROW macro in fast-import when possible

Instead of growing our buffer by hand during the inline variant of
cmd_data() we can save a few lines of code and just use the nifty
new ALLOC_GROW macro already available to us.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoActually allow TAG_FIXUP branches in fast-import
Shawn O. Pearce [Fri, 3 Aug 2007 03:37:21 +0000 (23:37 -0400)]
Actually allow TAG_FIXUP branches in fast-import

Michael Haggerty <mhagger@alum.mit.edu> noticed while debugging a
Git backend for cvs2svn that fast-import was barfing when he tried
to use "TAG_FIXUP" as a branch name for temporary work needed to
cleanup the tree prior to creating an annotated tag object.

The reason we were rejecting the branch name was check_ref_format()
returns -2 when there are less than 2 '/' characters in the input
name.  TAG_FIXUP has 0 '/' characters, but is technically just as
valid of a ref as HEAD and MERGE_HEAD, so we really should permit it
(and any other similar looking name) during import.

New test cases have been added to make sure we still detect very
wrong branch names (e.g. containing [ or starting with .) and yet
still permit reasonable names (e.g. TAG_FIXUP).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoFix whitespace in "Format of STDIN stream" of fast-import
Alex Riesen [Sun, 15 Jul 2007 08:57:40 +0000 (10:57 +0200)]
Fix whitespace in "Format of STDIN stream" of fast-import

Something probably assumed that HT indentation is 4 characters.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-completion.bash - add support for git-bundle
Mark Levedahl [Sun, 12 Aug 2007 18:46:12 +0000 (14:46 -0400)]
git-completion.bash - add support for git-bundle

Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoClarify commit-tree documentation
Mike Hommey [Fri, 17 Aug 2007 20:13:36 +0000 (22:13 +0200)]
Clarify commit-tree documentation

As per http://marc.info/?l=git&m=118737219702802&w=2 , clarify
git-commit-tree documentation.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMinor clarifications to git-filter-branch usage and doc
Brian Gernhardt [Fri, 17 Aug 2007 23:13:04 +0000 (19:13 -0400)]
Minor clarifications to git-filter-branch usage and doc

- Remove "DESTBRANCH" from usage, as it rewrites the branches given.
- Remove an = from an example usage, as the script doesn't understand
it.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix small typo in git send-email man page.
Sean Estabrooks [Fri, 17 Aug 2007 21:38:24 +0000 (17:38 -0400)]
Fix small typo in git send-email man page.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-submodule: re-enable 'status' as the default subcommand
Lars Hjemli [Sat, 4 Aug 2007 14:25:53 +0000 (16:25 +0200)]
git-submodule: re-enable 'status' as the default subcommand

This was broken as part of ecda072380.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Acked-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoClean-up read-tree error condition.
Junio C Hamano [Fri, 17 Aug 2007 02:24:08 +0000 (19:24 -0700)]
Clean-up read-tree error condition.

This is a follow-up to f34f2b0b; list_tree() function is where it
first notices that the command line fed too many trees for us to
handle, so move the error exit message to there, and raise the
MAX_TREES to 8 (not that it matters very much in practice).

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoClarify actual behavior of 'git add' and ignored files
Brian Downing [Thu, 16 Aug 2007 22:56:08 +0000 (17:56 -0500)]
Clarify actual behavior of 'git add' and ignored files

Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot1301-shared-repo.sh: fix 'stat' portability issue
Arjen Laarhoven [Thu, 16 Aug 2007 22:02:17 +0000 (00:02 +0200)]
t1301-shared-repo.sh: fix 'stat' portability issue

The t1301-shared-repo.sh testscript uses /usr/bin/stat to get the file
mode, which isn't portable.  Implement the test in shell using 'ls' as
shown by Junio.

Signed-off-by: Arjen Laarhoven <arjen@yaph.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-rebase: fix an example
Junio C Hamano [Thu, 16 Aug 2007 19:20:25 +0000 (12:20 -0700)]
Documentation/git-rebase: fix an example

The example miscounted the commit to rebase from.
Noticed by Cliff Brake.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-clone: allow --bare clone
Junio C Hamano [Thu, 16 Aug 2007 03:55:44 +0000 (20:55 -0700)]
git-clone: allow --bare clone

This is a stop-gap to work around problem with git-init without
intrusive changes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agopack-objects: remove bogus arguments to delta_cacheable()
Nicolas Pitre [Thu, 16 Aug 2007 02:46:01 +0000 (22:46 -0400)]
pack-objects: remove bogus arguments to delta_cacheable()

Not only are they unused, but the order in the function declaration
and the actual usage don't match.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-apply: apply submodule changes
Sven Verdoolaege [Wed, 15 Aug 2007 17:22:09 +0000 (19:22 +0200)]
git-apply: apply submodule changes

Apply "Subproject commit HEX" changes produced by git-diff.
As usual in the current git, only the superproject itself is actually
modified (possibly creating empty directories for new submodules).
Any checked-out submodule is left untouched and is not required to
be up-to-date.

With clean-ups from Junio C Hamano.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUpdate documentation links for older releases.
Junio C Hamano [Wed, 15 Aug 2007 23:59:27 +0000 (16:59 -0700)]
Update documentation links for older releases.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint' to sync with 1.5.2.5
Junio C Hamano [Thu, 16 Aug 2007 04:38:38 +0000 (21:38 -0700)]
Merge branch 'maint' to sync with 1.5.2.5

* maint:
  GIT 1.5.2.5
  git-add -u paths... now works from subdirectory
  Fix "git add -u" data corruption.

16 years agoFix read-tree merging more than 3 trees using 3-way merge
Junio C Hamano [Wed, 15 Aug 2007 22:45:10 +0000 (15:45 -0700)]
Fix read-tree merging more than 3 trees using 3-way merge

For multi-base merges, we allowed read-tree -m to take more than
three trees (the last two are our and their branches, and all the
earlier ones, typically one but potentially more, are used as the
merge base).  Unfortunately, the conversion done by commit 933bf40
broke this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoGIT 1.5.2.5 v1.5.2.5
Junio C Hamano [Wed, 15 Aug 2007 22:01:20 +0000 (15:01 -0700)]
GIT 1.5.2.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-add -u paths... now works from subdirectory
Salikh Zakirov [Wed, 15 Aug 2007 17:01:43 +0000 (02:01 +0900)]
git-add -u paths... now works from subdirectory

git-add -u also takes the path limiters, but unlike the
command without the -u option, the code forgot that it
could be invoked from a subdirectory, and did not correctly
handle the prefix.

Signed-off-by: Salikh Zakirov <salikh@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix "git add -u" data corruption.
Junio C Hamano [Wed, 15 Aug 2007 21:12:14 +0000 (14:12 -0700)]
Fix "git add -u" data corruption.

This applies to 'maint' to fix a rather serious data corruption
issue.  When "git add -u" affects a subdirectory in such a way
that the only changes to its contents are path removals, the
next tree object written out of that index was bogus, as the
remove codepath forgot to invalidate the cache-tree entry.

Reported by Salikh Zakirov.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agopath-list.c: always free strdup'ed paths
René Scharfe [Wed, 15 Aug 2007 15:59:24 +0000 (17:59 +0200)]
path-list.c: always free strdup'ed paths

Always free .paths if .strdup_paths is set, no matter if the
parameter free_items is set or not, plugging a minor memory leak.
And to clarify the meaning of the flag, rename it to free_util,
since it now only affects the freeing of the .util field.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn: fix log with single revision against a non-HEAD branch
Eric Wong [Wed, 15 Aug 2007 16:55:18 +0000 (09:55 -0700)]
git-svn: fix log with single revision against a non-HEAD branch

Running git-svn log <ref> -r<rev> against a <ref> other than the
current HEAD did not work if the <rev> was exclusive to the
other branch.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoGIT 1.5.3-rc5 v1.5.3-rc5
Junio C Hamano [Wed, 15 Aug 2007 06:52:36 +0000 (23:52 -0700)]
GIT 1.5.3-rc5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoattr.c: read .gitattributes from index as well.
Junio C Hamano [Tue, 14 Aug 2007 08:41:02 +0000 (01:41 -0700)]
attr.c: read .gitattributes from index as well.

This makes .gitattributes files to be read from the index when
they are not checked out to the work tree.  This is in line with
the way we always allowed low-level tools to operate in sparsely
checked out work tree in a reasonable way.

It swaps the order of new file creation and converting the blob
to work tree representation; otherwise when we are in the middle
of checking out .gitattributes we would notice an empty but
unwritten .gitattributes file in the work tree and will ignore
the copy in the index.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoattr.c: refactoring
Junio C Hamano [Tue, 14 Aug 2007 08:40:45 +0000 (01:40 -0700)]
attr.c: refactoring

This splits out a common routine that parses a single line of
attribute file and adds it to the attr_stack.  It should not
change any behaviour, other than attrs array in the attr_stack
structure is now grown with alloc_nr() macro, instead of one by
one, which relied on xrealloc() to give enough slack to be
efficient enough.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd read_cache to builtin-check-attr
Brian Downing [Tue, 14 Aug 2007 13:18:38 +0000 (08:18 -0500)]
Add read_cache to builtin-check-attr

We can now read .gitattributes files out of the index, but the index
must be loaded for this to work.

Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodiff: squelch empty diffs even more
René Scharfe [Tue, 14 Aug 2007 22:41:00 +0000 (00:41 +0200)]
diff: squelch empty diffs even more

When we compare two non-tracked files, or explicitly
specify --no-index, the suggestion to run git-status
is not helpful.

The patch adds a new diff_options bitfield member, no_index, that
is used instead of the special value of -2 of the rev_info field
max_count to indicate that the index is not to be used.  This makes
it possible to pass that flag down to diffcore_skip_stat_unmatch(),
which only has one diff_options parameter.

This could even become a cleanup if we removed all assignments of
max_count to a value of -2 (viz. replacement of a magic value with
a self-documenting field name) but I didn't dare to do that so late
in the rc game..

The no_index bit, if set, then tells diffcore_skip_stat_unmatch()
to not account for any skipped stat-mismatches, which avoids the
suggestion to run git-status.

Signed-off-by: Rene Scharfe <rene.scharfe@lsfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUse xmkstemp() instead of mkstemp()
Luiz Fernando N. Capitulino [Tue, 14 Aug 2007 19:45:58 +0000 (16:45 -0300)]
Use xmkstemp() instead of mkstemp()

xmkstemp() performs error checking and prints a standard error message when
an error occur.

Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoIntroduces xmkstemp()
Luiz Fernando N. Capitulino [Tue, 14 Aug 2007 19:44:53 +0000 (16:44 -0300)]
Introduces xmkstemp()

This is a wrapper for mkstemp() that performs error checking and
calls die() when an error occur.

Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAvoid ambiguous error message if pack.idx header is wrong
Luiz Fernando N. Capitulino [Tue, 14 Aug 2007 19:42:37 +0000 (16:42 -0300)]
Avoid ambiguous error message if pack.idx header is wrong

Print the index version when an error occurs so the user
knows what type of header (and size) we thought the index
should have had.

Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agomerge-recursive: do not rudely die on binary merge
Junio C Hamano [Tue, 14 Aug 2007 22:33:07 +0000 (15:33 -0700)]
merge-recursive: do not rudely die on binary merge

When you try to merge a path that involves binary file-level
merge, merge-recursive died rudely without cleaning up its own
mess.  A files added by the merge were left in the working tree,
but the index was not written out (because it just punted and
died), so it was cumbersome for the user to retry it by first
running "git reset --hard".

This changes merge-recursive to still warn but do the "binary"
merge for such a path; leave the "our" version in the working
tree, but still keep the path unmerged so that the user can sort
it out.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd --log-size to git log to print message size
Marco Costalba [Fri, 20 Jul 2007 18:15:13 +0000 (20:15 +0200)]
Add --log-size to git log to print message size

With this option git-log prints log message size
just before the corresponding message.

Porcelain tools could use this to speedup parsing
of git-log output.

Note that size refers to log message only. If also
patch content is shown its size is not included.

In case it is not possible to know the size upfront
size value is set to zero.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-diff: squelch "empty" diffs
Junio C Hamano [Fri, 3 Aug 2007 20:33:31 +0000 (13:33 -0700)]
git-diff: squelch "empty" diffs

After starting to edit a working tree file but later when your edit ends
up identical to the original (this can also happen when you ran a
wholesale regexp replace with something like "perl -i" that does not
actually modify many of the paths), "git diff" between the index and the
working tree outputs many "empty" diffs that show "diff --git" headers
and nothing else, because these paths are stat-dirty.  While it was a
way to warn the user that the earlier action of the user made the index
ineffective as an optimization mechanism, it was felt too loud for the
purpose of warning even to experienced users, and also resulted in
confusing people new to git.

This replaces the "empty" diffs with a single warning message at the
end.  Having many such paths hurts performance, and you can run
"git-update-index --refresh" to update the lstat(2) information recorded
in the index in such a case.  "git-status" does so as a side effect, and
that is more familiar to the end-user, so we recommend it to them.

The change affects only "git diff" that outputs patch text, because that
is where the annoyance of too many "empty" diff is most strongly felt,
and because the warning message can be safely ignored by downstream
tools without getting mistaken as part of the patch.  For the low-level
"git diff-files" and "git diff-index", the traditional behaviour is
retained.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoImproved hint on how to set identity
Steffen Prohaska [Mon, 13 Aug 2007 22:05:50 +0000 (00:05 +0200)]
Improved hint on how to set identity

The first thing we teach in the tutorial is to set the default
identity in $HOME/.gitconfig using "git config --global".  The
suggestion in the error message should match the order, while
hinting that per repository identity can later be configured
differently.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd a test for git-commit being confused by relative GIT_DIR
David Kastrup [Mon, 13 Aug 2007 05:38:11 +0000 (07:38 +0200)]
Add a test for git-commit being confused by relative GIT_DIR

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-sh-setup.sh: make GIT_DIR absolute
David Kastrup [Sat, 11 Aug 2007 13:36:28 +0000 (15:36 +0200)]
git-sh-setup.sh: make GIT_DIR absolute

Quite a few of the scripts are rather careless about using GIT_DIR
while changing directories.

Some try their hands (with different likelihood of success) in making
GIT_DIR absolute.

This patch lets git-sh-setup.sh cater for absolute directories (in a
way that should work reliably also with non-Unix path names) and
removes the respective kludges in git-filter-branch.sh and
git-instaweb.sh.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow git-svnimport to take "" as the trunk directory.
Alberto Bertogli [Tue, 14 Aug 2007 04:03:18 +0000 (01:03 -0300)]
Allow git-svnimport to take "" as the trunk directory.

Some repositories started with the trunk in "/" and then moved it to the
standard "trunk/" location.

On these repositories, the correct thing would be to call git-svnimport -T "",
but because of the way the options are handled, it uses the default "trunk"
instead of the given empty string. This patch fixes that behaviour.

Reported by Leandro Lucarella <llucax@gmail.com>.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix t5701-clone-local for white space from wc
Brian Gernhardt [Sat, 11 Aug 2007 19:24:29 +0000 (15:24 -0400)]
Fix t5701-clone-local for white space from wc

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-p4: Fix the sorting of changelists when cloning a Perforce repository.
Reece H. Dunn [Mon, 13 Aug 2007 18:40:50 +0000 (19:40 +0100)]
git-p4: Fix the sorting of changelists when cloning a Perforce repository.

When performing a git-p4 clone operation on a Perforce repository,
where the changelists change in order of magnitude (e.g. 100 to 1000),
the set of changes to import from is not sorted properly. This is
because the data in the list is strings not integers. The other place
where this is done already converts the value to an integer, so it is
not affected.

Acked-by: Simon Hausmann <simon@lst.de>
16 years agodiff: don't run pager if user asked for a diff style exit code
René Scharfe [Sun, 12 Aug 2007 17:46:55 +0000 (19:46 +0200)]
diff: don't run pager if user asked for a diff style exit code

As Wincent Colaiuta found out, it's a bit unexpected for git diff to
start a pager even when the --quiet option is specified.  The problem
is that the pager hides the return code -- which is the only output
we're interested in in this case.

Push pager setup down into builtin-diff.c and don't start the pager
if --exit-code or --quiet (which implies --exit-code) was specified.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-bundle create - use lock_file
Junio C Hamano [Sun, 12 Aug 2007 17:44:06 +0000 (10:44 -0700)]
builtin-bundle create - use lock_file

"git bundle create" left an invalid, partially written bundle if
an error occured during creation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot3902 - skip test if file system doesn't support HT in names
Mark Levedahl [Sun, 12 Aug 2007 15:24:30 +0000 (11:24 -0400)]
t3902 - skip test if file system doesn't support HT in names

Windows / cygwin don't support HT, LF, or TAB in file name so this test
is meaningless there.

Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-add: Add support for --refresh option.
Alexandre Julliard [Sat, 11 Aug 2007 21:59:01 +0000 (23:59 +0200)]
git-add: Add support for --refresh option.

This allows to refresh only a subset of the project files, based on
the specified pathspecs.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot3404: fix "fake-editor"
Junio C Hamano [Sat, 11 Aug 2007 21:08:20 +0000 (14:08 -0700)]
t3404: fix "fake-editor"

Here-text to create fake-editor did not use <<\EOF but <<EOF,
but there was no point doing so, as it quoted all the variables
anyway.  Simplify it.

Also futureproof the special mode to edit COMMIT_EDITMSG file;
it is interested in editing the COMMIT_EDITMSG file in any
GIT_DIR; GIT_DIR may be given as an absolute path.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit.el: Always set the current directory in the git-diff buffer.
Alexandre Julliard [Sat, 11 Aug 2007 10:23:21 +0000 (12:23 +0200)]
git.el: Always set the current directory in the git-diff buffer.

This allows jumping to the correct file with the diff-mode commands.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit.el: Add support for interactive diffs.
Alexandre Julliard [Sat, 11 Aug 2007 10:22:47 +0000 (12:22 +0200)]
git.el: Add support for interactive diffs.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/gitk/gitk
Junio C Hamano [Mon, 13 Aug 2007 19:57:42 +0000 (12:57 -0700)]
Merge branch 'master' of git://git./gitk/gitk

* 'master' of git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Fix bug causing Tcl error when updating graph
  gitk: Fix bug introduced in commit 67a4f1a7
  [PATCH] gitk: Show an error and exit if no .git could be found
  [PATCH] gitk: Continue and show error message in new repos
  [PATCH] gitk: Handle MouseWheel events on Windows
  [PATCH] gitk: Enable selected patch text on Windows
  gitk: Fix bug causing the "can't unset idinlist(...)" error
  gitk: Add a context menu for file list entries

16 years agogitk: Fix bug causing Tcl error when updating graph
Paul Mackerras [Mon, 13 Aug 2007 05:02:02 +0000 (15:02 +1000)]
gitk: Fix bug causing Tcl error when updating graph

If "Show nearby tags" is turned off, selecting "Update" from the File
menu will cause a Tcl error.  This fixes it.  The problem was that
we were calling regetallcommits unconditionally, but it assumed that
getallcommits had been called previously.  This also restructures
{re,}getallcommits to be a bit simpler.

Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agogitk: Fix bug introduced in commit 67a4f1a7
Paul Mackerras [Mon, 13 Aug 2007 04:52:00 +0000 (14:52 +1000)]
gitk: Fix bug introduced in commit 67a4f1a7

In fixing the "can't unset idinlist" error, I moved the setting of
idinlist into the loop that splits the parents into "new" parents
(i.e. those of which this is the first child) and "old" parents.
Unfortunately this is incorrect in the case where we hit the break
statement a few lines further down, since when we come back in,
we'll see idinlist($p) set for some parents that aren't in the list.

This fixes it by moving the loop that sets up newolds and oldolds
further down.

Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[PATCH] gitk: Show an error and exit if no .git could be found
Alex Riesen [Sun, 29 Jul 2007 20:29:45 +0000 (22:29 +0200)]
[PATCH] gitk: Show an error and exit if no .git could be found

This is to help people starting gitk from graphical file managers where
the stderr output is hidden.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[PATCH] gitk: Continue and show error message in new repos
Alex Riesen [Sun, 29 Jul 2007 20:28:40 +0000 (22:28 +0200)]
[PATCH] gitk: Continue and show error message in new repos

If there is no commit made yet, gitk just dumps a Tcl error on stderr,
which sometimes is hard to see.  Noticed when gitk was run from Xfce
file manager (thunar's custom action).

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[PATCH] gitk: Handle MouseWheel events on Windows
Mark Levedahl [Wed, 8 Aug 2007 01:40:35 +0000 (21:40 -0400)]
[PATCH] gitk: Handle MouseWheel events on Windows

Windows, unlike X-Windows, sends mousewheel events by default to the
window that has keyboard focus and uses the MouseWheel event to do so.
The window to be scrolled must be able to take focus, but gitk's panels
are disabled so cannot take focus.  For all these reasons, a different
design is needed to use the mousewheel on Windows.  The approach here is
to bind the mousewheel events to the top level window and redirect them
based upon the current mouse position.

Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years ago[PATCH] gitk: Enable selected patch text on Windows
Mark Levedahl [Wed, 8 Aug 2007 01:40:34 +0000 (21:40 -0400)]
[PATCH] gitk: Enable selected patch text on Windows

On windows, mouse input follows the keyboard focus, so to allow selecting
text from the patch canvas we must not shift focus back to the top level.
This change has no negative impact on X, so we don't explicitly test
for Win32 on this change. This provides similar selection capability
as already available using X-Windows.

Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agogitk: Fix bug causing the "can't unset idinlist(...)" error
Paul Mackerras [Sun, 12 Aug 2007 07:23:47 +0000 (17:23 +1000)]
gitk: Fix bug causing the "can't unset idinlist(...)" error

Under some circumstances, having duplicate parents in a commit could
trigger a "can't unset idinlist" Tcl error.  This fixes the cause
(the logic in layoutrows could end up putting the same commit into
rowidlist twice) and also puts a catch around the unset to ignore
the error.

Thanks to Jeff King for coming up with a test script to generate a
repo that shows the problem.

Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agoDocumentation/Makefile: remove cmd-list.made before redirecting to it.
David Kastrup [Mon, 6 Aug 2007 13:05:56 +0000 (15:05 +0200)]
Documentation/Makefile: remove cmd-list.made before redirecting to it.

If cmd-list.made has been created by a previous run as root, output
redirection to it will fail.  So remove it before regeneration.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'cr/tag'
Junio C Hamano [Sat, 11 Aug 2007 06:17:46 +0000 (23:17 -0700)]
Merge branch 'cr/tag'

* cr/tag:
  Teach "git stripspace" the --strip-comments option
  Make verify-tag a builtin.
  builtin-tag.c: Fix two memory leaks and minor notation changes.
  launch_editor(): Heed GIT_EDITOR and core.editor settings
  Make git tag a builtin.

16 years agoINSTALL: explain info installation and dependencies.
David Kastrup [Tue, 7 Aug 2007 10:02:12 +0000 (12:02 +0200)]
INSTALL: explain info installation and dependencies.

Signed-off-by: David Kastrup <dak@gnu.org>
16 years agoAdd support for an info version of the user manual
David Kastrup [Mon, 6 Aug 2007 10:22:57 +0000 (12:22 +0200)]
Add support for an info version of the user manual

These patches use docbook2x in order to create an info version of the
git user manual.  No existing Makefile targets (including "all") are
touched, so you need to explicitly say

make info
sudo make install-info

to get git.info created and installed.  If the info target directory
does not already contain a "dir" file, no directory entry is created.
This facilitates $(DESTDIR)-based installations.  The same could be
achieved with

sudo make INSTALL_INFO=: install-info

explicitly.

perl is used for patching up sub-par file and directory information in
the Texinfo file.  It would be cleaner to place the respective info
straight into user-manual.txt or the conversion configurations, but I
find myself unable to find out how to do this with Asciidoc/Texinfo.

Signed-off-by: David Kastrup <dak@gnu.org>
16 years agoMerge branch 'jc/clone'
Junio C Hamano [Sat, 11 Aug 2007 06:05:04 +0000 (23:05 -0700)]
Merge branch 'jc/clone'

* jc/clone:
  git-clone: aggressively optimize local clone behaviour.
  connect: accept file:// URL scheme

16 years agoOptimize the three-way merge of git-read-tree
Linus Torvalds [Fri, 10 Aug 2007 19:53:51 +0000 (12:53 -0700)]
Optimize the three-way merge of git-read-tree

As mentioned, the three-way case *should* be as trivial as the
following. It passes all the tests, and I verified that a conflicting
merge in the 100,000 file horror-case merged correctly (with the conflict
markers) in 0.687 seconds with this, so it works, but I'm lazy and
somebody else should double-check it [jc: followed all three-way merge
codepaths and verified it removes when it should].

Without this patch, the merge took 8.355 seconds, so this patch
really does make a huge difference for merge performance with lots and
lots of files, and we're not talking percentages, we're talking
orders-of-magnitude differences!

Now "unpack_trees()" is just fast enough that we don't need to avoid it
(although it's probably still a good idea to eventually convert it to use
the traverse_trees() infrastructure some day - just to avoid having
extraneous tree traversal functions).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix filehandle leak in "git branch -D"
Alex Riesen [Fri, 10 Aug 2007 13:06:22 +0000 (15:06 +0200)]
Fix filehandle leak in "git branch -D"

On Windows (it can't touch open files in any way) the following fails:

    git branch -D branch1 branch2

if the both branches are in packed-refs.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-bundle - use buffered reads for bundle header
Mark Levedahl [Sat, 11 Aug 2007 00:39:24 +0000 (20:39 -0400)]
builtin-bundle - use buffered reads for bundle header

This eliminates all use of byte-at-a-time reading of data in this
function: as Junio noted, a bundle file is seekable so we can
reset the file position to the first part of the pack-file using lseek
after reading the header.

Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-bundle.c - use stream buffered input for rev-list
Mark Levedahl [Fri, 10 Aug 2007 22:29:49 +0000 (18:29 -0400)]
builtin-bundle.c - use stream buffered input for rev-list

git-bundle create on cygwin was nearly unusable due to 1 character
at a time (unbuffered) reading from an exec'ed process. Fix by using
fdopen to get a buffered stream.

Results for "time git bundle create test.bdl v1.0.3..v1.5.2" are:

before this patch:
         cygwin         linux
real    1m38.828s      0m3.578s
user    0m12.122s      0m2.896s
sys     1m28.215s      0m0.692s

after this patch:
real    0m3.688s       0m2.835s
user    0m3.075s       0m2.731s
sys     0m1.075s       0m0.149s

Signed-off-by: Mark Levedahl <mdl123@verizon.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoallow git-bundle to create bottomless bundle
Junio C Hamano [Thu, 9 Aug 2007 05:04:06 +0000 (22:04 -0700)]
allow git-bundle to create bottomless bundle

Mark Levedahl <mlevedahl@gmail.com> writes:

> Junio C Hamano wrote:
>> While "git bundle" was a useful way to sneakernet incremental
>> changes, we did not allow:
>>
> Thanks - I've been thinking for months I could fix this bug, never
> figured it out and didn't want to nag Dscho one more time. I confirm
> that this allows creation of bundles with arbitrary refs, not just
> those under refs/heads. Yahoo!

Actually, there is another bug nearby.

If you do:

git bundle create v2.6-20-v2.6.22.bndl v2.6.20..v2.6.22

the bundle records that it requires v2.6.20^0 commit (correct)
and gives you tag v2.6.22 (incorrect); the bug is that the
object it lists in fact is the commit v2.6.22^0, not the tag.

This is because the revision range operation .. is always about
set of commits, but the code near where my patch touches does
not validate that the sha1 value obtained from dwim_ref()
against the commit object name e->item->sha1 before placing the
head information in the commit.

The attached patch attempts to fix this problem.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoallow git-bundle to create bottomless bundle
Junio C Hamano [Thu, 9 Aug 2007 00:01:49 +0000 (17:01 -0700)]
allow git-bundle to create bottomless bundle

While "git bundle" was a useful way to sneakernet incremental
changes, we did not allow:

$ git bundle create v2.6.20.bndl v2.6.20

to create a bundle that contains the whole history to a
well-known good revision.  Such a bundle can be mirrored
everywhere, and people can prime their repository with it to
reduce the load on the repository that serves near the tip of
the development.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoOptimize the two-way merge of git-read-tree too
Linus Torvalds [Fri, 10 Aug 2007 19:31:20 +0000 (12:31 -0700)]
Optimize the two-way merge of git-read-tree too

This trivially optimizes the two-way merge case of git-read-tree too,
which affects switching branches.

When you have tons and tons of files in your repository, but there are
only small differences in the branches (maybe just a couple of files
changed), the biggest cost of the branch switching was actually just the
index calculations.

This fixes it (timings for switching between the "testing" and "master"
branches in the 100,000 file testing-repo-from-hell, where the branches
only differ in one small file).

Before:
[torvalds@woody bummer]$ time git checkout master
real    0m9.919s
user    0m8.461s
sys     0m0.264s

After:
[torvalds@woody bummer]$ time git checkout testing
real    0m0.576s
user    0m0.348s
sys     0m0.228s

so it's easily an order of magnitude different.

This concludes the series. I think we could/should do the three-way merge
too (to speed up merges), but I'm lazy. Somebody else can do it.

The rule is very simple: you need to remove the old entry if:
 - you want to remove the file entirely
 - you replace it with a "merge conflict" entry (ie a non-stage-0 entry)

and you can avoid removing it if you either

 - keep the old one
 - or resolve it to a new one.

and these rules should all be valid for the three-way case too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoOptimize the common cases of git-read-tree
Linus Torvalds [Fri, 10 Aug 2007 19:21:20 +0000 (12:21 -0700)]
Optimize the common cases of git-read-tree

This optimizes bind_merge() and oneway_merge() to not unnecessarily
remove and re-add the old index entries when they can just get replaced
by updated ones.

This makes these operations much faster for large trees (where "large"
is in the 50,000+ file range), because we don't unnecessarily move index
entries around in the index array all the time.

Using the "bummer" tree (a test-tree with 100,000 files) we get:

Before:
[torvalds@woody bummer]$ time git commit -m"Change one file" 50/500
real    0m9.470s
user    0m8.729s
sys     0m0.476s

After:
[torvalds@woody bummer]$ time git commit -m"Change one file" 50/500
real    0m1.173s
user    0m0.720s
sys     0m0.452s

so for large trees this is easily very noticeable indeed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMove old index entry removal from "unpack_trees()" into the individual functions
Linus Torvalds [Fri, 10 Aug 2007 19:15:54 +0000 (12:15 -0700)]
Move old index entry removal from "unpack_trees()" into the individual functions

This makes no changes to current code, but it allows the individual merge
functions to decide what to do about the old entry.  They might decide to
update it in place, rather than force them to always delete and re-add it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'lt/readtree'
Junio C Hamano [Fri, 10 Aug 2007 20:58:45 +0000 (13:58 -0700)]
Merge branch 'lt/readtree'

* lt/readtree:
  Start moving unpack-trees to "struct tree_desc"

16 years agoFix "git commit directory/" performance anomaly
Linus Torvalds [Fri, 10 Aug 2007 16:51:58 +0000 (09:51 -0700)]
Fix "git commit directory/" performance anomaly

This trivial patch avoids re-hashing files that are already clean in the
index. This mirrors what commit 0781b8a9b2fe760fc4ed519a3a26e4b9bd6ccffe
did for "git add .", only for "git commit ." instead.

This improves the cold-cache case immensely, since we don't need to bring
in all the file contents, just the index and any files dirty in the index.

Before:

[torvalds@woody linux]$ time git commit .
real    1m49.537s
user    0m3.892s
sys     0m2.432s

After:

[torvalds@woody linux]$ time git commit .
real    0m14.273s
user    0m1.312s
sys     0m0.516s

(both after doing a "echo 3 > /proc/sys/vm/drop_caches" to get cold-cache
behaviour - even with the index optimization git still has to "lstat()"
all the files, so with a truly cold cache, bringing all the inodes in
will take some time).

[jc: trivial "return 0;" fixed]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoOptimize "diff --cached" performance.
Junio C Hamano [Thu, 9 Aug 2007 20:42:50 +0000 (13:42 -0700)]
Optimize "diff --cached" performance.

The read_tree() function is called only from the call chain to
run "git diff --cached" (this includes the internal call made by
git-runstatus to run_diff_index()).  The function vacates stage
without any funky "merge" magic.  The caller then goes and
compares stage #1 entries from the tree with stage #0 entries
from the original index.

When adding the cache entries this way, it used the general
purpose add_cache_entry().  This function looks for an existing
entry to replace or if there is none to find where to insert the
new entry, resolves D/F conflict and all the other things.

For the purpose of reading entries into an empty stage, none of
that processing is needed.  We can instead append everything and
then sort the result at the end.

This commit changes read_tree() to first make sure that there is
no existing cache entries at specified stage, and if that is the
case, it runs add_cache_entry() with ADD_CACHE_JUST_APPEND flag
(new), and then sort the resulting cache using qsort().

This new flag tells add_cache_entry() to omit all the checks
such as "Does this path already exist?  Does adding this path
remove other existing entries because it turns a directory to a
file?" and instead append the given cache entry straight at the
end of the active cache.  The caller of course is expected to
sort the resulting cache at the end before using the result.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRevert "tweak manpage formatting"
Junio C Hamano [Fri, 10 Aug 2007 18:32:42 +0000 (11:32 -0700)]
Revert "tweak manpage formatting"

This reverts commit 524e5ffcf41a67ec113a9c3730ddc8fb8d3317f5.
It is reported that this change breaks formatting with docbook
1.69.

16 years agoStart moving unpack-trees to "struct tree_desc"
Linus Torvalds [Fri, 10 Aug 2007 05:21:29 +0000 (22:21 -0700)]
Start moving unpack-trees to "struct tree_desc"

This doesn't actually change any real code, but it changes the interface
to unpack_trees() to take an array of "struct tree_desc" entries, the same
way the tree-walk.c functions do.

The reason for this is that we would be much better off if we can do the
tree-unpacking using the generic "traverse_trees()" functionality instead
of having to the special "unpack" infrastructure.

This really is a pretty minimal diff, just to change the calling
convention. It passes all the tests, and looks sane. There were only two
users of "unpack_trees()": builtin-read-tree and merge-recursive, and I
tried to keep the changes minimal.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoReinstate the old behaviour when GIT_DIR is set and GIT_WORK_TREE is unset
Johannes Schindelin [Sun, 5 Aug 2007 13:12:53 +0000 (14:12 +0100)]
Reinstate the old behaviour when GIT_DIR is set and GIT_WORK_TREE is unset

The old behaviour was to unilaterally default to the cwd is the work tree
when GIT_DIR was set, but GIT_WORK_TREE wasn't, no matter if we are inside
the GIT_DIR, or if GIT_DIR is actually something like ../../../.git.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agotweak manpage formatting
Junio C Hamano [Fri, 10 Aug 2007 07:49:26 +0000 (00:49 -0700)]
tweak manpage formatting

This attempts to force fixed-font in manpages for literal
blocks.  I have tested this with docbook 1.71 and it seems to
work as expected.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix an illustration in git-rev-parse.txt
Junio C Hamano [Fri, 10 Aug 2007 07:49:27 +0000 (00:49 -0700)]
Fix an illustration in git-rev-parse.txt

This hides the backslash at the end of line from AsciiDoc
toolchain by introducing a trailing whitespace on one line in an
illustration in git-rev-parse.txt.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosend-email: get all the quoting of realnames right
Uwe Kleine-König [Thu, 9 Aug 2007 13:27:58 +0000 (15:27 +0200)]
send-email: get all the quoting of realnames right

- when sending several mails I got a slightly different behaviour for the first
  mail compared to the second to last one.  The reason is that $from was
  assigned in line 608 and was not reset when beginning to handle the next
  mail.

- Email::Valid can only handle properly quoted real names, so quote arguments
  to extract_valid_address.

This patch cleans up variable naming to better differentiate between sender of
the mail and it's author.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosend-email: rfc822 forbids using <address@domain> without a non-empty "phrase"
Uwe Kleine-König [Thu, 9 Aug 2007 13:27:57 +0000 (15:27 +0200)]
send-email: rfc822 forbids using <address@domain> without a non-empty "phrase"

Email::Valid does respect this considering such a mailbox specification
invalid.  b06c6bc831cbb9e9eb82fd3ffd5a2b674cd940d0 addressed the issue, but
only if Email::Valid is available.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUse the empty tree for base diff in paranoid-update on new branches
Shawn O. Pearce [Thu, 9 Aug 2007 06:38:16 +0000 (02:38 -0400)]
Use the empty tree for base diff in paranoid-update on new branches

We have to load a tree difference for the purpose of testing
file patterns.  But if our branch is being created and there is no
specific base to difference against in the rule our base will be
'0'x40.  This is (usually) not a valid tree-ish object in a Git
repository, so there's nothing to difference against.

Instead of creating the empty tree and running git-diff against
that we just take the output of `ls-tree -r --name-only` and mark
every returned pathname as an add.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoTeach the update-paranoid to look at file differences
Shawn O. Pearce [Thu, 9 Aug 2007 06:38:12 +0000 (02:38 -0400)]
Teach the update-paranoid to look at file differences

In some applications of the update hook a user may be allowed to
modify a branch, but only if the file level difference is also an
allowed change.  This is the commonly requested feature of allowing
users to modify only certain files.

A new repository.*.allow syntax permits granting the three basic
file level operations:

  A: file is added relative to the other tree
  M: file exists in both trees, but its SHA-1 or mode differs
  D: file is removed relative to the other tree

on a per-branch and path-name basis.  The user must also have a
branch level allow line already granting them access to create,
rewind or update (CRU) that branch before the hook will consult
any file level rules.

In order for a branch change to succeed _all_ files that differ
relative to some base (by default the old value of this branch,
but it can also be any valid tree-ish) must be allowed by file
level allow rules.  A push is rejected if any diff exists that
is not covered by at least one allow rule.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoTeach update-paranoid how to store ACLs organized by groups
Shawn O. Pearce [Thu, 9 Aug 2007 06:38:09 +0000 (02:38 -0400)]
Teach update-paranoid how to store ACLs organized by groups

In some applications of this paranoid update hook the set of ACL
rules that need to be applied to a user can be large, and the
number of users that those rules must also be applied to can be
more than a handful of individuals.  Rather than repeating the same
rules multiple times (once for each user) we now allow users to be
members of groups, where the group supplies the list of ACL rules.
For various reasons we don't depend on the underlying OS groups
and instead perform our own group handling.

Users can be made a member of one or more groups by setting the
user.memberOf property within the "users/$who.acl" file:

  [user]
    memberOf = developer
memberOf = administrator

This will cause the hook to also parse the "groups/$groupname.acl"
file for each value of user.memberOf, and merge any allow rules
that match the current repository with the user's own private rules
(if they had any).

Since some rules are basically the same but may have a component
differ based on the individual user, any user.* key may be inserted
into a rule using the "${user.foo}" syntax.  The allow rule does
not match if the user does not define one (and exactly one) value
for the key "foo".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix formatting of git-blame documentation.
Junio C Hamano [Fri, 10 Aug 2007 07:47:28 +0000 (00:47 -0700)]
Fix formatting of git-blame documentation.

blame-options.txt did not format multi-paragraph option description
correctly.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocvsserver: Fix for work trees
Brian Downing [Thu, 9 Aug 2007 04:26:10 +0000 (23:26 -0500)]
cvsserver: Fix for work trees

git-cvsserver used checkout-index internally for commit and annotate.
Since a work tree is required for this to function now, this was
breaking.  Work around this by defining GIT_WORK_TREE=. in the
appropriate places.

Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-p4: Fix git-p4 submit to include only changed files in the perforce submit template.
Simon Hausmann [Wed, 8 Aug 2007 15:06:55 +0000 (17:06 +0200)]
git-p4: Fix git-p4 submit to include only changed files in the perforce submit template.

Parse the files section in the "p4 change -o" output and remove lines with file changes in unrelated depot paths.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoReorder the list of commands in the manual.
Junio C Hamano [Wed, 8 Aug 2007 20:41:46 +0000 (13:41 -0700)]
Reorder the list of commands in the manual.

The basic idea was proposed by Steve Hoelzer; in order to make
the list easier to search, we keep the command list in the
script that generates it with "sort -d".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-p4: Fix support for symlinks.
Simon Hausmann [Tue, 7 Aug 2007 10:28:00 +0000 (12:28 +0200)]
git-p4: Fix support for symlinks.

Detect symlinks as file type, set the git file mode accordingly and strip off the trailing newline in the p4 print output.
Make the mode handling a bit more readable at the same time.

Signed-off-by: Simon Hausmann <simon@lst.de>
Acked-by: Brian Swetland <swetland@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-stash documentation: add missing backtick
Steve Hoelzer [Tue, 7 Aug 2007 17:38:29 +0000 (12:38 -0500)]
git-stash documentation: add missing backtick

Signed-off-by: Steve Hoelzer <shoelzer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-stash documentation: stash numbering starts at zero, not one
Steve Hoelzer [Tue, 7 Aug 2007 17:39:03 +0000 (12:39 -0500)]
git-stash documentation: stash numbering starts at zero, not one

Signed-off-by: Steve Hoelzer <shoelzer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd a note about the index being updated by git-status in some cases
Steven Grimm [Tue, 7 Aug 2007 05:57:47 +0000 (22:57 -0700)]
Add a note about the index being updated by git-status in some cases

Signed-off-by: Steven Grimm <koreth@midwinter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-commit.txt: correct bad list formatting.
David Kastrup [Mon, 6 Aug 2007 12:56:32 +0000 (14:56 +0200)]
Documentation/git-commit.txt: correct bad list formatting.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosend-email: teach sanitize_address to do rfc2047 quoting
Uwe Kleine-K\e,Av\e(Bnig [Mon, 6 Aug 2007 20:34:50 +0000 (22:34 +0200)]
send-email: teach sanitize_address to do rfc2047 quoting

Without this patch I'm not able to properly send emails as I have a
non-ascii character in my name.

I removed the _rfc822 suffix from the function name as it now does more
than rfc822 quoting.

I dug through rfc822 to do the double quoting right.  Only if that is not
possible rfc2047 quoting is applied.

Signed-off-by: Uwe Kleine-K\e,Av\e(Bnig <ukleinek@informatik.uni-freiburg.de>
Cc: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix "make GZ=1 quick-install-doc"
Junio C Hamano [Tue, 7 Aug 2007 04:15:15 +0000 (21:15 -0700)]
Fix "make GZ=1 quick-install-doc"

The basic idea is from Mark Levedahl.  I do not use GZ=1 nor
quick-install-doc myself (there obviously is a chicken-and-egg
issue with quick-install-doc for me).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agopager: find out pager setting from configuration
Junio C Hamano [Tue, 7 Aug 2007 04:08:43 +0000 (21:08 -0700)]
pager: find out pager setting from configuration

It was very unfortunate that we added core.pager setting to the
configuration file; even when the underlying command does not care
if there is no git repository is involved (think "git diff --no-index"),
the user would now rightfully want the configuration setting to be
honored, which means we would need to read the configuration file before
we launch the pager.

This is a minimum change in the sense that it restores the old
behaviour of not even reading config in setup_git_directory(),
but have the core.pager honored when we know it matters.

Note that this does not cover "git -p --git-dir where command";
the -p option immediately trigger the pager settings before we
even see --git-dir to learn where the configuration file is, so
we will end up reading the configuration from the place where
we would _normally_ find the git repository.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-am: initialize variable $resume on startup
Gerrit Pape [Mon, 6 Aug 2007 14:15:30 +0000 (14:15 +0000)]
git-am: initialize variable $resume on startup

git-am expects the variable $resume to be empty or unset, which might not
be the case if $resume is set in the user's environment.  So initialize
it to an empty value on startup.

The problem was noticed by Pierre Habouzit and reported through
 http://bugs.debian.org/435807

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-svn: how to clone a git-svn-created repository
Adam Roben [Mon, 6 Aug 2007 08:16:43 +0000 (01:16 -0700)]
Documentation/git-svn: how to clone a git-svn-created repository

These instructions tell you how to create a clone of a repository
created with git-svn, that can in turn be used with git-svn.

Signed-off-by: Adam Roben <aroben@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>