From 3a81f33c526a09b3ae22b01d56c7ab921d19c382 Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Sat, 19 Nov 2011 19:38:54 +0000 Subject: [PATCH 1/4] t5501-*.sh: Fix url passed to clone in setup test In particular, the url passed to git-clone has an extra '/' given after the 'file://' schema prefix, thus: git clone --reference=original "file:///$(pwd)/original one Once the prefix is removed, the remainder of the url looks something like "//home/ramsay/git/t/...", which is then interpreted as an network path. This then results in a "Permission denied" error, like so: ramsay $ ls //home ls: cannot access //home: No such host or network path ramsay $ ls //home/ramsay ls: cannot access //home/ramsay: Permission denied ramsay $ In order to fix the problem, we simply remove the extraneous '/' character from the url. Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- t/t5501-fetch-push-alternates.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t5501-fetch-push-alternates.sh b/t/t5501-fetch-push-alternates.sh index b5ced8483a..1bc57ac03f 100755 --- a/t/t5501-fetch-push-alternates.sh +++ b/t/t5501-fetch-push-alternates.sh @@ -28,7 +28,7 @@ test_expect_success setup ' done ) && ( - git clone --reference=original "file:///$(pwd)/original" one && + git clone --reference=original "file://$(pwd)/original" one && cd one && echo Z >count && git add count && From 05bab3ea283d687d7981583aa87e03279f3b1484 Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Sat, 19 Nov 2011 19:42:00 +0000 Subject: [PATCH 2/4] config.c: Fix a static buffer overwrite bug by avoiding mkpath() On cygwin, test number 21 of t3200-branch.sh (git branch -m q q2 without config should succeed) fails. The failure involves the functions from path.c which parcel out internal static buffers from the git_path() and mkpath() functions. In particular, the rename_ref() function calls safe_create_leading\ _directories() with a filename returned by git_path("logs/%s", ref). safe_create_leading_directories(), in turn, calls stat() on each element of the path it is given. On cygwin, this leads to a call to git_config() for each component of the path, since this test explicitly removes the config file. git_config() calls mkpath(), so on the fourth component of the path, the original buffer passed into the function is overwritten with the config filename. Note that this bug is specific to cygwin and it's schizophrenic stat() functions (see commits adbc0b6, 7faee6b and 7974843). The lack of a config file and a path with at least four elements is also important to trigger the bug. In order to fix the problem, we replace the call to mkpath() with a call to mksnpath() and provide our own buffer. Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c index edf9914df6..b6d789a189 100644 --- a/config.c +++ b/config.c @@ -865,12 +865,12 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config) home = getenv("HOME"); if (home) { - char *user_config = xstrdup(mkpath("%s/.gitconfig", home)); + char buf[PATH_MAX]; + char *user_config = mksnpath(buf, sizeof(buf), "%s/.gitconfig", home); if (!access(user_config, R_OK)) { ret += git_config_from_file(fn, user_config, data); found += 1; } - free(user_config); } if (repo_config && !access(repo_config, R_OK)) { From 1e501a7c47ad5ada53d3b1acfb9f131f76e969ec Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Mon, 14 Nov 2011 23:55:52 +0100 Subject: [PATCH 3/4] documentation fix: git difftool uses diff tools, not merge tools. Let the documentation for -t list valid *diff* tools, not valid *merge* tools. Signed-off-by: Thomas Hochstein Signed-off-by: Junio C Hamano --- Documentation/git-difftool.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-difftool.txt b/Documentation/git-difftool.txt index a03515f1ec..19d473c070 100644 --- a/Documentation/git-difftool.txt +++ b/Documentation/git-difftool.txt @@ -31,7 +31,7 @@ OPTIONS -t :: --tool=:: Use the diff tool specified by . - Valid merge tools are: + Valid diff tools are: araxis, bc3, diffuse, emerge, ecmerge, gvimdiff, kdiff3, kompare, meld, opendiff, p4merge, tkdiff, vimdiff and xxdiff. + From ef563de6dd6997b913d5c87f6caf09db7e44bdcd Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Mon, 21 Nov 2011 18:42:09 +0000 Subject: [PATCH 4/4] convert.c: Fix return type of git_path_check_eol() The git_path_check_eol() function converts a string value to the corresponding 'enum eol' value. However, the function is currently declared to return an 'enum crlf_action', which causes sparse to complain thus: SP convert.c convert.c:736:50: warning: mixing different enum types convert.c:736:50: int enum crlf_action versus convert.c:736:50: int enum eol In order to suppress the warning, we simply correct the return type in the function declaration. Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- convert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/convert.c b/convert.c index 038b0be617..86e9c29ec0 100644 --- a/convert.c +++ b/convert.c @@ -658,7 +658,7 @@ static enum crlf_action git_path_check_crlf(const char *path, struct git_attr_ch return CRLF_GUESS; } -static enum crlf_action git_path_check_eol(const char *path, struct git_attr_check *check) +static enum eol git_path_check_eol(const char *path, struct git_attr_check *check) { const char *value = check->value;