git.git
18 years agouse "git init-db" in tests
Alex Riesen [Thu, 8 Dec 2005 20:25:55 +0000 (21:25 +0100)]
use "git init-db" in tests

This is to catch an error where tests are run without first
building what are being tested.  Relying on prefixing $PATH with
the build directory and expect that the PATH mechanism would
find what we just built would silently run an already installed
binaries from the PATH.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-prune: never lose objects reachable from our refs.
Junio C Hamano [Fri, 9 Dec 2005 07:18:41 +0000 (23:18 -0800)]
git-prune: never lose objects reachable from our refs.

Explicit <head> arguments to git-prune replaces, instead of
extends, the list of heads used for reachability analysis by
fsck-objects.  By giving a subset of heads by mistake, objects
reachable only from other heads can be removed, resulting in a
corrupted repository.

This commit stops replacing the list of heads, and makes the
command line arguments to add to them instead for safety.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoqsort(): ptrdiff_t may be larger than int
Junio C Hamano [Fri, 9 Dec 2005 01:29:11 +0000 (17:29 -0800)]
qsort(): ptrdiff_t may be larger than int

This is a companion patch to e23eff8be92a2a2cb66b53deef020063cff285ed
commit.  The same logic, the same rationale that a comparison
function that returns an int should not just compute a ptrdiff_t
and return it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: git-prune
Junio C Hamano [Fri, 9 Dec 2005 00:30:24 +0000 (16:30 -0800)]
Documentation: git-prune

