From 75ad235c2e2a751cd9c4c064d19b10a88ff9efcf Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 12 Feb 2008 23:39:03 -0800 Subject: Revert "pack-objects: only throw away data during memory pressure" This reverts commit 9c2174350cc0ae0f6bad126e15fe1f9f044117ab. Nico analyzed and found out that this does not really help, and I agree with it. By the time this gets into action and data is actively thrown away, performance simply goes down the drain due to the data constantly being reloaded over and over and over and over and over and over again, to the point of virtually making no relative progress at all. The previous behavior of enforcing the memory limit by dynamically shrinking the window size at least had the effect of allowing some kind of progress, even if the end result wouldn't be optimal. And that's the whole point behind this memory limiting feature: allowing some progress to be made when resources are too limited to let the repack go unbounded. --- builtin-pack-objects.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 4113f013c..d3efeff03 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -1464,7 +1464,7 @@ static unsigned int check_delta_limit(struct object_entry *me, unsigned int n) return m; } -static unsigned long free_unpacked_data(struct unpacked *n) +static unsigned long free_unpacked(struct unpacked *n) { unsigned long freed_mem = sizeof_delta_index(n->index); free_delta_index(n->index); @@ -1474,12 +1474,6 @@ static unsigned long free_unpacked_data(struct unpacked *n) free(n->data); n->data = NULL; } - return freed_mem; -} - -static unsigned long free_unpacked(struct unpacked *n) -{ - unsigned long freed_mem = free_unpacked_data(n); n->entry = NULL; n->depth = 0; return freed_mem; @@ -1520,7 +1514,7 @@ static void find_deltas(struct object_entry **list, unsigned *list_size, mem_usage > window_memory_limit && count > 1) { uint32_t tail = (idx + window - count) % window; - mem_usage -= free_unpacked_data(array + tail); + mem_usage -= free_unpacked(array + tail); count--; } @@ -1553,9 +1547,6 @@ static void find_deltas(struct object_entry **list, unsigned *list_size, if (!m->entry) break; ret = try_delta(n, m, max_depth, &mem_usage); - if (window_memory_limit && - mem_usage > window_memory_limit) - mem_usage -= free_unpacked_data(m); if (ret < 0) break; else if (ret > 0) -- cgit v1.2.1 From 8608b334343fd51f13e100f8f1a7a2788c13d6c5 Mon Sep 17 00:00:00 2001 From: Sergei Organov Date: Wed, 13 Feb 2008 17:31:17 +0300 Subject: git-cvsimport.txt: fix '-M' description. Fix '-M' description. Old one reads as if the user can somehow "see" the default regex when using -M along with -m. Signed-off-by: Sergei Organov Signed-off-by: Junio C Hamano --- Documentation/git-cvsimport.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt index dbce50369..6f91b9ea2 100644 --- a/Documentation/git-cvsimport.txt +++ b/Documentation/git-cvsimport.txt @@ -107,8 +107,8 @@ If you need to pass multiple options, separate them with a comma. -M :: Attempt to detect merges based on the commit message with a custom - regex. It can be used with '-m' to also see the default regexes. - You must escape forward slashes. + regex. It can be used with '-m' to enable the default regexes + as well. You must escape forward slashes. -S :: Skip paths matching the regex. -- cgit v1.2.1 From f454cdc48f31e64ceae2e8d4f4838349de2f5dee Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 12 Feb 2008 19:50:57 +0000 Subject: bisect: use verbatim commit subject in the bisect log Due to a typo, the commit subject was shell expanded in the bisect log. That is, if you had some shell pattern in the commit subject, bisect would happily put all matching file names into the log. Signed-off-by: Johannes Schindelin Tested-by: Frans Pop Signed-off-by: Junio C Hamano --- git-bisect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-bisect.sh b/git-bisect.sh index 393fa3558..6594a6291 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -135,7 +135,7 @@ bisect_write() { *) die "Bad bisect_write argument: $state" ;; esac git update-ref "refs/bisect/$tag" "$rev" - echo "# $state: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG" + echo "# $state: $(git show-branch $rev)" >>"$GIT_DIR/BISECT_LOG" test -z "$nolog" && echo "git-bisect $state $rev" >>"$GIT_DIR/BISECT_LOG" } -- cgit v1.2.1 From 04b330551e427f10ac9b3d9057e8451c8bf78fc7 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 12 Feb 2008 12:28:01 +0100 Subject: upload-pack: Initialize the exec-path. Since git-upload-pack has to spawn git-pack-objects, it has to make sure that the latter can be found in the PATH. Without this patch an attempt to clone or pull via ssh from a server fails if the git tools are not in the standard PATH on the server even though git clone or git pull were invoked with --upload-pack=/path/to/git-upload-pack. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- upload-pack.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/upload-pack.c b/upload-pack.c index 7e0431102..51e3ec49d 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -620,6 +620,9 @@ int main(int argc, char **argv) if (i != argc-1) usage(upload_pack_usage); + + setup_path(NULL); + dir = argv[i]; if (!enter_repo(dir, strict)) -- cgit v1.2.1 From 077b725f0bbe2b6ca2deb569c22a6f0d7a374dd3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 13 Feb 2008 13:13:21 -0800 Subject: Protect get_author_ident_from_commit() from filenames in work tree We used to use "cat-file commit $commit" to extract the original author information from existing commit, but an earlier commit 5ac2715 (Consistent message encoding while reusing log from an existing commit) changed it to use "git show -s $commit". If you have a file in your work tree that can be interpreted as a valid object name (e.g. "HEAD"), this conversion will not work. Disambiguate by marking the end of revision parameter on the comand line with an explicit "--" to fix this. This breakage is most visible with rebase when a file called "HEAD" exists in the worktree. Signed-off-by: Junio C Hamano --- git-sh-setup.sh | 2 +- t/t3404-rebase-interactive.sh | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/git-sh-setup.sh b/git-sh-setup.sh index aae14090b..f38827529 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -119,7 +119,7 @@ get_author_ident_from_commit () { } ' encoding=$(git config i18n.commitencoding || echo UTF-8) - git show -s --pretty=raw --encoding="$encoding" "$1" | + git show -s --pretty=raw --encoding="$encoding" "$1" -- | LANG=C LC_ALL=C sed -ne "$pick_author_script" } diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index e33ea4e9f..e5ed74545 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -340,4 +340,26 @@ test_expect_success 'rebase a commit violating pre-commit' ' ' +test_expect_success 'rebase with a file named HEAD in worktree' ' + + rm -fr .git/hooks && + git reset --hard && + git checkout -b branch3 A && + + ( + GIT_AUTHOR_NAME="Squashed Away" && + export GIT_AUTHOR_NAME && + >HEAD && + git add HEAD && + git commit -m "Add head" && + >BODY && + git add BODY && + git commit -m "Add body" + ) && + + FAKE_LINES="1 squash 2" git rebase -i to-be-rebased && + test "$(git show -s --pretty=format:%an)" = "Squashed Away" + +' + test_done -- cgit v1.2.1 From ff58b9aaf8bf4ce7471a21baa502cb9ddaa9873a Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 12 Feb 2008 00:45:18 -0500 Subject: status: suggest "git rm --cached" to unstage for initial commit It makes no sense to suggest "git reset HEAD" since we have no HEAD commit. This actually used to work but regressed in f26a0012. wt_status_print_cached_header was updated to take the whole wt_status struct rather than just the reference field. Previously the various code paths were sometimes sending in s->reference and sometimes sending in NULL, making the decision on whether this was an initial commit before we even got to this function. Now we must check the initial flag here. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t7502-status.sh | 11 ++++++++++- wt-status.c | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/t/t7502-status.sh b/t/t7502-status.sh index 9ce50cade..b64ce30ff 100755 --- a/t/t7502-status.sh +++ b/t/t7502-status.sh @@ -17,6 +17,9 @@ test_expect_success 'setup' ' : > dir1/tracked && : > dir1/modified && git add . && + + git status >output && + test_tick && git commit -m initial && : > untracked && @@ -28,6 +31,12 @@ test_expect_success 'setup' ' git add dir2/added ' +test_expect_success 'status (1)' ' + + grep -e "use \"git rm --cached \.\.\.\" to unstage" output + +' + cat > expect << \EOF # On branch master # Changes to be committed: @@ -51,7 +60,7 @@ cat > expect << \EOF # untracked EOF -test_expect_success 'status' ' +test_expect_success 'status (2)' ' git status > output && git diff expect output diff --git a/wt-status.c b/wt-status.c index bfd1b0fcc..991e37378 100644 --- a/wt-status.c +++ b/wt-status.c @@ -60,7 +60,7 @@ static void wt_status_print_cached_header(struct wt_status *s) { const char *c = color(WT_STATUS_HEADER); color_fprintf_ln(s->fp, c, "# Changes to be committed:"); - if (s->reference) { + if (!s->is_initial) { color_fprintf_ln(s->fp, c, "# (use \"git reset %s ...\" to unstage)", s->reference); } else { color_fprintf_ln(s->fp, c, "# (use \"git rm --cached ...\" to unstage)"); -- cgit v1.2.1 From 846688726c388cf7fc92ac5cc9f3576e93847e15 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 12 Feb 2008 01:12:57 +0100 Subject: git clone -s documentation: force a new paragraph for the NOTE It should be loud and clear. Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- Documentation/git-clone.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt index 234188161..975824301 100644 --- a/Documentation/git-clone.txt +++ b/Documentation/git-clone.txt @@ -62,12 +62,13 @@ OPTIONS .git/objects/info/alternates to share the objects with the source repository. The resulting repository starts out without any object of its own. - *NOTE*: this is a possibly dangerous operation; do *not* use - it unless you understand what it does. If you clone your - repository using this option, then delete branches in the - source repository and then run linkgit:git-gc[1] using the - '--prune' option in the source repository, it may remove - objects which are referenced by the cloned repository. ++ +*NOTE*: this is a possibly dangerous operation; do *not* use +it unless you understand what it does. If you clone your +repository using this option, then delete branches in the +source repository and then run linkgit:git-gc[1] using the +'--prune' option in the source repository, it may remove +objects which are referenced by the cloned repository. -- cgit v1.2.1 From 9386ecbb1cb0576f67da804f57dd96ffd62bb3c6 Mon Sep 17 00:00:00 2001 From: Gerrit Pape Date: Thu, 7 Feb 2008 09:36:10 +0000 Subject: cvsimport: have default merge regex also match beginning of commit message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default value of @mergerx uses \W, which matches a non-word character; this means that commit messages like "Merging FOO" are not matched by default; using \b, which matches a word boundary, instead of \W fixes that. This change was suggested by Frédéric Brière through http://bugs.debian.org/463468 Signed-off-by: Gerrit Pape Signed-off-by: Junio C Hamano --- git-cvsimport.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 5694978c4..951624233 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -164,7 +164,7 @@ if ($#ARGV == 0) { our @mergerx = (); if ($opt_m) { - @mergerx = ( qr/\W(?:from|of|merge|merging|merged) (\w+)/i ); + @mergerx = ( qr/\b(?:from|of|merge|merging|merged) (\w+)/i ); } if ($opt_M) { push (@mergerx, qr/$opt_M/); -- cgit v1.2.1 From d8e87570c32b190af3991d180f37adb8cf5eb99c Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Thu, 7 Feb 2008 06:23:46 +0100 Subject: config: add test cases for empty value and no value config variables. The tests in 't1300-repo-config.sh' did not check what happens when an empty value like the following is used in the config file: [emptyvalue] variable = Also it was not checked that a variable with no value like the following: [novalue] variable gives a boolean "true" value, while an ampty value gives a boolean "false" value. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- t/t1300-repo-config.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 44dcc1f94..d9e358e1b 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -297,17 +297,40 @@ test_expect_success '--add' \ cat > .git/config << EOF [novalue] variable +[emptyvalue] + variable = EOF test_expect_success 'get variable with no value' \ 'git config --get novalue.variable ^$' +test_expect_success 'get variable with empty value' \ + 'git config --get emptyvalue.variable ^$' + echo novalue.variable > expect test_expect_success 'get-regexp variable with no value' \ 'git config --get-regexp novalue > output && cmp output expect' +echo 'emptyvalue.variable ' > expect + +test_expect_success 'get-regexp variable with empty value' \ + 'git config --get-regexp emptyvalue > output && + cmp output expect' + +echo true > expect + +test_expect_success 'get bool variable with no value' \ + 'git config --bool novalue.variable > output && + cmp output expect' + +echo false > expect + +test_expect_success 'get bool variable with empty value' \ + 'git config --bool emptyvalue.variable > output && + cmp output expect' + git config > output 2>&1 test_expect_success 'no arguments, but no crash' \ -- cgit v1.2.1