From 2454ac7b9fbc12db5cca8cd388422360528d7d6f Mon Sep 17 00:00:00 2001 From: Stephan Beyer Date: Fri, 16 Jan 2009 20:40:05 +0100 Subject: [PATCH 1/8] builtin-commit.c: do not remove COMMIT_EDITMSG git-commit tries to remove the file ./COMMIT_EDITMSG instead of $GIT_DIR/COMMIT_EDITMSG after commit preparation (e.g. running hooks, launching editor). This behavior exists since f5bbc3225c4b07 "Port git commit to C". Some test cases (e.g. t/t7502-commit.sh) rely on the existence of $GIT_DIR/COMMIT_EDITMSG after committing and, I guess, many people are used to it. So it is best not to remove it. This patch just removes the removal of COMMIT_EDITMSG. Signed-off-by: Stephan Beyer Signed-off-by: Junio C Hamano --- builtin-commit.c | 1 - 1 file changed, 1 deletion(-) diff --git a/builtin-commit.c b/builtin-commit.c index 1e08399919..6cbdd55f16 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -625,7 +625,6 @@ static int prepare_to_commit(const char *index_file, const char *prefix) if (!commitable && !in_merge && !allow_empty && !(amend && is_a_merge(head_sha1))) { run_status(stdout, index_file, prefix, 0); - unlink(commit_editmsg); return 0; } From 996869601594ffefb67238175055922340ced6f8 Mon Sep 17 00:00:00 2001 From: Stephan Beyer Date: Fri, 16 Jan 2009 21:36:06 +0100 Subject: [PATCH 2/8] githooks.txt: add missing word Signed-off-by: Stephan Beyer Signed-off-by: Junio C Hamano --- Documentation/githooks.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt index 5faaaa5fed..024abb2ff1 100644 --- a/Documentation/githooks.txt +++ b/Documentation/githooks.txt @@ -86,7 +86,7 @@ This hook is invoked by 'git-commit' right after preparing the default log message, and before the editor is started. It takes one to three parameters. The first is the name of the file -that the commit log message. The second is the source of the commit +that contains the commit log message. The second is the source of the commit message, and can be: `message` (if a `-m` or `-F` option was given); `template` (if a `-t` option was given or the configuration option `commit.template` is set); `merge` (if the From bf474e2402e51843e8230c064da6ccfdf3a8ff54 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Fri, 16 Jan 2009 22:42:33 +0100 Subject: [PATCH 3/8] Documentation: let asciidoc align related options Command line options can share the same paragraph of description, if they are related or synonymous. In these cases they should be written among each other, so that asciidoc can format them itself. Signed-off-by: Markus Heidelberg Signed-off-by: Junio C Hamano --- Documentation/git-diff-files.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/git-diff-files.txt b/Documentation/git-diff-files.txt index 5c8c1d95a8..c526141564 100644 --- a/Documentation/git-diff-files.txt +++ b/Documentation/git-diff-files.txt @@ -21,7 +21,10 @@ OPTIONS ------- include::diff-options.txt[] --1 -2 -3 or --base --ours --theirs, and -0:: +-1 --base:: +-2 --ours:: +-3 --theirs:: +-0:: Diff against the "base" version, "our branch" or "their branch" respectively. With these options, diffs for merged entries are not shown. From 20642801e44a03362d1809644bf4da6473636529 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 17 Jan 2009 16:36:26 +0100 Subject: [PATCH 4/8] http-push: fix off-by-path_len When getting the result of remote_ls(), we were advancing the variable "path" to the relative path inside the repository. However, then we went on to malloc a bogus amount of memory: we were subtracting the prefix length _again_, quite possibly getting something negative, which xmalloc() interprets as really, really much. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- http-push.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/http-push.c b/http-push.c index a4b7d08663..2f20995700 100644 --- a/http-push.c +++ b/http-push.c @@ -1434,10 +1434,8 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed) } if (path) { path += remote->path_len; + ls->dentry_name = xstrdup(path); } - ls->dentry_name = xmalloc(strlen(path) - - remote->path_len + 1); - strcpy(ls->dentry_name, path + remote->path_len); } else if (!strcmp(ctx->name, DAV_PROPFIND_COLLECTION)) { ls->dentry_flags |= IS_DIR; } @@ -1448,6 +1446,12 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed) } } +/* + * NEEDSWORK: remote_ls() ignores info/refs on the remote side. But it + * should _only_ heed the information from that file, instead of trying to + * determine the refs from the remote file system (badly: it does not even + * know about packed-refs). + */ static void remote_ls(const char *path, int flags, void (*userFunc)(struct remote_ls_ctx *ls), void *userData) From 466ddf90c2f270b973d141f20e912f743743331c Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 17 Jan 2009 16:11:51 +0100 Subject: [PATCH 5/8] http-push: when making directories, have a trailing slash in the path name The function lock_remote() sends MKCOL requests to make leading directories; However, if it does not put a forward slash '/' at the end of the path, the server sends a 301 redirect. By leaving the '/' in place, we can avoid this additional step. Incidentally, at least one version of Curl (7.16.3) does not resend credentials when it follows a 301 redirect, so this commit also fixes a bug. Original patch by Tay Ray Chuan . Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- http-push.c | 5 +++-- t/lib-httpd/apache.conf | 2 ++ t/t5540-http-push.sh | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/http-push.c b/http-push.c index 2f20995700..6ad853e2d0 100644 --- a/http-push.c +++ b/http-push.c @@ -1201,7 +1201,8 @@ static struct remote_lock *lock_remote(const char *path, long timeout) /* Make sure leading directories exist for the remote ref */ ep = strchr(url + strlen(remote->url) + 1, '/'); while (ep) { - *ep = 0; + char saved_character = ep[1]; + ep[1] = '\0'; slot = get_active_slot(); slot->results = &results; curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1); @@ -1223,7 +1224,7 @@ static struct remote_lock *lock_remote(const char *path, long timeout) free(url); return NULL; } - *ep = '/'; + ep[1] = saved_character; ep = strchr(ep + 1, '/'); } diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf index 4717c2d33b..fdb19a50f1 100644 --- a/t/lib-httpd/apache.conf +++ b/t/lib-httpd/apache.conf @@ -1,6 +1,8 @@ ServerName dummy PidFile httpd.pid DocumentRoot www +LogFormat "%h %l %u %t \"%r\" %>s %b" common +CustomLog access.log common ErrorLog error.log diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh index da9588645c..22cfbb6a2d 100755 --- a/t/t5540-http-push.sh +++ b/t/t5540-http-push.sh @@ -76,6 +76,12 @@ test_expect_failure 'create and delete remote branch' ' test_must_fail git show-ref --verify refs/remotes/origin/dev ' +test_expect_success 'MKCOL sends directory names with trailing slashes' ' + + ! grep "\"MKCOL.*[^/] HTTP/[^ ]*\"" < "$HTTPD_ROOT_PATH"/access.log + +' + stop_httpd test_done From 8ee09acd8f3c96683ce2b81bb8ac8079f0e8a4fd Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 17 Jan 2009 16:41:41 +0100 Subject: [PATCH 6/8] t5540: clarify that http-push does not handle packed-refs on the remote Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t5540-http-push.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh index 22cfbb6a2d..c236b5e83b 100755 --- a/t/t5540-http-push.sh +++ b/t/t5540-http-push.sh @@ -51,17 +51,29 @@ test_expect_success 'clone remote repository' ' git clone $HTTPD_URL/test_repo.git test_repo_clone ' -test_expect_failure 'push to remote repository' ' +test_expect_failure 'push to remote repository with packed refs' ' cd "$ROOT_PATH"/test_repo_clone && : >path2 && git add path2 && test_tick && git commit -m path2 && + HEAD=$(git rev-parse --verify HEAD) && git push && - [ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ] + (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git && + test $HEAD = $(git rev-parse --verify HEAD)) ' -test_expect_failure 'create and delete remote branch' ' +test_expect_success ' push to remote repository with unpacked refs' ' + (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git && + rm packed-refs && + git update-ref refs/heads/master \ + 0c973ae9bd51902a28466f3850b543fa66a6aaf4) && + git push && + (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git && + test $HEAD = $(git rev-parse --verify HEAD)) +' + +test_expect_success 'create and delete remote branch' ' cd "$ROOT_PATH"/test_repo_clone && git checkout -b dev && : >path3 && From 3aed2fda6f8233895be0d1142c4c4b407fb692c3 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sun, 18 Jan 2009 04:46:09 +0100 Subject: [PATCH 7/8] builtin-fsck: fix off by one head count According to the man page, if "git fsck" is passed one or more heads, it should verify connectivity and validity of only objects reachable from the heads it is passed. However, since 5ac0a20 (Make builtin-fsck.c use parse_options., 2007-10-15) the command behaved as if no heads were passed, when given only one argument. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- builtin-fsck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin-fsck.c b/builtin-fsck.c index 30971ce0ad..aa4b239e42 100644 --- a/builtin-fsck.c +++ b/builtin-fsck.c @@ -624,7 +624,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix) } heads = 0; - for (i = 1; i < argc; i++) { + for (i = 0; i < argc; i++) { const char *arg = argv[i]; if (!get_sha1(arg, head_sha1)) { struct object *obj = lookup_object(head_sha1); From 9d3043cf333ee500e476a558acb234b42e43cc62 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 17 Jan 2009 23:04:35 -0800 Subject: [PATCH 8/8] Update draft release notes for 1.6.1.1 Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.6.1.1.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/RelNotes-1.6.1.1.txt b/Documentation/RelNotes-1.6.1.1.txt index cff0d8b98d..5cd1ca9cc6 100644 --- a/Documentation/RelNotes-1.6.1.1.txt +++ b/Documentation/RelNotes-1.6.1.1.txt @@ -9,9 +9,14 @@ Fixes since v1.6.1 * "git checkout $tree" did not trigger an error. +* "git commit" tried to remove COMMIT_EDITMSG from the work tree by mistake. + * "git describe --all" complained when a commit is described with a tag, which was nonsense. +* "git fsck branch" did not work as advertised; instead it behaved the same + way as "git fsck". + * "git log --pretty=format:%s" did not handle a multi-line subject the same way as built-in log listers (i.e. shortlog, --pretty=oneline, etc.) @@ -38,7 +43,7 @@ Other documentation updates. --- exec >/var/tmp/1 -O=v1.6.1-47-g914186a +O=v1.6.1-60-g78f111e echo O=$(git describe maint) git shortlog --no-merges $O..maint