Not replacing but always including our own refs may be more
desirable (and unarguably much safer), but at the same time I
have a suspicion that that might be forbidding a useful usage I
haven't thought of, so...

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/git-read-tree.txt: Add --reset to SYNOPSIS.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:06 +0000 (00:28 +0100)]
Documentation/git-read-tree.txt: Add --reset to SYNOPSIS.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/git-tag.txt: Fix the order of sections (DESCRIPTION should come before...
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Documentation/git-tag.txt: Fix the order of sections (DESCRIPTION should come before OPTIONS).

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/git-update-server-info.txt: Add -f alias for --force to documentation.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Documentation/git-update-server-info.txt: Add -f alias for --force to documentation.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/git-http-fetch.txt: Document the commit-id argument.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Documentation/git-http-fetch.txt: Document the commit-id argument.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/git-repack.txt: Add -l and -n.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Documentation/git-repack.txt: Add -l and -n.

This adds documentation for the -l and -n options to git-repack.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/git-ls-remote.txt: Add -h and -t.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Documentation/git-ls-remote.txt: Add -h and -t.

-h and -t are aliases for --heads and --tags to git-ls-remote.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/git-format-patch.txt: Add --signoff, --check, and long option-names.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Documentation/git-format-patch.txt: Add --signoff, --check, and long option-names.

The documentation was lacking descriptions for the --signoff and --check
options to git-format-patch.  It was also missing the following long
option-names: --output-directory (-o), --numbered (-n), --keep-subject
(-k), --author (-a), --date (-d), and --mbox (-m).

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoAdd documentation for the --topo-order option to git-show-branch.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Add documentation for the --topo-order option to git-show-branch.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoAdd documentation for git-revert and git-cherry-pick.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Add documentation for git-revert and git-cherry-pick.

* Added the -e option to the documentation of git-cherry-pick.
* Added the -e and --no-commit option to git-revert.
* Removed redundant case expression for -n as --no-edit (already taken by
  --no-commit).

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/git-cherry-pick: Add --replay and --no-commit.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Documentation/git-cherry-pick: Add --replay and --no-commit.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/git-cvsimport.txt: Fix a slight glitch in description heading.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Documentation/git-cvsimport.txt: Fix a slight glitch in description heading.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/git-verify-pack.txt: added documentation for --.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Documentation/git-verify-pack.txt: added documentation for --.

The -- option has been added to the documentation of git-verify-pack.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation/git-commit.txt: Add long options and -- to documentation.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Documentation/git-commit.txt: Add long options and -- to documentation.

Added the following long options to documentation:

* --all
* --signoff
* --verify
* --no-verify
* --edit

Also added documentation for the -- option for terminating option parsing.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoUse uniform description for the '--' option.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Use uniform description for the '--' option.

All descriptions of the '--' option were the same except for that in
Documentation/git-merge-index.txt.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoFix the description of --utf8 and --keep to git-am.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Fix the description of --utf8 and --keep to git-am.

The git-am script actually transform --utf8 and --keep to -u and -k when
sent to git-mailinfo.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocument the --non-empty command-line option to git-pack-objects.
Nikolai Weibull [Thu, 8 Dec 2005 23:28:05 +0000 (00:28 +0100)]
Document the --non-empty command-line option to git-pack-objects.

This provides (minimal) documentation for the --non-empty command-line
option to the pack-objects command.

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoshow-branch: comment typo
Junio C Hamano [Thu, 8 Dec 2005 22:10:02 +0000 (14:10 -0800)]
show-branch: comment typo

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: recursive is the default strategy these days.
Junio C Hamano [Thu, 8 Dec 2005 22:04:33 +0000 (14:04 -0800)]
Documentation: recursive is the default strategy these days.

We still said resolve was the default in handful places.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMake sure we use compat/subprocess.py with Python 2.3 while running tests.
Junio C Hamano [Thu, 8 Dec 2005 05:52:28 +0000 (21:52 -0800)]
Make sure we use compat/subprocess.py with Python 2.3 while running tests.

Otherwise the test will not succeed without installing.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoClean up file descriptors when calling hooks.
Daniel Barkalow [Thu, 8 Dec 2005 02:04:38 +0000 (21:04 -0500)]
Clean up file descriptors when calling hooks.

When calling post-update hook, don't leave stdin and stdout connected to
the pushing connection.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agorefs.c: make sure leading directories exist before writing a ref.
Junio C Hamano [Thu, 8 Dec 2005 01:48:53 +0000 (17:48 -0800)]
refs.c: make sure leading directories exist before writing a ref.

Otherwise cloning a repository with hierarchical branch/tag
over http would fail.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation(tutorial): adjust merge example to the new merge world order.
Junio C Hamano [Thu, 8 Dec 2005 00:44:12 +0000 (16:44 -0800)]
Documentation(tutorial): adjust merge example to the new merge world order.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation(cvs-migration): minor cleanups.
Junio C Hamano [Thu, 8 Dec 2005 00:26:49 +0000 (16:26 -0800)]
Documentation(cvs-migration): minor cleanups.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation(glossary): minor formatting clean-ups.
Junio C Hamano [Thu, 8 Dec 2005 00:16:04 +0000 (16:16 -0800)]
Documentation(glossary): minor formatting clean-ups.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: git.html/git.7
Junio C Hamano [Thu, 8 Dec 2005 00:05:21 +0000 (16:05 -0800)]
Documentation: git.html/git.7

Finish each sentence with a full stop.

Instead of saying 'directory index' 'directory cache' etc,
consistently say 'index'.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoMerge http://www.kernel.org/pub/scm/gitk/gitk
Junio C Hamano [Wed, 7 Dec 2005 19:25:42 +0000 (11:25 -0800)]
Merge http://www.kernel.org/pub/scm/gitk/gitk

18 years agogitk: Work around Tcl's non-standard names for encodings
Paul Mackerras [Wed, 7 Dec 2005 12:28:22 +0000 (23:28 +1100)]
gitk: Work around Tcl's non-standard names for encodings

This uses a table of encoding names and aliases distilled from
http://www.iana.org/assignments/character-sets plus some heuristics
to convert standard encoding names to ones that Tcl recognizes.

Signed-off-by: Paul Mackerras <paulus@samba.org>
18 years agoupdate-index: allow --index-info to add higher stages.
Junio C Hamano [Wed, 7 Dec 2005 09:45:38 +0000 (01:45 -0800)]
update-index: allow --index-info to add higher stages.

The new merge world order tells the merge strategies to leave
the cache unmerged and store the automerge result in the working
tree if automerge is not clean.  This was done for the resolve
strategy and recursive strategy when no rename is involved, but
recording a conflicting merge in the rename case could not
easily be done by the recursive strategy.

This commit adds a new input format, in addition to the exsting
two, to "update-index --index-info".

    (1) mode         SP sha1          TAB path
    The first format is what "git-apply --index-info"
    reports, and used to reconstruct a partial tree
    that is used for phony merge base tree when falling
    back on 3-way merge.

    (2) mode SP type SP sha1          TAB path
    The second format is to stuff git-ls-tree output
    into the index file.

    (3) mode         SP sha1 SP stage TAB path
    This format is to put higher order stages into the
    index file and matches git-ls-files --stage output.

To place a higher stage entry to the index, the path should
first be removed by feeding a mode=0 entry for the path, and
then feeding necessary input lines in the (3) format.

For example, starting with this index:

$ git ls-files -s
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 0       frotz

$ git update-index --index-info ;# interactive session -- input follows...

0000000000000000000000000000000000000000 frotz
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz
100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz

The first line of the input feeds 0 as the mode to remove the
path; the SHA1 does not matter as long as it is well formatted.
Then the second and third line feeds stage 1 and stage 2 entries
for that path.  After the above, we would end up with this:

$ git ls-files -s
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1 frotz
100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2 frotz

This completes the groundwork for the new merge world order.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-merge-one: new merge world order.
Junio C Hamano [Wed, 7 Dec 2005 08:50:33 +0000 (00:50 -0800)]
git-merge-one: new merge world order.

This does two things:

 - Use new --stage=2 option to create the working tree file with
   leading paths and correct permission bits using
   checkout-index, as before.

 - Make sure we do not confuse "merge" program when the file
   being merged has an unfortunate name, '-L'.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agocheckout-index: allow checking out from higher stages.
Junio C Hamano [Wed, 7 Dec 2005 08:29:51 +0000 (00:29 -0800)]
checkout-index: allow checking out from higher stages.

The new option, --stage=<n>, lets you copy out from an unmerged,
higher stage.  This is to help the new merge world order during
a nontrivial merge.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoUse printf rather than echo -n.
Jason Riedy [Tue, 6 Dec 2005 22:21:52 +0000 (14:21 -0800)]
Use printf rather than echo -n.

On AIX, there is no -n option to the system's echo.  Instead,
it needs the '\c' control character.  We could replace
  echo -n "foo"
with
  echo -e "foo\c"
but printf is recommended by most man pages.  Tested on AIX
5.3, Solaris 8, and Debian.

[jc: futureproofed two instances that uses variable with '%s'
 so later feeding different messages would not break things too
 easily; others are emitting literal so whoever changes the
 literal ought to notice more easily so they are safe.]

Signed-off-by: E. Jason Riedy <ejr@cs.berkeley.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoqsort() ptrdiff_t may be larger than int
Junio C Hamano [Tue, 6 Dec 2005 21:41:48 +0000 (13:41 -0800)]
qsort() ptrdiff_t may be larger than int

Morten Welinder <mwelinder@gmail.com> writes:

> The code looks wrong.  It assumes that pointers are no larger than ints.
> If pointers are larger than ints, the code does not necessarily compute
> a consistent ordering and qsort is allowed to do whatever it wants.
>
> Morten
>
> static int compare_object_pointers(const void *a, const void *b)
> {
>  const struct object * const *pa = a;
>  const struct object * const *pb = b;
>  return *pa - *pb;
> }

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years ago[PATCH] Initial AIX portability fixes.
Jason Riedy [Tue, 6 Dec 2005 22:20:16 +0000 (14:20 -0800)]
[PATCH] Initial AIX portability fixes.

Added an AIX clause in the Makefile; that clause likely
will be wrong for any AIX pre-5.2, but I can only test
on 5.3.  mailinfo.c was missing the compat header file,
and convert-objects.c needs to define a specific
_XOPEN_SOURCE as well as _XOPEN_SOURCE_EXTENDED.

Signed-off-by: E. Jason Riedy <ejr@cs.berkeley.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-merge-one-file: resurrect leading path creation.
Junio C Hamano [Tue, 6 Dec 2005 08:07:58 +0000 (00:07 -0800)]
git-merge-one-file: resurrect leading path creation.

Since we do not use git-update-index followed by
git-checkout-index -u to create the half-merged file on
conflicting case anymore, we need to make sure the leading
directories are created here.

Maybe a better solution would be to allow update-index to add to
higher stage, and checkout-index to extract from such, but that
is a change slightly bigger than I would like to have so close
to 1.0, so this should do for now.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentaiton (read-tree): update description of 3-way
Junio C Hamano [Tue, 6 Dec 2005 07:26:10 +0000 (23:26 -0800)]
Documentaiton (read-tree): update description of 3-way

The merge-one-file used to leave the working tree intact, but
it has long been changed to leave the merge result there since
2a68a8659f7dc55fd285d235ae2d19e7a8116c30 commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: hash-object.
Junio C Hamano [Tue, 6 Dec 2005 06:36:22 +0000 (22:36 -0800)]
Documentation: hash-object.

The file parameter is better spelled just "file", not "any file
on the filesystem".  We stress that in the description text
later anyway.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agowrite-tree: check extra arguments and die but be a bit more helpful.
Junio C Hamano [Tue, 6 Dec 2005 06:30:07 +0000 (22:30 -0800)]
write-tree: check extra arguments and die but be a bit more helpful.

"git-write-tree junk" complains and dies, but it does not say
what option it supports.  Die with the usage string in such a
case.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoinit-db: check extra arguments and complain.
Junio C Hamano [Tue, 6 Dec 2005 06:29:36 +0000 (22:29 -0800)]
init-db: check extra arguments and complain.

"git-init-db junk" does not complain but just ignores "junk".
Die with the usage string in such a case.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agohash-object: -- and --help
Junio C Hamano [Tue, 6 Dec 2005 06:29:05 +0000 (22:29 -0800)]
hash-object: -- and --help

It was cumbersome to feed hash-object the file '-t' (you could
have said "./-t", though).  Teach it '--' that terminates the
option list, like everybody else.  There is no way to extract
usage string from the command either, so teach it "--help" as
well.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoAdded documentation for few missing options.
Jon Loeliger [Tue, 6 Dec 2005 05:13:03 +0000 (23:13 -0600)]
Added documentation for few missing options.

More $ shell prompts in examples.
Minor English grammar improvements.
Added a few "See Also"s.
Use back-ticks on more command examples.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit-mv to work with Perl 5.6
Junio C Hamano [Tue, 6 Dec 2005 02:14:34 +0000 (18:14 -0800)]
git-mv to work with Perl 5.6

List form of pipe open is 5.8 invention.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoFix 5501 test
Junio C Hamano [Tue, 6 Dec 2005 02:13:31 +0000 (18:13 -0800)]
Fix 5501 test

Not everybody can rely on /bin/sh to be sane, and we support
SHELL_PATH for that.  Use it.

mktemp(1) is not used anywhere else in the core git.  Do not
introduce dependency on it.

Not everybody's "which" gives a sane return value.  For example,
on Solaris 'which XXX' says "no XXX in /usr/bin /bin ..." and
exits with zero status.  The lesson here is to never use 'which'
in your scripts.

Signed-off-by: Junio C Hamano <junkio@twinsun.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoClean up compatibility definitions.
Junio C Hamano [Mon, 5 Dec 2005 19:54:29 +0000 (11:54 -0800)]
Clean up compatibility definitions.

This attempts to clean up the way various compatibility
functions are defined and used.

 - A new header file, git-compat-util.h, is introduced.  This
   looks at various NO_XXX and does necessary function name
   replacements, equivalent of -Dstrcasestr=gitstrcasestr in the
   Makefile.

 - Those function name replacements are removed from the Makefile.

 - Common features such as usage(), die(), xmalloc() are moved
   from cache.h to git-compat-util.h; cache.h includes
   git-compat-util.h itself.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogitk: Some improvements for the code for updating the display
Paul Mackerras [Mon, 5 Dec 2005 22:46:23 +0000 (09:46 +1100)]
gitk: Some improvements for the code for updating the display

This should be more robust in the case that some does "Update" before
the initial drawing is finished.  It also avoids having to reset the
list of children for each commit and reconstruct it.

Signed-off-by: Paul Mackerras <paulus@samba.org>
18 years ago[PATCH] Document config.mak in INSTALL.
Jason Riedy [Mon, 5 Dec 2005 18:38:30 +0000 (10:38 -0800)]
[PATCH] Document config.mak in INSTALL.

The existing config.mak should satisfy almost everyone...  You
can change the prefix and other vars catch the new setting
anyways.  I had forgotten that ?= acts as = (lazy value binding)
and as not := (immediate value binding).

Signed-off-by: E. Jason Riedy <ejr@cs.berkeley.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoconfig.c: remove unnecessary header in minimum configuration file.
Junio C Hamano [Fri, 25 Nov 2005 22:22:27 +0000 (14:22 -0800)]
config.c: remove unnecessary header in minimum configuration file.

It is just silly to start the file called "config" with a
comment that says "This is the config file."

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoserver-info.c: and two functions are not used anymore.
Junio C Hamano [Mon, 5 Dec 2005 19:12:01 +0000 (11:12 -0800)]
server-info.c: and two functions are not used anymore.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoserver-info.c: use pack_local like everybody else.
Junio C Hamano [Mon, 5 Dec 2005 18:39:17 +0000 (10:39 -0800)]
server-info.c: use pack_local like everybody else.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: shared repository management in tutorial.
Junio C Hamano [Mon, 5 Dec 2005 08:57:48 +0000 (00:57 -0800)]
Documentation: shared repository management in tutorial.

The branch policy script I outlined was improved and polished by
Carl and posted on the list twice since then.  It is a shame not
to pick it up, so replace the original outline in
howto/update-hook-example.txt with the latest from Carl.

Also talk about setting up git-shell to allow git-push/git-fetch
only SSH access to a shared repository host in the tutorial.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: push/receive hook references.
Junio C Hamano [Mon, 5 Dec 2005 08:32:01 +0000 (00:32 -0800)]
Documentation: push/receive hook references.

Mention documentation pages that talk about update and
post-update hooks from git-push, because a frequently asked
question is "I want X to happen when I push" and people would
not know to look at git-receive-pack documentation until they
understand that is what runs on the other end.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: git-diff asciidoc table workaround.
Junio C Hamano [Mon, 5 Dec 2005 08:22:01 +0000 (00:22 -0800)]
Documentation: git-diff asciidoc table workaround.

The table facility was nice in rendering HTML but was disastrous
for man page.  Reword the text and do not use table for now.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: git-mv manpage workaround.
Junio C Hamano [Mon, 5 Dec 2005 08:15:44 +0000 (00:15 -0800)]
Documentation: git-mv manpage workaround.

Work-around asciidoc manpage trouble that does not seem to allow
more than one line in the SYNOPSIS section.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: talk about pathspec in bisect.
Junio C Hamano [Mon, 5 Dec 2005 08:15:24 +0000 (00:15 -0800)]
Documentation: talk about pathspec in bisect.

Also work-around asciidoc manpage trouble that does not seem to
allow more than one line in the SYNOPSIS section.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoserver-info: throw away T computation as well.
Junio C Hamano [Mon, 5 Dec 2005 07:12:36 +0000 (23:12 -0800)]
server-info: throw away T computation as well.

Again, dumb transport clients are too dumb to make use of the
top objects information to make a choice among multiple packs,
so computing these lines are useless for now.  We could
resurrect them if needed later.  Also dumb transport clients
presumably can do their own approximation by downloading idx
files to see how relevant each pack is for their fetch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoserver-info: stop sorting packs by latest date.
Junio C Hamano [Mon, 5 Dec 2005 07:02:54 +0000 (23:02 -0800)]
server-info: stop sorting packs by latest date.

This does not seem to buy us much, for the same reason as the
previous change.  Dumb clients are still too dumb.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoserver-info.c: drop unused D lines.
Junio C Hamano [Mon, 5 Dec 2005 06:52:19 +0000 (22:52 -0800)]
server-info.c: drop unused D lines.

We tried to compute pack interdependency information in
$GIT_DIR/objects/info/packs, hoping that dumb transports would
make use of it when choosing from multiple choice, but that has
never materialized, so stop computing D lines for now.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agosha1_file.c: make sure packs in an alternate odb is named properly.
Junio C Hamano [Mon, 5 Dec 2005 06:48:43 +0000 (22:48 -0800)]
sha1_file.c: make sure packs in an alternate odb is named properly.

We somehow ended up registering packs in alternate object
directories as "dir/object//pack/pack-*", which confusd the
update-server-info code very badly.  Also we did not attempt to
detect a mistake of listing the object directory itself as one
of the alternates. This does not lead to incorrect behaviour,
but is simply wasteful, so try to do so when we are trivially
able to.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit.c: remove excess output for debugging when command is too long.
Junio C Hamano [Mon, 5 Dec 2005 05:24:22 +0000 (21:24 -0800)]
git.c: remove excess output for debugging when command is too long.

When the given command name was too long, we exited with a
message with the number of bytes of the final command name
inside parentheses, without saying what that number is.  It was
only meant as a debugging aid while development, so remove it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agostruct tree: remove unused field "parent"
Junio C Hamano [Mon, 5 Dec 2005 05:13:57 +0000 (21:13 -0800)]
struct tree: remove unused field "parent"

The field is not used anymore, after the recent ls-tree rewrite.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocumentation: rebase does not use cherry-pick anymore.
Junio C Hamano [Mon, 5 Dec 2005 00:38:40 +0000 (16:38 -0800)]
Documentation: rebase does not use cherry-pick anymore.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoDocument the --(no-)edit switch of git-revert and git-cherry-pick
Petr Baudis [Sat, 26 Nov 2005 22:12:44 +0000 (23:12 +0100)]
Document the --(no-)edit switch of git-revert and git-cherry-pick

This switch was not documented properly. I decided not to mention
the --no-edit switch in the git-cherry-pick documentation since
we always default to no editing.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoshow-branch: allow glob pattern to name branches to show.
Junio C Hamano [Sun, 4 Dec 2005 23:58:50 +0000 (15:58 -0800)]
show-branch: allow glob pattern to name branches to show.

With this, you can say "git-show-branch topic/* master" to show
all the topic branches you have under .git/refs/heads/topic/ and
your master branch.  Another example is "git-show-branch --list
v1.0*" to show all the v1.0 tags.  You can disambiguate by
saying "heads/topic/*" to show only topic branches if you have
tags under .git/refs/tags/topic/ as well.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agoUpdate the git-ls-tree documentation
Petr Baudis [Sun, 4 Dec 2005 23:31:08 +0000 (00:31 +0100)]
Update the git-ls-tree documentation

This patch aims to freshen up a bit the git-ls-tree documentation. It hints
that the list of paths are in fact patterns to be matched, explains the new
-t, --name-only and --name-status options, corrects the original autorship
information to refer to yours sincerely, corrects several grammar mistakes,
etc.

Since the documentation still deserves some significant work (at least
proper description of the pattern matching), I also added the stub notice.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
18 years agogit.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>
18 years agocompat/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>
18 years agoWarn when send-pack does nothing
Daniel 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>
18 years ago[PATCH] daemon.c and path.enter_repo(): revamp path validation.
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>
18 years agoA few more options for git-cat-file
H. 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>
18 years agoAdd 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>
18 years agoNew test case: Criss-cross merge
Fredrik 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>
18 years agoNew test case: merge with directory/file conflicts
Fredrik 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>
18 years agotest-lib.sh: Add new function, test_expect_code
Fredrik 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>
18 years agogit-merge: Exit with code 2 if no strategy was able to handle the merge.
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>
18 years agodocumentation: git-tag
No 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>
18 years agodocumentation: 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>
18 years agodocumentation: clarify read-tree --reset
No 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>
18 years agogit-merge documentation: conflicting merge leaves higher stages in index
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>
18 years agomerge-one-file: make sure we do not mismerge symbolic links.
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>
18 years agomerge-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>
18 years agot3100: 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>
18 years agomerge-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>
18 years agogit wrapper: more careful argument stuffing
Alex 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>
18 years agogit-merge-one-file: do not worry about 'rmdir -p' not removing directory.
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>
18 years agols-tree: --name-only
Junio 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>
18 years agols-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>
18 years agogit-ls-tree: add "-t" option to always show the tree entries
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>
18 years agoMakefile: 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>
18 years agoDocumentation: 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>
18 years agogitk: Factored out some common code into a new start_rev_list procedure
Paul Mackerras [Thu, 1 Dec 2005 11:42:46 +0000 (22:42 +1100)]
gitk: Factored out some common code into a new start_rev_list procedure

Signed-off-by: Paul Mackerras <paulus@samba.org>
18 years ago[PATCH] gitk: add Update menu item.
Sven Verdoolaege [Tue, 29 Nov 2005 21:15:51 +0000 (22:15 +0100)]
[PATCH] gitk: add Update menu item.

Update will redraw the commits if any commits have been added to any
of the selected heads.  The new commits appear on the top.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
18 years agoMove 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>
18 years agoMerge branch 'jc/subdir'
Junio C Hamano [Wed, 30 Nov 2005 19:09:33 +0000 (11:09 -0800)]
Merge branch 'jc/subdir'

18 years agoMerge branches 'jc/apply', 'lt/ls-tree', 'lt/bisect' and 'lt/merge'
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'

18 years agoDo not attempt to access literal dirname "GIT_OBJECT_DIRECTORY".
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>
18 years agoTutorial: 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>
18 years agomerge-recursive: match the unmerged index entry behaviour with merge-resolve
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>