diff options
42 files changed, 233 insertions, 96 deletions
diff --git a/.gitattributes b/.gitattributes index 6b9c715d2..0636deea9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ * whitespace=!indent,trail,space -*.[ch] whitespace +*.[ch] whitespace=indent,trail,space diff --git a/Documentation/RelNotes-1.6.3.3.txt b/Documentation/RelNotes-1.6.3.3.txt new file mode 100644 index 000000000..1c28398bb --- /dev/null +++ b/Documentation/RelNotes-1.6.3.3.txt @@ -0,0 +1,38 @@ +GIT v1.6.3.3 Release Notes +========================== + +Fixes since v1.6.3.2 +-------------------- + + * "git archive" running on Cygwin can get stuck in an infinite loop. + + * "git daemon" did not correctly parse the initial line that carries + virtual host request information. + + * "git diff --textconv" leaked memory badly when the textconv filter + errored out. + + * The built-in regular expressions to pick function names to put on + hunk header lines for java and objc were very inefficiently written. + + * in certain error situations git-fetch (and git-clone) on Windows didn't + detect connection abort and ended up waiting indefinitely. + + * import-tars script (in contrib) did not import symbolic links correctly. + + * http.c used CURLOPT_SSLKEY even on libcURL version 7.9.2, even though + it was only available starting 7.9.3. + + * low-level filelevel merge driver used return value from strdup() + without checking if we ran out of memory. + + * "git rebase -i" left stray closing parenthesis in its reflog message. + + * "git remote show" did not show all the URLs associated with the named + remote, even though "git remote -v" did. Made them consistent by + making the former show all URLs. + + * "whitespace" attribute that is set was meant to detect all errors known + to git, but it told git to ignore trailing carriage-returns. + +Includes other documentation fixes. diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf index dc76e7f07..87a90f2c3 100644 --- a/Documentation/asciidoc.conf +++ b/Documentation/asciidoc.conf @@ -17,6 +17,7 @@ caret=^ startsb=[ endsb=] tilde=~ +backtick=` ifdef::backend-docbook[] [linkgit-inlinemacro] diff --git a/Documentation/config.txt b/Documentation/config.txt index 5dcad94f8..c06eca43d 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -451,7 +451,9 @@ If the alias expansion is prefixed with an exclamation point, it will be treated as a shell command. For example, defining "alias.new = !gitk --all --not ORIG_HEAD", the invocation "git new" is equivalent to running the shell command -"gitk --all --not ORIG_HEAD". +"gitk --all --not ORIG_HEAD". Note that shell commands will be +executed from the top-level directory of a repository, which may +not necessarily be the current directory. apply.whitespace:: Tells 'git-apply' how to handle whitespaces, in the same way diff --git a/Documentation/git-show-ref.txt b/Documentation/git-show-ref.txt index 2f173fff3..98e294aa8 100644 --- a/Documentation/git-show-ref.txt +++ b/Documentation/git-show-ref.txt @@ -24,7 +24,7 @@ The --exclude-existing form is a filter that does the inverse, it shows the refs from stdin that don't exist in the local repository. Use of this utility is encouraged in favor of directly accessing files under -in the `.git` directory. +the `.git` directory. OPTIONS ------- @@ -50,7 +50,7 @@ OPTIONS -s:: --hash:: - Only show the SHA1 hash, not the reference name. When also using + Only show the SHA1 hash, not the reference name. When combined with --dereference the dereferenced tag will still be shown after the SHA1. --verify:: diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt index 3b8df4467..15b34d376 100644 --- a/Documentation/git-submodule.txt +++ b/Documentation/git-submodule.txt @@ -137,8 +137,9 @@ foreach:: the processing to terminate. This can be overridden by adding '|| :' to the end of the command. + -As an example, "git submodule foreach 'echo $path `git rev-parse HEAD`' will -show the path and currently checked out commit for each submodule. +As an example, +git submodule foreach \'echo $path {backtick}git +rev-parse HEAD{backtick}'+ will show the path and currently checked out +commit for each submodule. sync:: Synchronizes submodules' remote URL configuration setting diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index 1c4089466..74be8435c 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -615,7 +615,7 @@ pulled or merged from. This is because the author favored If you use `git svn set-tree A..B` to commit several diffs and you do not have the latest remotes/git-svn merged into my-branch, you should use `git svn rebase` to update your work branch instead of `git pull` or -`git merge`. `pull`/`merge' can cause non-linear history to be flattened +`git merge`. `pull`/`merge` can cause non-linear history to be flattened when committing into SVN, which can lead to merge commits reversing previous commits in SVN. diff --git a/Documentation/gittutorial.txt b/Documentation/gittutorial.txt index c7fa949c2..cf0689cfe 100644 --- a/Documentation/gittutorial.txt +++ b/Documentation/gittutorial.txt @@ -332,11 +332,11 @@ alice$ git log -p HEAD..FETCH_HEAD ------------------------------------------------ This operation is safe even if Alice has uncommitted local changes. -The range notation HEAD..FETCH_HEAD" means "show everything that is reachable -from the FETCH_HEAD but exclude anything that is reachable from HEAD. +The range notation "HEAD..FETCH_HEAD" means "show everything that is reachable +from the FETCH_HEAD but exclude anything that is reachable from HEAD". Alice already knows everything that leads to her current state (HEAD), -and reviewing what Bob has in his state (FETCH_HEAD) that she has not -seen with this command +and reviews what Bob has in his state (FETCH_HEAD) that she has not +seen with this command. If Alice wants to visualize what Bob did since their histories forked she can issue the following command: @@ -375,9 +375,9 @@ it easier: alice$ git remote add bob /home/bob/myrepo ------------------------------------------------ -With this, Alice can perform the first part of the "pull" operation alone using the -'git-fetch' command without merging them with her own branch, -using: +With this, Alice can perform the first part of the "pull" operation +alone using the 'git-fetch' command without merging them with her own +branch, using: ------------------------------------- alice$ git fetch bob @@ -566,22 +566,22 @@ $ git log v2.5.. Makefile # commits since v2.5 which modify You can also give 'git-log' a "range" of commits where the first is not necessarily an ancestor of the second; for example, if the tips of -the branches "stable-release" and "master" diverged from a common +the branches "stable" and "master" diverged from a common commit some time ago, then ------------------------------------- -$ git log stable..experimental +$ git log stable..master ------------------------------------- -will list commits made in the experimental branch but not in the +will list commits made in the master branch but not in the stable branch, while ------------------------------------- -$ git log experimental..stable +$ git log master..stable ------------------------------------- will show the list of commits made on the stable branch but not -the experimental branch. +the master branch. The 'git-log' command has a weakness: it must present commits in a list. When the history has lines of development that diverged and diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 0673f0db9..902bfbf4e 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.6.3.2 +DEF_VER=v1.6.3.3 LF=' ' @@ -1385,7 +1385,7 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS) $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) -$(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) +$(patsubst git-%$X,%.o,$(PROGRAMS)) git.o: $(LIB_H) $(wildcard */*.h) builtin-revert.o wt-status.o: wt-status.h $(LIB_FILE): $(LIB_OBJS) @@ -1 +1 @@ -Documentation/RelNotes-1.6.3.2.txt
\ No newline at end of file +Documentation/RelNotes-1.6.3.3.txt
\ No newline at end of file @@ -35,8 +35,7 @@ static struct git_attr *(git_attr_hash[HASHSIZE]); static unsigned hash_name(const char *name, int namelen) { - unsigned val = 0; - unsigned char c; + unsigned val = 0, c; while (namelen--) { c = *name++; @@ -556,6 +555,8 @@ static void prepare_attr_stack(const char *path, int dirlen) } } + strbuf_release(&pathbuf); + /* * Finally push the "info" one at the top of the stack. */ @@ -91,7 +91,7 @@ void encode_85(char *buf, const unsigned char *data, int bytes) unsigned acc = 0; int cnt; for (cnt = 24; cnt >= 0; cnt -= 8) { - int ch = *data++; + unsigned ch = *data++; acc |= ch << cnt; if (--bytes == 0) break; diff --git a/builtin-add.c b/builtin-add.c index ad889aac5..d6ad57bfc 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -250,6 +250,8 @@ int cmd_add(int argc, const char **argv, const char *prefix) int add_new_files; int require_pathspec; + git_config(add_config, NULL); + argc = parse_options(argc, argv, builtin_add_options, builtin_add_usage, 0); if (patch_interactive) @@ -257,8 +259,6 @@ int cmd_add(int argc, const char **argv, const char *prefix) if (add_interactive) exit(interactive_add(argc, argv, prefix)); - git_config(add_config, NULL); - if (addremove && take_worktree_changes) die("-A and -u are mutually incompatible"); if ((addremove || take_worktree_changes) && !argc) { diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index d091e04af..1911cda1c 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -561,14 +561,6 @@ static void populate_value(struct refinfo *ref) ref->value = xcalloc(sizeof(struct atom_value), used_atom_cnt); - buf = get_obj(ref->objectname, &obj, &size, &eaten); - if (!buf) - die("missing object %s for %s", - sha1_to_hex(ref->objectname), ref->refname); - if (!obj) - die("parse_object_buffer failed on %s for %s", - sha1_to_hex(ref->objectname), ref->refname); - /* Fill in specials first */ for (i = 0; i < used_atom_cnt; i++) { const char *name = used_atom[i]; @@ -621,6 +613,22 @@ static void populate_value(struct refinfo *ref) } } + for (i = 0; i < used_atom_cnt; i++) { + struct atom_value *v = &ref->value[i]; + if (v->s == NULL) + goto need_obj; + } + return; + + need_obj: + buf = get_obj(ref->objectname, &obj, &size, &eaten); + if (!buf) + die("missing object %s for %s", + sha1_to_hex(ref->objectname), ref->refname); + if (!obj) + die("parse_object_buffer failed on %s for %s", + sha1_to_hex(ref->objectname), ref->refname); + grab_values(ref->value, 0, obj, buf, size); if (!eaten) free(buf); @@ -926,7 +934,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) memset(&cbdata, 0, sizeof(cbdata)); cbdata.grab_pattern = argv; - for_each_ref(grab_single_ref, &cbdata); + for_each_rawref(grab_single_ref, &cbdata); refs = cbdata.grab_array; num_refs = cbdata.grab_cnt; diff --git a/builtin-merge.c b/builtin-merge.c index 0b58e5eda..9e9bd526c 100644 --- a/builtin-merge.c +++ b/builtin-merge.c @@ -836,8 +836,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix) struct commit_list **remotes = &remoteheads; setup_work_tree(); + if (file_exists(git_path("MERGE_HEAD"))) + die("You have not concluded your merge. (MERGE_HEAD exists)"); if (read_cache_unmerged()) - die("You are in the middle of a conflicted merge."); + die("You are in the middle of a conflicted merge." + " (index unmerged)"); /* * Check if we are _not_ on a detached HEAD, i.e. if there is a diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 9742b45c4..941cc2d73 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -653,8 +653,7 @@ static void rehash_objects(void) static unsigned name_hash(const char *name) { - unsigned char c; - unsigned hash = 0; + unsigned c, hash = 0; if (!name) return 0; diff --git a/builtin-remote.c b/builtin-remote.c index d436412d9..7685cfcaf 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -789,7 +789,7 @@ static int get_remote_ref_states(const char *name, read_branches(); if (query) { - transport = transport_get(NULL, states->remote->url_nr > 0 ? + transport = transport_get(states->remote, states->remote->url_nr > 0 ? states->remote->url[0] : NULL); remote_refs = transport_get_remote_refs(transport); transport_disconnect(transport); diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c index 9a773239c..8e831be47 100644 --- a/builtin-unpack-objects.c +++ b/builtin-unpack-objects.c @@ -422,8 +422,8 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size, static void unpack_one(unsigned nr) { unsigned shift; - unsigned char *pack, c; - unsigned long size; + unsigned char *pack; + unsigned long size, c; enum object_type type; obj_list[nr].offset = consumed_bytes; diff --git a/builtin-upload-archive.c b/builtin-upload-archive.c index 0206b416c..c4cd1e132 100644 --- a/builtin-upload-archive.c +++ b/builtin-upload-archive.c @@ -80,16 +80,17 @@ static void error_clnt(const char *fmt, ...) die("sent error to the client: %s", buf); } -static void process_input(int child_fd, int band) +static ssize_t process_input(int child_fd, int band) { char buf[16384]; ssize_t sz = read(child_fd, buf, sizeof(buf)); if (sz < 0) { if (errno != EAGAIN && errno != EINTR) error_clnt("read error: %s\n", strerror(errno)); - return; + return sz; } send_sideband(1, band, buf, sz, LARGE_PACKET_MAX); + return sz; } int cmd_upload_archive(int argc, const char **argv, const char *prefix) @@ -131,6 +132,7 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix) while (1) { struct pollfd pfd[2]; + ssize_t processed[2] = { 0, 0 }; int status; pfd[0].fd = fd1[0]; @@ -147,12 +149,12 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix) } if (pfd[0].revents & POLLIN) /* Data stream ready */ - process_input(pfd[0].fd, 1); + processed[0] = process_input(pfd[0].fd, 1); if (pfd[1].revents & POLLIN) /* Status stream ready */ - process_input(pfd[1].fd, 2); + processed[1] = process_input(pfd[1].fd, 2); /* Always finish to read data when available */ - if ((pfd[0].revents | pfd[1].revents) & POLLIN) + if (processed[0] || processed[1]) continue; if (waitpid(writer, &status, 0) < 0) diff --git a/configure.ac b/configure.ac index 4e728bca3..25fbe3bb6 100644 --- a/configure.ac +++ b/configure.ac @@ -385,6 +385,8 @@ AC_SUBST(NO_EXPAT) # some Solaris installations). # Define NO_ICONV if neither libc nor libiconv support iconv. +if test -z "$NO_ICONV"; then + GIT_STASH_FLAGS($ICONVDIR) AC_DEFUN([ICONVTEST_SRC], [ @@ -431,6 +433,12 @@ GIT_UNSTASH_FLAGS($ICONVDIR) AC_SUBST(NEEDS_LIBICONV) AC_SUBST(NO_ICONV) +if test -n "$NO_ICONV"; then + NEEDS_LIBICONV= +fi + +fi + # # Define NO_DEFLATE_BOUND if deflateBound is missing from zlib. diff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl index 6309d146e..78e40d2a1 100755 --- a/contrib/fast-import/import-tars.perl +++ b/contrib/fast-import/import-tars.perl @@ -82,10 +82,16 @@ foreach my $tar_file (@ARGV) $mtime = oct $mtime; next if $typeflag == 5; # directory - print FI "blob\n", "mark :$next_mark\n", "data $size\n"; - while ($size > 0 && read(I, $_, 512) == 512) { - print FI substr($_, 0, $size); - $size -= 512; + print FI "blob\n", "mark :$next_mark\n"; + if ($typeflag == 2) { # symbolic link + print FI "data ", length($linkname), "\n", $linkname; + $mode = 0120000; + } else { + print FI "data $size\n"; + while ($size > 0 && read(I, $_, 512) == 512) { + print FI substr($_, 0, $size); + $size -= 512; + } } print FI "\n"; @@ -118,7 +124,8 @@ EOF { my ($mark, $mode) = @{$files{$path}}; $path =~ s,^([^/]+)/,, if $have_top_dir; - printf FI "M %o :%i %s\n", $mode & 0111 ? 0755 : 0644, $mark, $path; + $mode = $mode & 0111 ? 0755 : 0644 unless $mode == 0120000; + printf FI "M %o :%i %s\n", $mode, $mark, $path; } print FI "\n"; @@ -90,12 +90,11 @@ static inline unsigned long get_delta_hdr_size(const unsigned char **datap, const unsigned char *top) { const unsigned char *data = *datap; - unsigned char cmd; - unsigned long size = 0; + unsigned long cmd, size = 0; int i = 0; do { cmd = *data++; - size |= (cmd & ~0x80) << i; + size |= (cmd & 0x7f) << i; i += 7; } while (cmd & 0x80 && data < top); *datap = data; diff --git a/git-pull.sh b/git-pull.sh index 35261539a..cab367ada 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -176,13 +176,11 @@ case "$merge_head" in ?*' '?*) if test -z "$orig_head" then - echo >&2 "Cannot merge multiple branches into empty head" - exit 1 + die "Cannot merge multiple branches into empty head" fi if test true = "$rebase" then - echo >&2 "Cannot rebase onto multiple branches" - exit 1 + die "Cannot rebase onto multiple branches" fi ;; esac diff --git a/git-rebase.sh b/git-rebase.sh index b83fd3f97..334629fc9 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -168,10 +168,8 @@ run_pre_rebase_hook () { if test -z "$OK_TO_SKIP_PRE_REBASE" && test -x "$GIT_DIR/hooks/pre-rebase" then - "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || { - echo >&2 "The pre-rebase hook refused to rebase." - exit 1 - } + "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || + die "The pre-rebase hook refused to rebase." fi } @@ -359,8 +357,7 @@ fi # The tree must be really really clean. if ! git update-index --ignore-submodules --refresh; then - echo >&2 "cannot rebase: you have unstaged changes" - exit 1 + die "cannot rebase: you have unstaged changes" fi diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --) case "$diff" in diff --git a/git-request-pull.sh b/git-request-pull.sh index a2cf5b821..591777324 100755 --- a/git-request-pull.sh +++ b/git-request-pull.sh @@ -12,6 +12,9 @@ OPTIONS_SPEC= . git-sh-setup . git-parse-remote +GIT_PAGER= +export GIT_PAGER + base=$1 url=$2 head=${3-HEAD} @@ -34,7 +37,7 @@ branch=$(git ls-remote "$url" \ }") if [ -z "$branch" ]; then echo "warn: No branch of $url is at:" >&2 - git log --max-count=1 --pretty='format:warn: %h: %s' $headrev >&2 + git log --max-count=1 --pretty='tformat:warn: %h: %s' $headrev >&2 echo "warn: Are you sure you pushed $head there?" >&2 echo >&2 echo >&2 @@ -42,8 +45,6 @@ if [ -z "$branch" ]; then status=1 fi -PAGER= -export PAGER echo "The following changes since commit $baserev:" git shortlog --max-count=1 $baserev | sed -e 's/^\(.\)/ \1/' diff --git a/gitweb/README b/gitweb/README index ccda890c0..9056d1e09 100644 --- a/gitweb/README +++ b/gitweb/README @@ -377,7 +377,7 @@ named without a .git extension (e.g. /pub/git/project instead of DocumentRoot /var/www/gitweb - AliasMatch ^(/.*?)(\.git)(/.*)? /pub/git$1$3 + AliasMatch ^(/.*?)(\.git)(/.*)?$ /pub/git$1$3 <Directory /var/www/gitweb> Options ExecCGI AddHandler cgi-script cgi @@ -402,6 +402,14 @@ http://git.example.com/project will provide human-friendly gitweb access. +This solution is not 100% bulletproof, in the sense that if some project +has a named ref (branch, tag) starting with 'git/', then paths such as + +http://git.example.com/project/command/abranch..git/abranch + +will fail with a 404 error. + + Originally written by: Kay Sievers <kay.sievers@vrfy.org> diff --git a/http-push.c b/http-push.c index e16a0ad3f..0b12ffe18 100644 --- a/http-push.c +++ b/http-push.c @@ -724,9 +724,11 @@ static void finish_request(struct transfer_request *request) struct stat st; struct packed_git *target; struct packed_git **lst; + struct active_request_slot *slot; request->curl_result = request->slot->curl_result; request->http_code = request->slot->http_code; + slot = request->slot; request->slot = NULL; /* Keep locks active */ @@ -823,6 +825,7 @@ static void finish_request(struct transfer_request *request) fclose(request->local_stream); request->local_stream = NULL; + slot->local = NULL; if (!move_temp_to_file(request->tmpfile, request->filename)) { target = (struct packed_git *)request->userData; @@ -1024,17 +1027,20 @@ static int fetch_index(unsigned char *sha1) if (results.curl_result != CURLE_OK) { free(url); fclose(indexfile); + slot->local = NULL; return error("Unable to get pack index %s\n%s", url, curl_errorstr); } } else { free(url); fclose(indexfile); + slot->local = NULL; return error("Unable to start request"); } free(url); fclose(indexfile); + slot->local = NULL; return move_temp_to_file(tmpfile, filename); } diff --git a/http-walker.c b/http-walker.c index 7321ccc9f..937785192 100644 --- a/http-walker.c +++ b/http-walker.c @@ -418,15 +418,18 @@ static int fetch_index(struct walker *walker, struct alt_base *repo, unsigned ch run_active_slot(slot); if (results.curl_result != CURLE_OK) { fclose(indexfile); + slot->local = NULL; return error("Unable to get pack index %s\n%s", url, curl_errorstr); } } else { fclose(indexfile); + slot->local = NULL; return error("Unable to start request"); } fclose(indexfile); + slot->local = NULL; return move_temp_to_file(tmpfile, filename); } @@ -776,16 +779,19 @@ static int fetch_pack(struct walker *walker, struct alt_base *repo, unsigned cha run_active_slot(slot); if (results.curl_result != CURLE_OK) { fclose(packfile); + slot->local = NULL; return error("Unable to get pack file %s\n%s", url, curl_errorstr); } } else { fclose(packfile); + slot->local = NULL; return error("Unable to start request"); } target->pack_size = ftell(packfile); fclose(packfile); + slot->local = NULL; ret = move_temp_to_file(tmpfile, filename); if (ret) @@ -14,7 +14,7 @@ char curl_errorstr[CURL_ERROR_SIZE]; static int curl_ssl_verify = -1; static const char *ssl_cert; -#if LIBCURL_VERSION_NUM >= 0x070902 +#if LIBCURL_VERSION_NUM >= 0x070903 static const char *ssl_key; #endif #if LIBCURL_VERSION_NUM >= 0x070908 @@ -119,7 +119,7 @@ static int http_options(const char *var, const char *value, void *cb) } if (!strcmp("http.sslcert", var)) return git_config_string(&ssl_cert, var, value); -#if LIBCURL_VERSION_NUM >= 0x070902 +#if LIBCURL_VERSION_NUM >= 0x070903 if (!strcmp("http.sslkey", var)) return git_config_string(&ssl_key, var, value); #endif @@ -189,7 +189,7 @@ static CURL *get_curl_handle(void) if (ssl_cert != NULL) curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert); -#if LIBCURL_VERSION_NUM >= 0x070902 +#if LIBCURL_VERSION_NUM >= 0x070903 if (ssl_key != NULL) curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key); #endif @@ -303,7 +303,7 @@ void http_init(struct remote *remote) curl_ssl_verify = 0; set_from_env(&ssl_cert, "GIT_SSL_CERT"); -#if LIBCURL_VERSION_NUM >= 0x070902 +#if LIBCURL_VERSION_NUM >= 0x070903 set_from_env(&ssl_key, "GIT_SSL_KEY"); #endif #if LIBCURL_VERSION_NUM >= 0x070908 diff --git a/index-pack.c b/index-pack.c index 6e93ee6af..0c92bafcb 100644 --- a/index-pack.c +++ b/index-pack.c @@ -293,8 +293,8 @@ static void *unpack_entry_data(unsigned long offset, unsigned long size) static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_base) { - unsigned char *p, c; - unsigned long size; + unsigned char *p; + unsigned long size, c; off_t base_offset; unsigned shift; void *data; @@ -312,7 +312,7 @@ static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_ p = fill(1); c = *p; use(1); - size += (c & 0x7fUL) << shift; + size += (c & 0x7f) << shift; shift += 7; } obj->size = size; diff --git a/ll-merge.c b/ll-merge.c index 81c02ad05..f7c2bc927 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -238,7 +238,7 @@ static int read_merge_config(const char *var, const char *value, void *cb) if (!strcmp(var, "merge.default")) { if (value) - default_ll_merge = strdup(value); + default_ll_merge = xstrdup(value); return 0; } @@ -272,7 +272,7 @@ static int read_merge_config(const char *var, const char *value, void *cb) if (!strcmp("name", ep)) { if (!value) return error("%s: lacks value", var); - fn->description = strdup(value); + fn->description = xstrdup(value); return 0; } @@ -295,14 +295,14 @@ static int read_merge_config(const char *var, const char *value, void *cb) * file named by %A, and signal that it has done with zero exit * status. */ - fn->cmdline = strdup(value); + fn->cmdline = xstrdup(value); return 0; } if (!strcmp("recursive", ep)) { if (!value) return error("%s: lacks value", var); - fn->recursive = strdup(value); + fn->recursive = xstrdup(value); return 0; } diff --git a/patch-delta.c b/patch-delta.c index ed9db81fa..ef748ce96 100644 --- a/patch-delta.c +++ b/patch-delta.c @@ -44,7 +44,7 @@ void *patch_delta(const void *src_buf, unsigned long src_size, if (cmd & 0x01) cp_off = *data++; if (cmd & 0x02) cp_off |= (*data++ << 8); if (cmd & 0x04) cp_off |= (*data++ << 16); - if (cmd & 0x08) cp_off |= (*data++ << 24); + if (cmd & 0x08) cp_off |= ((unsigned) *data++ << 24); if (cmd & 0x10) cp_size = *data++; if (cmd & 0x20) cp_size |= (*data++ << 8); if (cmd & 0x40) cp_size |= (*data++ << 16); diff --git a/sha1_file.c b/sha1_file.c index e73cd4fc0..8f5fe62d5 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1162,8 +1162,7 @@ unsigned long unpack_object_header_buffer(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep) { unsigned shift; - unsigned char c; - unsigned long size; + unsigned long size, c; unsigned long used = 0; c = buf[used++]; @@ -260,7 +260,7 @@ size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f) res = fread(sb->buf + sb->len, 1, size, f); if (res > 0) strbuf_setlen(sb, sb->len + res); - else if (res < 0 && oldalloc == 0) + else if (oldalloc == 0) strbuf_release(sb); return res; } diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh index 0de613dc5..9b3fa2bdc 100755 --- a/t/t3030-merge-recursive.sh +++ b/t/t3030-merge-recursive.sh @@ -276,6 +276,9 @@ test_expect_success 'fail if the index has unresolved entries' ' test_must_fail git merge "$c5" && test_must_fail git merge "$c5" 2> out && + grep "You have not concluded your merge" out && + rm -f .git/MERGE_HEAD && + test_must_fail git merge "$c5" 2> out && grep "You are in the middle of a conflicted merge" out ' diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh index 9aaeabd97..e51e505a9 100755 --- a/t/t3505-cherry-pick-empty.sh +++ b/t/t3505-cherry-pick-empty.sh @@ -17,11 +17,11 @@ test_expect_success setup ' ' -test_expect_code 1 'cherry-pick an empty commit' ' - - git checkout master && - git cherry-pick empty-branch - +test_expect_success 'cherry-pick an empty commit' ' + git checkout master && { + git cherry-pick empty-branch + test "$?" = 1 + } ' test_expect_success 'index lockfile was removed' ' diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 050de42ef..fe93ce52e 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -221,6 +221,19 @@ test_expect_success POSIXPERM 'git add (add.ignore-errors = false)' ' test_must_fail git add --verbose . && ! ( git ls-files foo1 | grep foo1 ) ' +rm -f foo2 + +test_expect_success POSIXPERM '--no-ignore-errors overrides config' ' + git config add.ignore-errors 1 && + git reset --hard && + date >foo1 && + date >foo2 && + chmod 0 foo2 && + test_must_fail git add --verbose --no-ignore-errors . && + ! ( git ls-files foo1 | grep foo1 ) && + git config add.ignore-errors 0 +' +rm -f foo2 test_expect_success BSLASHPSPEC "git add 'fo\\[ou\\]bar' ignores foobar" ' git reset --hard && diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index abb41b07e..5f84b18fa 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -94,6 +94,10 @@ test_expect_success 'git archive with --output' \ 'git archive --output=b4.tar HEAD && test_cmp b.tar b4.tar' +test_expect_success 'git archive --remote' \ + 'git archive --remote=. HEAD >b5.tar && + test_cmp b.tar b5.tar' + test_expect_success \ 'validate file modification time' \ 'mkdir extract && diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index f275af824..7868af8f1 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -125,6 +125,36 @@ do done +cat >expected <<EOF +file:foo mmap bar_mmap +EOF + +test_expect_success 'grep -e A --and -e B' ' + git grep -e "foo mmap" --and -e bar_mmap >actual && + test_cmp expected actual +' + +cat >expected <<EOF +file:foo_mmap bar mmap +file:foo_mmap bar mmap baz +EOF + + +test_expect_success 'grep ( -e A --or -e B ) --and -e B' ' + git grep \( -e foo_ --or -e baz \) \ + --and -e " mmap" >actual && + test_cmp expected actual +' + +cat >expected <<EOF +file:foo mmap bar +EOF + +test_expect_success 'grep -e A --and --not -e B' ' + git grep -e "foo mmap" --and --not -e bar_mmap >actual && + test_cmp expected actual +' + test_expect_success 'log grep setup' ' echo a >>file && test_tick && diff --git a/userdiff.c b/userdiff.c index d556da975..57529ae63 100644 --- a/userdiff.c +++ b/userdiff.c @@ -13,7 +13,8 @@ PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$", "[^<>= \t]+|[^[:space:]]|[\x80-\xff]+"), PATTERNS("java", "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n" - "^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$", + "^[ \t]*(([A-Za-z_][A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$", + /* -- */ "[a-zA-Z_][a-zA-Z0-9_]*" "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?" "|[-+*/<>%&^|=!]=" @@ -25,7 +26,7 @@ PATTERNS("objc", /* Objective-C methods */ "^[ \t]*([-+][ \t]*\\([ \t]*[A-Za-z_][A-Za-z_0-9* \t]*\\)[ \t]*[A-Za-z_].*)$\n" /* C functions */ - "^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$\n" + "^[ \t]*(([A-Za-z_][A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$\n" /* Objective-C class/protocol definitions */ "^(@(implementation|interface|protocol)[ \t].*)$", /* -- */ @@ -10,11 +10,12 @@ static struct whitespace_rule { const char *rule_name; unsigned rule_bits; + unsigned loosens_error; } whitespace_rule_names[] = { - { "trailing-space", WS_TRAILING_SPACE }, - { "space-before-tab", WS_SPACE_BEFORE_TAB }, - { "indent-with-non-tab", WS_INDENT_WITH_NON_TAB }, - { "cr-at-eol", WS_CR_AT_EOL }, + { "trailing-space", WS_TRAILING_SPACE, 0 }, + { "space-before-tab", WS_SPACE_BEFORE_TAB, 0 }, + { "indent-with-non-tab", WS_INDENT_WITH_NON_TAB, 0 }, + { "cr-at-eol", WS_CR_AT_EOL, 1 }, }; unsigned parse_whitespace_rule(const char *string) @@ -79,7 +80,8 @@ unsigned whitespace_rule(const char *pathname) unsigned all_rule = 0; int i; for (i = 0; i < ARRAY_SIZE(whitespace_rule_names); i++) - all_rule |= whitespace_rule_names[i].rule_bits; + if (!whitespace_rule_names[i].loosens_error) + all_rule |= whitespace_rule_names[i].rule_bits; return all_rule; } else if (ATTR_FALSE(value)) { /* false (-whitespace) */ |