Commit Graph

83 Commits

Author SHA1 Message Date
Steffen Prohaska
ebb79d06bf Merge commit 'mingw/master' into devel 2008-01-13 14:17:32 +01:00
Johannes Sixt
758eec41e2 Merge branch 'master' of git://repo.or.cz/alt-git 2008-01-12 20:37:40 +01:00
Jim Meyering
790296fd88 Fix grammar nits in documentation and in code comments.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-03 09:15:17 -08:00
Steffen Prohaska
7b25739391 Merge commit 'mingw/master' into work/merge-mingw
Conflicts:

	Makefile
	help.c
	  moved msysgit specific code to show_html_page
	  and call show_html_page per default.
2007-12-13 22:38:05 +01:00
Johannes Sixt
224244e4ca Merge branch 'master' of git://repo.or.cz/alt-git to sync with v1.5.4-rc0 2007-12-13 20:54:23 +01:00
Nguyễn Thái Ngọc Duy
bb4e3527b5 Remove repo version check from setup_git_directory
setup_git_directory_gently has done the check already.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-09 02:24:51 -08:00
Johannes Sixt
4a8d948eac Fix prefix_filename() function.
The previous implementation translated '\' to '/' on non-Windows, too
(in those cases where the prefix was actually prepended to the path).

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
2007-12-08 20:51:36 +01:00
Steffen Prohaska
8da335b3fa Merge commit 'mingw/master' into work/merge-mingw
Conflicts:

	setup.c
2007-12-08 12:49:42 +01:00
Johannes Sixt
bd8d78a159 Merge branch 'master' of git://repo.or.cz/alt-git 2007-12-07 22:55:49 +01:00
Junio C Hamano
27ee189163 Merge branch 'maint'
* maint:
  git-am -i: report rewritten title
  git grep shows the same hit repeatedly for unmerged paths
  Do check_repository_format() early (re-fix)
  Do check_repository_format() early
  Add missing inside_work_tree setting in setup_git_directory_gently
2007-12-05 17:49:13 -08:00
Nguyễn Thái Ngọc Duy
9459aa77a0 Do check_repository_format() early (re-fix)
This pushes check_repository_format() (actually _gently() version)
to setup_git_directory_gently() in order to prevent from
using unsupported repositories.

New setup_git_directory_gently()'s behaviour is stop searching
for a valid gitdir and return as if there is no gitdir if a
unsupported repository is found. Warning will be thrown in these
cases.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 15:06:37 -08:00
Steffen Prohaska
dd9da2f011 Merge commit 'mingw/master' into work/merge-mingw 2007-12-01 16:21:43 +01:00
Johannes Sixt
62868131fd Merge branch 'master' of git://repo.or.cz/alt-git 2007-12-01 10:20:42 +01:00
Nguyễn Thái Ngọc Duy
138dd1e990 Do check_repository_format() early
Repository version check is only performed when
setup_git_directory() is called. This makes sure
setup_git_directory_gently() does the check too.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-30 15:05:48 -08:00
Steffen Prohaska
ecf4831d89 Use is_absolute_path() in diff-lib.c, lockfile.c, setup.c, trace.c
Using the helper function to test for absolute paths makes porting easier.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-26 12:32:05 -08:00
Steffen Prohaska
16df3f7e4c Merge commit 'mingw/master' into work/merge-mingw-master
Remove getpagesize() from sha1_file.c because is it now
included in git-compat-util.h.

Conflicts:

	Makefile
	compat/mingw.c
	git-compat-util.h

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-16 07:33:14 +01:00
Johannes Sixt
1c01d23a86 Merge branch 'master' of git://repo.or.cz/alt-git 2007-11-11 20:14:20 +01:00
Johannes Schindelin
354e6534c1 builtin-blame: set up the work_tree before the first file access
We check in cmd_blame() if the specified path is there, but we
failed to set up the working tree before that.

