From f5e025a9d5b35e24768475f6890b836ce0d5ed15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Tue, 29 Dec 2009 14:48:41 +0700 Subject: [PATCH 1/5] Documentation: always respect core.worktree if set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The value of core.worktree in a ".git/config" is honored even when it differs from the directory that has the ".git" directory as its subdirectory. This is likely to be a misconfiguration, so warn users about it. Also, drop the part of the documentation that incorrectly claimed that we ignore such a misconfigured value. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- Documentation/config.txt | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index a1e36d7e42..b5b27ba8d3 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -297,17 +297,24 @@ false), while all other repositories are assumed to be bare (bare = true). core.worktree:: - Set the path to the working tree. The value will not be - used in combination with repositories found automatically in - a .git directory (i.e. $GIT_DIR is not set). + Set the path to the root of the work tree. This can be overridden by the GIT_WORK_TREE environment variable and the '--work-tree' command line option. It can be - a absolute path or relative path to the directory specified by - --git-dir or GIT_DIR. - Note: If --git-dir or GIT_DIR are specified but none of + an absolute path or a relative path to the .git directory, + either specified by --git-dir or GIT_DIR, or automatically + discovered. + If --git-dir or GIT_DIR are specified but none of --work-tree, GIT_WORK_TREE and core.worktree is specified, - the current working directory is regarded as the top directory - of your working tree. + the current working directory is regarded as the root of the + work tree. ++ +Note that this variable is honored even when set in a configuration +file in a ".git" subdirectory of a directory, and its value differs +from the latter directory (e.g. "/path/to/.git/config" has +core.worktree set to "/different/path"), which is most likely a +misconfiguration. Running git commands in "/path/to" directory will +still use "/different/path" as the root of the work tree and can cause +great confusion to the users. core.logAllRefUpdates:: Enable the reflog. Updates to a ref is logged to the file From 153bb839aa0c36bf5c056a0b74b6d4d2fe99c157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Tue, 29 Dec 2009 15:13:18 +0700 Subject: [PATCH 2/5] t7102: make the test fail if one of its check fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- t/t7102-reset.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index e637c7d4db..5f3916bf4f 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -139,19 +139,19 @@ test_expect_success \ test_expect_success \ 'resetting to HEAD with no changes should succeed and do nothing' ' git reset --hard && - check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc && git reset --hard HEAD && - check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc && git reset --soft && - check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc && git reset --soft HEAD && - check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc && git reset --mixed && - check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc && git reset --mixed HEAD && - check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc && git reset && - check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc && git reset HEAD && check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc ' From c985ddf318a8c41c6e1abc8bebd058b31c7413c1 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 29 Dec 2009 20:09:15 +0100 Subject: [PATCH 3/5] git count-objects: handle packs bigger than 4G Use off_t to count sizes of packs and objects to avoid overflow after 4Gb. Signed-off-by: Andreas Schwab Signed-off-by: Junio C Hamano --- builtin-count-objects.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/builtin-count-objects.c b/builtin-count-objects.c index 38b033fd71..80b2614fd4 100644 --- a/builtin-count-objects.c +++ b/builtin-count-objects.c @@ -10,7 +10,7 @@ static void count_objects(DIR *d, char *path, int len, int verbose, unsigned long *loose, - unsigned long *loose_size, + off_t *loose_size, unsigned long *packed_loose, unsigned long *garbage) { @@ -78,7 +78,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix) int len = strlen(objdir); char *path = xmalloc(len + 50); unsigned long loose = 0, packed = 0, packed_loose = 0, garbage = 0; - unsigned long loose_size = 0; + off_t loose_size = 0; struct option opts[] = { OPT__VERBOSE(&verbose), OPT_END(), @@ -104,7 +104,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix) if (verbose) { struct packed_git *p; unsigned long num_pack = 0; - unsigned long size_pack = 0; + off_t size_pack = 0; if (!packed_git) prepare_packed_git(); for (p = packed_git; p; p = p->next) { @@ -117,15 +117,15 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix) num_pack++; } printf("count: %lu\n", loose); - printf("size: %lu\n", loose_size / 1024); + printf("size: %lu\n", (unsigned long) (loose_size / 1024)); printf("in-pack: %lu\n", packed); printf("packs: %lu\n", num_pack); - printf("size-pack: %lu\n", size_pack / 1024); + printf("size-pack: %lu\n", (unsigned long) (size_pack / 1024)); printf("prune-packable: %lu\n", packed_loose); printf("garbage: %lu\n", garbage); } else printf("%lu objects, %lu kilobytes\n", - loose, loose_size / 1024); + loose, (unsigned long) (loose_size / 1024)); return 0; } From e97ca7f41f2b9bbdfc93d103c3f64337bb6dcc20 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Tue, 29 Dec 2009 16:54:49 -0500 Subject: [PATCH 4/5] commit: --cleanup is a message option In the usage message for "git commit", the --cleanup option appeared at the end, as one of the "contents options": usage: git commit [options] [--] ... ... Commit message options ... Commit contents options ... --allow-empty ok to record an empty change --cleanup how to strip spaces and #comments from message This is confusing, in part because it makes it ambiguous whether --allow-empty, just above, refers to an empty diff or an empty message. Move --cleanup into the 'message options' group. Also add a pair of comments to prevent similar oversights in the future. Signed-off-by: Greg Price Signed-off-by: Junio C Hamano --- builtin-commit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builtin-commit.c b/builtin-commit.c index fde7b891d9..cd4eff4719 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -86,8 +86,8 @@ static int opt_parse_m(const struct option *opt, const char *arg, int unset) static struct option builtin_commit_options[] = { OPT__QUIET(&quiet), OPT__VERBOSE(&verbose), - OPT_GROUP("Commit message options"), + OPT_GROUP("Commit message options"), OPT_STRING('F', "file", &logfile, "FILE", "read log from file"), OPT_STRING(0, "author", &force_author, "AUTHOR", "override author for commit"), OPT_CALLBACK('m', "message", &message, "MESSAGE", "specify commit message", opt_parse_m), @@ -96,6 +96,8 @@ static struct option builtin_commit_options[] = { OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"), OPT_STRING('t', "template", &template_file, "FILE", "use specified template file"), OPT_BOOLEAN('e', "edit", &edit_flag, "force edit of commit"), + OPT_STRING(0, "cleanup", &cleanup_arg, "default", "how to strip spaces and #comments from message"), + /* end commit message options */ OPT_GROUP("Commit contents options"), OPT_BOOLEAN('a', "all", &all, "commit all changed files"), @@ -106,7 +108,7 @@ static struct option builtin_commit_options[] = { OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"), { OPTION_STRING, 'u', "untracked-files", &untracked_files_arg, "mode", "show untracked files, optional modes: all, normal, no. (Default: all)", PARSE_OPT_OPTARG, NULL, (intptr_t)"all" }, OPT_BOOLEAN(0, "allow-empty", &allow_empty, "ok to record an empty change"), - OPT_STRING(0, "cleanup", &cleanup_arg, "default", "how to strip spaces and #comments from message"), + /* end commit contents options */ OPT_END() }; From 70d7099916c9621e157c620f9cc7fc982f109c55 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 30 Dec 2009 04:02:53 -0500 Subject: [PATCH 5/5] textconv: stop leaking file descriptors We read the output from textconv helpers over a pipe, but we never actually closed our end of the pipe after using it. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/diff.c b/diff.c index 387d19fded..69147b802f 100644 --- a/diff.c +++ b/diff.c @@ -3485,11 +3485,13 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec, if (start_command(&child) != 0 || strbuf_read(&buf, child.out, 0) < 0 || finish_command(&child) != 0) { + close(child.out); if (temp.name == temp.tmp_path) unlink(temp.name); error("error running textconv command '%s'", pgm); return NULL; } + close(child.out); if (temp.name == temp.tmp_path) unlink(temp.name);