* maint:
  Do not use errno when pread() returns 0
  git init: --bare/--shared overrides system/global config
  git-push.txt: Describe --repo option in more detail
  git rm: refresh index before up-to-date check
  Fix a few typos in relnotes
This commit is contained in:
Shawn O. Pearce 2008-10-08 08:05:43 -07:00
Родитель 19d4b416f4 fb74243636
Коммит c4f6a48969
8 изменённых файлов: 88 добавлений и 21 удалений

Просмотреть файл

@ -53,7 +53,7 @@ Fixes since v1.6.0.2
* Stale temporary files under $GIT_DIR/objects/pack are now cleaned up
automatically by "git prune".
* "git merge" once agrain removes directories after the last file has
* "git merge" once again removes directories after the last file has
been removed from it during the merge.
* "git blame -C -C" no longer segfaults while trying to pass blame if
@ -68,10 +68,10 @@ Fixes since v1.6.0.2
* The "git commit" error message when there are still unmerged
files present was clarified to match "git write-tree".
* Some segfaults due to uncaught NULL pointers were fixed multiple
* Some segfaults due to uncaught NULL pointers were fixed in multiple
tools such as apply, reset, update-index.
* Solaris bulds now default to OLD_ICONV=1 to avoid compile warnings.
* Solaris builds now default to OLD_ICONV=1 to avoid compile warnings.
* "Git.pm" tests relied on unnecessarily more recent version of Perl.
@ -80,7 +80,7 @@ Fixes since v1.6.0.2
* "gitweb" triggered undef warnings on missing trees.
* "gitweb" now removes PATH_INFO from its URLs so users don't have
to manually set the url in the gitweb configuration.
to manually set the URL in the gitweb configuration.
* Bash completion removed support for legacy "git-fetch", "git-push"
and "git-pull" as these are no longer installed. Dashless form

Просмотреть файл

@ -9,8 +9,8 @@ git-push - Update remote refs along with associated objects
SYNOPSIS
--------
[verse]
'git push' [--all] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>]
[--repo=all] [-f | --force] [-v | --verbose]
'git push' [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>]
[--repo=<repository>] [-f | --force] [-v | --verbose]
[<repository> <refspec>...]
DESCRIPTION
@ -101,9 +101,23 @@ nor in any Push line of the corresponding remotes file---see below).
This flag disables the check. This can cause the
remote repository to lose commits; use it with care.
--repo=<repo>::
When no repository is specified the command defaults to
"origin"; this overrides it.
--repo=<repository>::
This option is only relevant if no <repository> argument is
passed in the invocation. In this case, 'git-push' derives the
remote name from the current branch: If it tracks a remote
branch, then that remote repository is pushed to. Otherwise,
the name "origin" is used. For this latter case, this option
can be used to override the name "origin". In other words,
the difference between these two commands
+
--------------------------
git push public #1
git push --repo=public #2
--------------------------
+
is that #1 always pushes to "public" whereas #2 pushes to "public"
only if the current branch does not track a remote branch. This is
useful if you write an alias or script around 'git-push'.
--thin::
--no-thin::

Просмотреть файл

@ -17,6 +17,9 @@
#define TEST_FILEMODE 1
#endif
static int init_is_bare_repository = 0;
static int init_shared_repository = -1;
static void safe_create_dir(const char *dir, int share)
{
if (mkdir(dir, 0777) < 0) {
@ -191,6 +194,9 @@ static int create_default_files(const char *template_path)
copy_templates(template_path);
git_config(git_default_config, NULL);
is_bare_repository_cfg = init_is_bare_repository;
if (init_shared_repository != -1)
shared_repository = init_shared_repository;
/*
* We would have created the above under user's umask -- under
@ -277,6 +283,8 @@ int init_db(const char *template_dir, unsigned int flags)
safe_create_dir(get_git_dir(), 0);
init_is_bare_repository = is_bare_repository();
/* Check to see if the repository version is right.
* Note that a newly created repository does not have
* config file, so this will not fail. What we are catching
@ -381,9 +389,9 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir,
sizeof(git_dir)), 0);
} else if (!strcmp(arg, "--shared"))
shared_repository = PERM_GROUP;
init_shared_repository = PERM_GROUP;
else if (!prefixcmp(arg, "--shared="))
shared_repository = git_config_perm("arg", arg+9);
init_shared_repository = git_config_perm("arg", arg+9);
else if (!strcmp(arg, "-q") || !strcmp(arg, "--quiet"))
flags |= INIT_DB_QUIET;
else

Просмотреть файл

@ -10,7 +10,7 @@
#include "parse-options.h"
static const char * const push_usage[] = {
"git push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]",
"git push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [-v] [<repository> <refspec>...]",
NULL,
};

Просмотреть файл

@ -137,6 +137,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
if (read_cache() < 0)
die("index file corrupt");
refresh_cache(REFRESH_QUIET);
pathspec = get_pathspec(prefix, argv);
seen = NULL;

Просмотреть файл

@ -365,8 +365,11 @@ static void *get_data_from_pack(struct object_entry *obj)
data = src;
do {
ssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);
if (n <= 0)
if (n < 0)
die("cannot pread pack file: %s", strerror(errno));
if (!n)
die("premature end of pack file, %lu bytes missing",
len - rdy);
rdy += n;
} while (rdy < len);
data = xmalloc(obj->size);

Просмотреть файл

@ -167,4 +167,36 @@ test_expect_success 'init with --template (blank)' '
! test -f template-blank/.git/info/exclude
'
test_expect_success 'init --bare/--shared overrides system/global config' '
(
HOME="`pwd`" &&
export HOME &&
test_config="$HOME"/.gitconfig &&
unset GIT_CONFIG_NOGLOBAL &&
git config -f "$test_config" core.bare false &&
git config -f "$test_config" core.sharedRepository 0640 &&
mkdir init-bare-shared-override &&
cd init-bare-shared-override &&
git init --bare --shared=0666
) &&
check_config init-bare-shared-override true unset &&
test x0666 = \
x`git config -f init-bare-shared-override/config core.sharedRepository`
'
test_expect_success 'init honors global core.sharedRepository' '
(
HOME="`pwd`" &&
export HOME &&
test_config="$HOME"/.gitconfig &&
unset GIT_CONFIG_NOGLOBAL &&
git config -f "$test_config" core.sharedRepository 0666 &&
mkdir shared-honor-global &&
cd shared-honor-global &&
git init
) &&
test x0666 = \
x`git config -f shared-honor-global/.git/config core.sharedRepository`
'
test_done

Просмотреть файл

@ -219,14 +219,23 @@ test_expect_success 'Remove nonexistent file returns nonzero exit status' '
test_expect_success 'Call "rm" from outside the work tree' '
mkdir repo &&
cd repo &&
git init &&
echo something > somefile &&
git add somefile &&
git commit -m "add a file" &&
(cd .. &&
git --git-dir=repo/.git --work-tree=repo rm somefile) &&
test_must_fail git ls-files --error-unmatch somefile
(cd repo &&
git init &&
echo something > somefile &&
git add somefile &&
git commit -m "add a file" &&
(cd .. &&
git --git-dir=repo/.git --work-tree=repo rm somefile) &&
test_must_fail git ls-files --error-unmatch somefile)
'
test_expect_success 'refresh index before checking if it is up-to-date' '
git reset --hard &&
test-chmtime -86400 frotz/nitfol &&
git rm frotz/nitfol &&
test ! -f frotz/nitfol
'
test_done