While at it, make setup_work_tree() just return if it was run
before.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-09 21:45:01 -08:00
Junio C Hamano
f3fa183802 Style: place opening brace of a function definition at column 1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-08 15:35:32 -08:00
Mike Hommey
59f0f2f33a Refactor working tree setup
Create a setup_work_tree() that can be used from any command requiring
a working tree conditionally.

Signed-off-by: Mike Hommey <mh@glandium.org>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 22:47:57 -08:00
Steffen Prohaska
69cadd4e60 Merge commit 'mingw/master' into msysgit/merge-mingw-v2
Conflicts:

	Makefile
	RelNotes
	builtin-ls-files.c
	builtin-tag.c
	cache.h
	compat/mingw.c
	config.c
	connect.c
	cpio.sh
	diff.c
	exec_cmd.c
	git-gui/Makefile
	git-gui/lib/commit.tcl
	git-gui/lib/console.tcl
	git-mergetool.sh
	lockfile.c
	path.c
	rsh.c
	run-command.c
	setup.c
	show-index.c
	spawn-pipe.c
	t/Makefile
	t/t0000-basic.sh
	t/t1300-repo-config.sh
	t/t7501-commit.sh
	t/test-lib.sh

    Resolve as follows
    --- Makefile
    - mingw/devel removes
        SHELL_PATH = /bin/sh
        PERL_PATH = /bin/perl

    This looks ok. Both are set early in the Makefile to sensible values.
    mingw accepts to execute /usr/bin/perl.

    - NO_SYMLINKS is no longer needed. Should be auto-detected.

    - According to our 0e2bdc35af
      we want

    NO_R_TO_GCC_LINKER = YesPlease

      take our before their change.

    - Conflict prefix, SCRIPT_SH:
    our 7999f434d7 set prefix =
    their 4a7c98dbaf removes cpio emulator

    resolve to achieve both.

    - Conflict NO_MEMMEM, THREADED_DELTA_SEARCH: take theirs

    --- RelNotes
    take our: removed file

    --- builtin-ls-files.c
    Conflict write_name_quoted: take their change.

    --- builtin-tag.c
    Conflict strip CR

    our 7734ad404c adds strip CR
    their fd17f5b5f7 modifies code to use strbuf

    resolve by removing our code. TODO: we probably need a replacement?

    --- cache.h
    Conflict is_absolute_path()
    our ef5af72062 ifdef
    their 637fc51696 ifndef
    both achieve the same.

    our is a bit more strict but we take their code because we want
    to reduce differences to mingw.

    --- compat/mingw.c
    Conflict at end of file:
    our 194c1dbb5a adds git_exit()

    resolve by taking their first, followed by our.

    --- config.c
    Conflict 'fd ='
    our 0a453a237e merge junio/master
    introduced strange 'fd ='. Resolve by removing 'fd ='.

    --- connect.c
    - Conflict 'host must have at least 2 chars ...' take their code.

    - git_connect(): take their implementation.

    --- cpio.sh
    Accepted their delete file.

    --- diff.c
    Resolve using their implementation.

    --- exec_cmd.c
    Resolve using their implementation.

    --- git-gui/**
    Resolve using our implementation.

    --- git-mergetool.sh
    Resolve using their implementation

    --- lockfile.c
    trivial resolution (empty line removed)

    --- path.c
    Conflict 'tmp': accepting their implementation, trying TMP, TEMP on all platforms.

    --- rsh.c
    Accept their delete file.

    --- run-command.c
    Resolve using their implementation

    --- setup.c
    Resolve using their implementation

    --- show-index.c
    Conflict PRIuMAX
    our 89697a4c15 fix warning
    their 5be507fc95 PRIuMAX

    resolve fixing warning in their code.

    --- spawn-pipe.c
    Conflict environ vs lookup_prog: resolve taking neither

    --- t/Makefile
    our d1f83218dc --no-hardlinks
    their c603988c10 automtically detect symlink support

    Resolve using our --no-hardlinks but removing --no-symlinks.

    --- t/0000-basic.sh
    Resolve using their implementation.

    --- t/t1300-repo-config.sh
    Resolve using their implementation.

    --- t/t7501-commit.sh
    Resolve using their implementation.

    --- t/test-lib.sh
    our d1f83218dc --no-hardlink
    their c603988c10 automatically detect symlink support

    Resolve using our --no-hardlinks but removing --no-symlinks.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-05 21:55:44 +01:00
Nguyễn Thái Ngọc Duy
1e8a195451 Add missing inside_work_tree setting in setup_git_directory_gently
When both GIT_DIR and GIT_WORK_TREE are set, and
setup_git_directory_gently() changes the current working
directory accordingly, it should also set inside_work_tree = 1.

Without this, work_tree handling code in setup_git_directory()
will be activated. If you stay in root work tree (no prefix),
it does not harm. It does if you work from a subdirectory though.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03 21:47:13 -07:00
Johannes Sixt
89afdd6d62 Merge commit 'spearce/master' 2007-10-19 22:50:43 +02:00
Johannes Schindelin
dd5c8af176 Fix setup_git_directory_gently() with relative GIT_DIR & GIT_WORK_TREE
There are a few programs, such as config and diff, which allow running
without a git repository.  Therefore, they have to call
setup_git_directory_gently().

However, when GIT_DIR and GIT_WORK_TREE were set, and the current
directory was a subdirectory of the work tree,
setup_git_directory_gently() would return a bogus NULL prefix.

This patch fixes that.

Noticed by REPLeffect on IRC.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-16 20:18:04 -04:00
Johannes Sixt
fce4254719 Fix an infinite loop in setup_git_directory_gently().
When a git command was invoked outside any git directory, it would not
terminate.
2007-08-20 16:36:58 +02:00
Johannes Sixt
4e83e2adec Merge branch 'master' of git://repo.or.cz/alt-git 2007-08-17 12:24:19 +02:00
Marius Storm-Olsen
88d775162b Merge branch 'git_git' into next
Conflicts:

	connect.c
	git-clone.sh
	t/t7004-tag.sh
2007-08-14 09:30:22 +02:00
Johannes Schindelin
7efeb8f098 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>
2007-08-10 01:12:07 -07:00
Dmitry Kakurin
855f254b2b git clone was failing with 'invalid object name HEAD' if ran from cmd.exe directly
environment.c caches results of many getenv calls.
Under MinGW setenv(X) invalidates all previous values returned by getenv(X)
so cached values become dangling pointers.

Replaced all setenv(GIT_DIR, ...) with set_git_dir

Signed-off-by: Dmitry Kakurin <Dmitry.Kakurin@gmail.com>
2007-08-10 01:10:21 -07:00
Johannes Sixt
decd700792 Use is_absolute_path() in more places. 2007-08-09 23:07:30 +02:00
Johannes Schindelin
0a453a237e Merge commit 'junio/master'
Conflicts:

	Makefile
	builtin-config.c
	cache.h
	config.c
	git-gui/git-gui.sh
	lockfile.c
	path.c
	setup.c
	t/t9200-git-cvsexportcommit.sh

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-08-09 01:45:22 +01:00
Dmitry Kakurin
4a66a6c4c2 Correctly test for absolute path
This fix (while correct) actually avoids another nasty bug that must be fixed later:
environment.c caches results of many getenv calls.
Under MinGW setenv(X) invalidates all previous values returned by getenv(X)
so cached values become dangling pointers.

Signed-off-by: Dmitry Kakurin <Dmitry.Kakurin@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-08-06 23:18:56 +01:00
Johannes Schindelin
2d5d2c84f1 Fix inifinite loop
In setup_git_directory_gently(), there is a hack to allow for stopping
the search at the drive letter.  Only that the patch was incomplete;
we really have to stop there, instead of looping infinitely.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-08-06 22:54:41 +01:00
Johannes Sixt
301ac806b7 Merge commit 'v1.5.3-rc4' 2007-08-06 22:38:37 +02:00
Junio C Hamano
a6954452ec Merge branch 'maint'
* maint:
  apply: remove directory that becomes empty by renaming the last file away
  setup.c:verify_non_filename(): don't die unnecessarily while disambiguating
2007-08-06 01:37:10 -07:00
Junio C Hamano
33a798c880 setup.c:verify_non_filename(): don't die unnecessarily while disambiguating
If you have a working tree _file_ "foo", attempt to refer to a
branch "foo/bar" without -- to disambiguate, like this:

	$ git log foo/bar

tried to make sure that foo/bar cannot be naming a working tree
file "foo/bar" (in which case we would say "which one do you
want?  A rev or a working tree file?  clarify with -- please").
We run lstat("foo/bar") to check that.  If it does not succeed,
there is no ambiguity.

That is good.  But we also checked the error status for the
lstat() and expected it to fail with ENOENT.  In this particular
case, however, it fails with ENOTDIR.  That should be treated as
"expected error" as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-06 00:25:35 -07:00
Junio C Hamano
6490a3383f Fix work-tree related breakages
In set_work_tree(), variable rel needs to be reinitialized to
NULL on every call (it should not be static).

Make sure the incoming dir variable is not too long before
copying to the temporary buffer, and make sure chdir to the
resulting directory succeeds.

This was spotted and fixed by Alex and Johannes in a handful
patch exchanges.  Here is the final version.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
2007-08-02 17:26:26 -07:00
Johannes Schindelin
e90fdc39b6 Clean up work-tree handling
The old version of work-tree support was an unholy mess, barely readable,
and not to the point.

For example, why do you have to provide a worktree, when it is not used?
As in "git status".  Now it works.

Another riddle was: if you can have work trees inside the git dir, why
are some programs complaining that they need a work tree?

IOW it is allowed to call

	$ git --git-dir=../ --work-tree=. bla

when you really want to.  In this case, you are both in the git directory
and in the working tree.  So, programs have to actually test for the right
thing, namely if they are inside a working tree, and not if they are
inside a git directory.

Also, GIT_DIR=../.git should behave the same as if no GIT_DIR was
specified, unless there is a repository in the current working directory.
It does now.

The logic to determine if a repository is bare, or has a work tree
(tertium non datur), is this:

--work-tree=bla overrides GIT_WORK_TREE, which overrides core.bare = true,
which overrides core.worktree, which overrides GIT_DIR/.. when GIT_DIR
ends in /.git, which overrides the directory in which .git/ was found.

In related news, a long standing bug was fixed: when in .git/bla/x.git/,
which is a bare repository, git formerly assumed ../.. to be the
appropriate git dir.  This problem was reported by Shawn Pearce to have
caused much pain, where a colleague mistakenly ran "git init" in "/" a
long time ago, and bare repositories just would not work.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-01 00:38:31 -07:00
Johannes Schindelin
299726d538 white space fixes in setup.c
Some lines were not indented by tabs but by spaces.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-30 12:24:54 -07:00
Johannes Sixt
4613eb6cfd Merge commit 'v1.5.3-rc2' 2007-07-22 21:41:41 +02:00
Johannes Sixt
3b395cf622 Merge commit '96c48153c9a2905fb2f1d588c11e36272635cb79' 2007-07-21 23:15:20 +02:00
Johannes Sixt
91a4c3a6dd Merge commit '952c8c56380734d45bddf369fe478895672c5a3a' 2007-07-21 16:51:27 +02:00
Johannes Schindelin
835252272e Fix core.sharedRepository = 2
For compatibility reasons, "git init --shared=all" does not write
"all" into the config, but a number.  In the shared setup, you
really have to support even older clients on the _same_ repository.

But git_config_perm() did not pick up on it.

Also, "git update-server-info" failed to pick up on the shared
permissions.

This patch fixes both issues, and adds a test to prove it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: martin f krafft <madduck@madduck.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-11 13:52:16 -07:00
Junio C Hamano
f66a4d68d2 Do not check if getcwd() result begins with a slash.
In user space, and for getcwd(), the check to see if the
resulting path begins with a '/' does not make sense.  This is
merely a mistake by Linus who is so used to code for the kernel,
where a d_path() return value pathname can be either a real
path, or something like "pipe:[8003]", and the difference is the
'/' at the beginning.

Pointed out by Dscho, Matthias Lederhofer and clarified by Linus.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-04 12:45:42 -07:00
Junio C Hamano
0305b63654 Merge branch 'ei/worktree+filter'
* ei/worktree+filter:
  filter-branch: always export GIT_DIR if it is set
  setup_git_directory: fix segfault if repository is found in cwd
  test GIT_WORK_TREE
  extend rev-parse test for --is-inside-work-tree
  Use new semantics of is_bare/inside_git_dir/inside_work_tree
  introduce GIT_WORK_TREE to specify the work tree
  test git rev-parse
  rev-parse: introduce --is-bare-repository
  rev-parse: document --is-inside-git-dir
2007-07-01 13:10:42 -07:00
Junio C Hamano
a6080a0a44 War on whitespace
This uses "git-apply --whitespace=strip" to fix whitespace errors that have
crept in to our source files over time.  There are a few files that need
to have trailing whitespaces (most notably, test vectors).  The results
still passes the test, and build result in Documentation/ area is unchanged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-07 00:04:01 -07:00
Matthias Lederhofer
f4f51add27 setup_git_directory: fix segfault if repository is found in cwd
Additionally there was a similar part calling setenv and getenv
in the same way which missed a check if getenv succeeded.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Matthias Lederhofer
7ae3df8c0a Use new semantics of is_bare/inside_git_dir/inside_work_tree
Up to now to check for a working tree this was used:
	!is_bare && !inside_git_dir
(the check for bare is redundant because is_inside_git_dir
returned already 1 for bare repositories).
Now the check is:
	inside_work_tree && !inside_git_dir

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Matthias Lederhofer
892c41b98a introduce GIT_WORK_TREE to specify the work tree
setup_gdg is used as abbreviation for setup_git_directory_gently.

The work tree can be specified using the environment variable
GIT_WORK_TREE and the config option core.worktree (the environment
variable has precendence over the config option).  Additionally
there is a command line option --work-tree which sets the
environment variable.

setup_gdg does the following now:

GIT_DIR unspecified
repository in .git directory
    parent directory of the .git directory is used as work tree,
    GIT_WORK_TREE is ignored

GIT_DIR unspecified
repository in cwd
    GIT_DIR is set to cwd
    see the cases with GIT_DIR specified what happens next and
    also see the note below

GIT_DIR specified
GIT_WORK_TREE/core.worktree unspecified
    cwd is used as work tree

GIT_DIR specified
GIT_WORK_TREE/core.worktree specified
    the specified work tree is used

Note on the case where GIT_DIR is unspecified and repository is in cwd:
    GIT_WORK_TREE is used but is_inside_git_dir is always true.
    I did it this way because setup_gdg might be called multiple
    times (e.g. when doing alias expansion) and in successive calls
    setup_gdg should do the same thing every time.

Meaning of is_bare/is_inside_work_tree/is_inside_git_dir:

(1) is_bare_repository
    A repository is bare if core.bare is true or core.bare is
    unspecified and the name suggests it is bare (directory not
    named .git).  The bare option disables a few protective
    checks which are useful with a working tree.  Currently
    this changes if a repository is bare:
        updates of HEAD are allowed
        git gc packs the refs
        the reflog is disabled by default

(2) is_inside_work_tree
    True if the cwd is inside the associated working tree (if there
    is one), false otherwise.

(3) is_inside_git_dir
    True if the cwd is inside the git directory, false otherwise.
    Before this patch is_inside_git_dir was always true for bare
    repositories.

When setup_gdg finds a repository git_config(git_default_config) is
always called.  This ensure that is_bare_repository makes use of
core.bare and does not guess even though core.bare is specified.

inside_work_tree and inside_git_dir are set if setup_gdg finds a
repository.  The is_inside_work_tree and is_inside_git_dir functions
will die if they are called before a successful call to setup_gdg.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Johannes Sixt
d17b18abec Make mingw branch compile on Linux again 2007-05-20 21:25:49 +02:00