From daf6c2edc21ae1f018ef3829294024fc10756c8c Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 7 Oct 2008 20:15:25 +0200 Subject: Fix a few typos in relnotes Signed-off-by: Shawn O. Pearce diff --git a/Documentation/RelNotes-1.6.0.3.txt b/Documentation/RelNotes-1.6.0.3.txt index edd5e45..6cf8ae4 100644 --- a/Documentation/RelNotes-1.6.0.3.txt +++ b/Documentation/RelNotes-1.6.0.3.txt @@ -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 -- cgit v0.10.2-6-g49f6 From cced48a808620d60e95a1e51254b135a46ddf719 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 7 Oct 2008 18:08:21 +0200 Subject: git rm: refresh index before up-to-date check Since "git rm" is supposed to be porcelain, we should convince it to be user friendly by refreshing the index itself. Signed-off-by: Johannes Schindelin Signed-off-by: Shawn O. Pearce diff --git a/builtin-rm.c b/builtin-rm.c index 50ae6d5..e06640c 100644 --- a/builtin-rm.c +++ b/builtin-rm.c @@ -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; diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index 558c80e..66aca99 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -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 -- cgit v0.10.2-6-g49f6 From bf07cc58aeb84b1262cc58f571d2f7033474efa7 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 7 Oct 2008 16:26:20 +0200 Subject: git-push.txt: Describe --repo option in more detail The --repo option was described in a way that the reader would have to assume that it is the same as the parameter. But it actually servers a purpose, which is now written down. Furthermore, the --mirror option was missing from the synopsis. Signed-off-by: Johannes Sixt Signed-off-by: Shawn O. Pearce diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt index 45c9643..6150b1b 100644 --- a/Documentation/git-push.txt +++ b/Documentation/git-push.txt @@ -9,8 +9,8 @@ git-push - Update remote refs along with associated objects SYNOPSIS -------- [verse] -'git push' [--all] [--dry-run] [--tags] [--receive-pack=] - [--repo=all] [-f | --force] [-v | --verbose] +'git push' [--all | --mirror] [--dry-run] [--tags] [--receive-pack=] + [--repo=] [-f | --force] [-v | --verbose] [ ...] 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=:: - When no repository is specified the command defaults to - "origin"; this overrides it. +--repo=:: + This option is only relevant if no 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:: diff --git a/builtin-push.c b/builtin-push.c index c1ed68d..f5cc762 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -10,7 +10,7 @@ #include "parse-options.h" static const char * const push_usage[] = { - "git push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=] [--repo=all] [-f | --force] [-v] [ ...]", + "git push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=] [--repo=] [-f | --force] [-v] [ ...]", NULL, }; -- cgit v0.10.2-6-g49f6 From 0a2c7eea41867ead2b2fb1d5898494c3a72405e5 Mon Sep 17 00:00:00 2001 From: Deskin Miller Date: Tue, 7 Oct 2008 01:37:48 -0400 Subject: git init: --bare/--shared overrides system/global config If core.bare or core.sharedRepository are set in /etc/gitconfig or ~/.gitconfig, then 'git init' will read the values when constructing a new config file; reading them, however, will override the values specified on the command line. In the case of --bare, this ends up causing a segfault, without the repository being properly initialised; in the case of --shared, the permissions are set according to the existing config settings, not what was specified on the command line. This fix saves any specified values for --bare and --shared prior to reading existing config settings, and restores them after reading but before writing the new config file. core.bare is ignored in all situations, while core.sharedRepository will only be used if --shared is not specified to git init. Also includes testcases which use a specified global config file override, demonstrating the former failure scenario. Signed-off-by: Deskin Miller Signed-off-by: Shawn O. Pearce diff --git a/builtin-init-db.c b/builtin-init-db.c index 8140c12..d30c3fe 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -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 diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 620da5b..5ac0a27 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -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 -- cgit v0.10.2-6-g49f6 From fb7424363643d6049faf3bda399e5e602782b5b7 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Mon, 6 Oct 2008 19:28:41 +0200 Subject: Do not use errno when pread() returns 0 If we use pread() while at the end of the file, it will return 0, which is not an error from the operating system point of view. In this case, errno has not been set and must not be used. Signed-off-by: Samuel Tardieu Signed-off-by: Shawn O. Pearce diff --git a/index-pack.c b/index-pack.c index 530d820..c45ae20 100644 --- a/index-pack.c +++ b/index-pack.c @@ -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); -- cgit v0.10.2-6-g49f6