From 18a936805e82d769e33ea0dd866f8fe12ef1827e Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Thu, 14 Jun 2007 01:12:20 +0200 Subject: Generated spec file to be ignored is named git.spec and not git-core.spec Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano diff --git a/.gitignore b/.gitignore index 4dc0c39..b7546a5 100644 --- a/.gitignore +++ b/.gitignore @@ -156,7 +156,7 @@ common-cmds.h *.tar.gz *.dsc *.deb -git-core.spec +git.spec *.exe *.[ao] *.py[co] -- cgit v0.10.2-6-g49f6 From fa0c87c34471286b6c261c781a45ed090135295c Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Wed, 13 Jun 2007 20:54:32 +0200 Subject: Add a local implementation of hstrerror for the system which do not have it The function converts the value of h_errno (last error of name resolver library, see netdb.h). One of systems which supposedly do not have the function is SunOS. POSIX does not mandate its presence. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index fb11fa1..862c268 100644 --- a/Makefile +++ b/Makefile @@ -410,6 +410,7 @@ ifeq ($(uname_S),SunOS) NEEDS_NSL = YesPlease SHELL_PATH = /bin/bash NO_STRCASESTR = YesPlease + NO_HSTRERROR = YesPlease ifeq ($(uname_R),5.8) NEEDS_LIBICONV = YesPlease NO_UNSETENV = YesPlease @@ -654,6 +655,10 @@ endif ifdef NO_PERL_MAKEMAKER export NO_PERL_MAKEMAKER endif +ifdef NO_HSTRERROR + COMPAT_CFLAGS += -DNO_HSTRERROR + COMPAT_OBJS += compat/hstrerror.o +endif ifeq ($(TCLTK_PATH),) NO_TCLTK=NoThanks diff --git a/compat/hstrerror.c b/compat/hstrerror.c new file mode 100644 index 0000000..069c555 --- /dev/null +++ b/compat/hstrerror.c @@ -0,0 +1,21 @@ +#include +#include +#include + +const char *githstrerror(int err) +{ + static char buffer[48]; + switch (err) + { + case HOST_NOT_FOUND: + return "Authoritative answer: host not found"; + case NO_DATA: + return "Valid name, no data record of requested type"; + case NO_RECOVERY: + return "Non recoverable errors, FORMERR, REFUSED, NOTIMP"; + case TRY_AGAIN: + return "Non-authoritative \"host not found\", or SERVERFAIL"; + } + sprintf(buffer, "Name resolution error %d", err); + return buffer; +} diff --git a/git-compat-util.h b/git-compat-util.h index 6bd8987..b2ab3f8 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -167,6 +167,11 @@ extern size_t gitstrlcpy(char *, const char *, size_t); extern uintmax_t gitstrtoumax(const char *, char **, int); #endif +#ifdef NO_HSTRERROR +#define hstrerror githstrerror +extern const char *githstrerror(int herror); +#endif + extern void release_pack_memory(size_t, int); static inline char* xstrdup(const char *str) -- cgit v0.10.2-6-g49f6 From 634cd48a8afdd920fa26c8ec3ae43e96c82c81f2 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 5 Jun 2007 03:36:11 +0100 Subject: Move buffer_is_binary() to xdiff-interface.h We already have two instances where we want to determine if a buffer contains binary data as opposed to text. [jc: cherry-picked 6bfce93e from 'master'] Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/diff.c b/diff.c index af282dd..dc6da5e 100644 --- a/diff.c +++ b/diff.c @@ -1107,10 +1107,8 @@ static void setup_diff_attr_check(struct git_attr_check *check) check->attr = attr_diff; } -#define FIRST_FEW_BYTES 8000 static int file_is_binary(struct diff_filespec *one) { - unsigned long sz; struct git_attr_check attr_diff_check; setup_diff_attr_check(&attr_diff_check); @@ -1127,10 +1125,7 @@ static int file_is_binary(struct diff_filespec *one) return 0; diff_populate_filespec(one, 0); } - sz = one->size; - if (FIRST_FEW_BYTES < sz) - sz = FIRST_FEW_BYTES; - return !!memchr(one->data, 0, sz); + return buffer_is_binary(one->data, one->size); } static void builtin_diff(const char *name_a, diff --git a/grep.c b/grep.c index fcc6762..f67d671 100644 --- a/grep.c +++ b/grep.c @@ -1,5 +1,6 @@ #include "cache.h" #include "grep.h" +#include "xdiff-interface.h" void append_grep_pattern(struct grep_opt *opt, const char *pat, const char *origin, int no, enum grep_pat_token t) @@ -232,17 +233,6 @@ static void show_line(struct grep_opt *opt, const char *bol, const char *eol, printf("%.*s\n", (int)(eol-bol), bol); } -/* - * NEEDSWORK: share code with diff.c - */ -#define FIRST_FEW_BYTES 8000 -static int buffer_is_binary(const char *ptr, unsigned long size) -{ - if (FIRST_FEW_BYTES < size) - size = FIRST_FEW_BYTES; - return !!memchr(ptr, 0, size); -} - static int fixmatch(const char *pattern, char *line, regmatch_t *match) { char *hit = strstr(line, pattern); diff --git a/xdiff-interface.c b/xdiff-interface.c index 10816e9..963bb89 100644 --- a/xdiff-interface.c +++ b/xdiff-interface.c @@ -122,4 +122,12 @@ int read_mmfile(mmfile_t *ptr, const char *filename) return 0; } +#define FIRST_FEW_BYTES 8000 +int buffer_is_binary(const char *ptr, unsigned long size) +{ + if (FIRST_FEW_BYTES < size) + size = FIRST_FEW_BYTES; + return !!memchr(ptr, 0, size); +} + diff --git a/xdiff-interface.h b/xdiff-interface.h index 1918808..536f4e4 100644 --- a/xdiff-interface.h +++ b/xdiff-interface.h @@ -18,5 +18,6 @@ int parse_hunk_header(char *line, int len, int *ob, int *on, int *nb, int *nn); int read_mmfile(mmfile_t *ptr, const char *filename); +int buffer_is_binary(const char *ptr, unsigned long size); #endif -- cgit v0.10.2-6-g49f6 From fadf488f9b8c4fc709f0b083d2769ecc1e0e1119 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 5 Jun 2007 03:36:49 +0100 Subject: merge-recursive: refuse to merge binary files [jc: cherry-picked 9f30855 from 'master'] Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/merge-recursive.c b/merge-recursive.c index 8f72b2c..4a82b74 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -680,6 +680,12 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused, { xpparam_t xpp; + if (buffer_is_binary(orig->ptr, orig->size) || + buffer_is_binary(src1->ptr, src1->size) || + buffer_is_binary(src2->ptr, src2->size)) + return error("Cannot merge binary files: %s vs. %s\n", + name1, name2); + memset(&xpp, 0, sizeof(xpp)); return xdl_merge(orig, src1, name1, diff --git a/t/t6024-recursive-merge.sh b/t/t6024-recursive-merge.sh index a398556..058db9c 100755 --- a/t/t6024-recursive-merge.sh +++ b/t/t6024-recursive-merge.sh @@ -81,4 +81,18 @@ EOF test_expect_success "virtual trees were processed" "git diff expect out" +git reset --hard +test_expect_success 'refuse to merge binary files' ' + printf "\0" > binary-file && + git add binary-file && + git commit -m binary && + git checkout G && + printf "\0\0" > binary-file && + git add binary-file && + git commit -m binary2 && + ! git merge F > merge.out 2> merge.err && + grep "Cannot merge binary files: HEAD:binary-file vs. F:binary-file" \ + merge.err +' + test_done -- cgit v0.10.2-6-g49f6 From 1367214417ee55266ab951cf198bf1aa7e051965 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 15 Jun 2007 23:33:06 -0700 Subject: $EMAIL is a last resort fallback, as it's system-wide. $EMAIL is a system-wide setup that is used for many many many applications. If the git user chose a specific user.email setup, then _this_ should be honoured rather than $EMAIL. [jc: cherry-picked ec563e8 from 'master'] Signed-off-by: Pierre Habouzit Signed-off-by: Junio C Hamano diff --git a/ident.c b/ident.c index 69a04b8..3d49608 100644 --- a/ident.c +++ b/ident.c @@ -196,9 +196,9 @@ const char *fmt_ident(const char *name, const char *email, if (!name) name = git_default_name; if (!email) - email = getenv("EMAIL"); - if (!email) email = git_default_email; + if (!email) + email = getenv("EMAIL"); if (!*name) { struct passwd *pw; -- cgit v0.10.2-6-g49f6 From 7b99befef7d0ae173980f531e80916126011ca41 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 15 Jun 2007 23:35:32 -0700 Subject: git-branch --track: fix tracking branch computation. The original code did not take hierarchical branch names into account at all. [jc: cherry-picked 11f68d9 from 'master'] Tested-by: Gerrit Pape Signed-off-by: Junio C Hamano diff --git a/builtin-branch.c b/builtin-branch.c index 8956d0f..94dba6e 100644 --- a/builtin-branch.c +++ b/builtin-branch.c @@ -317,8 +317,6 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev) static char *config_repo; static char *config_remote; static const char *start_ref; -static int start_len; -static int base_len; static int get_remote_branch_name(const char *value) { @@ -334,26 +332,41 @@ static int get_remote_branch_name(const char *value) end = value + strlen(value); - /* Try an exact match first. */ + /* + * Try an exact match first. I.e. handle the case where the + * value is "$anything:refs/foo/bar/baz" and start_ref is exactly + * "refs/foo/bar/baz". Then the name at the remote is $anything. + */ if (!strcmp(colon + 1, start_ref)) { - /* Truncate the value before the colon. */ + /* Truncate the value before the colon. */ nfasprintf(&config_repo, "%.*s", colon - value, value); return 1; } - /* Try with a wildcard match now. */ - if (end - value > 2 && end[-2] == '/' && end[-1] == '*' && - colon - value > 2 && colon[-2] == '/' && colon[-1] == '*' && - (end - 2) - (colon + 1) == base_len && - !strncmp(colon + 1, start_ref, base_len)) { - /* Replace the star with the remote branch name. */ - nfasprintf(&config_repo, "%.*s%s", - (colon - 2) - value, value, - start_ref + base_len); - return 1; - } + /* + * Is this a wildcard match? + */ + if ((end - 2 <= value) || end[-2] != '/' || end[-1] != '*' || + (colon - 2 <= value) || colon[-2] != '/' || colon[-1] != '*') + return 0; - return 0; + /* + * Value is "refs/foo/bar/:refs/baz/boa/" + * and start_ref begins with "refs/baz/boa/"; the name at the + * remote is refs/foo/bar/ with the remaining part of the + * start_ref. The length of the prefix on the RHS is (end - + * colon - 2), including the slash immediately before the + * asterisk. + */ + if ((strlen(start_ref) < end - colon - 2) || + memcmp(start_ref, colon + 1, end - colon - 2)) + return 0; /* does not match prefix */ + + /* Replace the asterisk with the remote branch name. */ + nfasprintf(&config_repo, "%.*s%s", + (colon - 1) - value, value, + start_ref + (end - colon - 2)); + return 1; } static int get_remote_config(const char *key, const char *value) @@ -363,10 +376,12 @@ static int get_remote_config(const char *key, const char *value) return 0; var = strrchr(key, '.'); - if (var == key + 6) + if (var == key + 6 || strcmp(var, ".fetch")) return 0; - - if (!strcmp(var, ".fetch") && get_remote_branch_name(value)) + /* + * Ok, we are looking at key == "remote.$foo.fetch"; + */ + if (get_remote_branch_name(value)) nfasprintf(&config_remote, "%.*s", var - (key + 7), key + 7); return 0; @@ -392,14 +407,14 @@ static void set_branch_merge(const char *name, const char *config_remote, static void set_branch_defaults(const char *name, const char *real_ref) { - const char *slash = strrchr(real_ref, '/'); - - if (!slash) - return; - + /* + * name is the name of new branch under refs/heads; + * real_ref is typically refs/remotes/$foo/$bar, where + * $foo is the remote name (there typically are no slashes) + * and $bar is the branch name we map from the remote + * (it could have slashes). + */ start_ref = real_ref; - start_len = strlen(real_ref); - base_len = slash - real_ref; git_config(get_remote_config); if (!config_repo && !config_remote && !prefixcmp(real_ref, "refs/heads/")) { diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 828d553..6f6d884 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -136,8 +136,8 @@ test_expect_success 'test tracking setup (non-wildcard, not matching)' \ git-config remote.local.fetch refs/heads/s:refs/remotes/local/s && (git-show-ref -q refs/remotes/local/master || git-fetch local) && git-branch --track my5 local/master && - ! test $(git-config branch.my5.remote) = local && - ! test $(git-config branch.my5.merge) = refs/heads/master' + ! test "$(git-config branch.my5.remote)" = local && + ! test "$(git-config branch.my5.merge)" = refs/heads/master' test_expect_success 'test tracking setup via config' \ 'git-config branch.autosetupmerge true && @@ -155,14 +155,22 @@ test_expect_success 'test overriding tracking setup via --no-track' \ (git-show-ref -q refs/remotes/local/master || git-fetch local) && git-branch --no-track my2 local/master && git-config branch.autosetupmerge false && - ! test $(git-config branch.my2.remote) = local && - ! test $(git-config branch.my2.merge) = refs/heads/master' + ! test "$(git-config branch.my2.remote)" = local && + ! test "$(git-config branch.my2.merge)" = refs/heads/master' test_expect_success 'test local tracking setup' \ 'git branch --track my6 s && test $(git-config branch.my6.remote) = . && test $(git-config branch.my6.merge) = refs/heads/s' +test_expect_success 'test tracking setup via --track but deeper' \ + 'git-config remote.local.url . && + git-config remote.local.fetch refs/heads/*:refs/remotes/local/* && + (git-show-ref -q refs/remotes/local/o/o || git-fetch local) && + git-branch --track my7 local/o/o && + test "$(git-config branch.my7.remote)" = local && + test "$(git-config branch.my7.merge)" = refs/heads/o/o' + # Keep this test last, as it changes the current branch cat >expect < 1117150200 +0000 branch: Created from master -- cgit v0.10.2-6-g49f6 From 66e41f7b9912b3c9231c6577891eb12886d430e3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 15 Jun 2007 23:48:35 -0700 Subject: Avoid diff cost on "git log -z" Johannes and Marco discovered that "git log -z" spent cycles in diff even though there is no need to actually compute diffs. Signed-off-by: Junio C Hamano diff --git a/revision.c b/revision.c index 0125d41..e43c648 100644 --- a/revision.c +++ b/revision.c @@ -1171,7 +1171,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch opts = diff_opt_parse(&revs->diffopt, argv+i, argc-i); if (opts > 0) { - revs->diff = 1; + if (strcmp(argv[i], "-z")) + revs->diff = 1; i += opts - 1; continue; } -- cgit v0.10.2-6-g49f6 From 4c7100a9f438c281c18c800b450ea12045d22d62 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 14 Jun 2007 22:20:16 -0700 Subject: Documentation: adjust to AsciiDoc 8 It turns out that the attribute definition we have had for a long time to hide "^" character from AsciiDoc 7 was not honored by AsciiDoc 8 even under "-a asciidoc7compatible" mode. There is a similar breakage with the "compatible" mode with + characters. The double colon at the end of definition list term needs to be attached to the term, without a whitespace. After this minimum fixups, AsciiDoc 8 (I used 8.2.1 on Debian) with compatibility mode seems to produce reasonably good results. Signed-off-by: Junio C Hamano diff --git a/Documentation/Makefile b/Documentation/Makefile index 9cef480..4edf788 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -37,6 +37,9 @@ man7dir=$(mandir)/man7 ASCIIDOC=asciidoc ASCIIDOC_EXTRA = +ifdef ASCIIDOC8 +ASCIIDOC_EXTRA += -a asciidoc7compatible +endif INSTALL?=install DOC_REF = origin/man diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf index 60e15ba..e061f73 100644 --- a/Documentation/asciidoc.conf +++ b/Documentation/asciidoc.conf @@ -8,7 +8,8 @@ # the command. [attributes] -caret=^ +plus=+ +caret=^ startsb=[ endsb=] tilde=~ diff --git a/Documentation/git-cvsexportcommit.txt b/Documentation/git-cvsexportcommit.txt index fd7f540..f3590de 100644 --- a/Documentation/git-cvsexportcommit.txt +++ b/Documentation/git-cvsexportcommit.txt @@ -73,7 +73,7 @@ $ git-cvsexportcommit -v $ cvs commit -F .mgs ------------ -Merge pending patches into CVS automatically -- only if you really know what you are doing :: +Merge pending patches into CVS automatically -- only if you really know what you are doing:: + ------------ $ export GIT_DIR=~/project/.git diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 780f0f0..714e6a9 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -2757,8 +2757,8 @@ As a result, the general consistency of an object can always be tested independently of the contents or the type of the object: all objects can be validated by verifying that (a) their hashes match the content of the file and (b) the object successfully inflates to a stream of bytes that -forms a sequence of + + + + . +forms a sequence of {plus} {plus} {plus} {plus} . The structured objects can further have their structure and connectivity to other objects verified. This is generally done with diff --git a/Makefile b/Makefile index 862c268..50e7bb3 100644 --- a/Makefile +++ b/Makefile @@ -107,6 +107,8 @@ all:: # Define USE_STDEV below if you want git to care about the underlying device # change being considered an inode change from the update-cache perspective. # +# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8 +# # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's # MakeMaker (e.g. using ActiveState under Cygwin). # @@ -689,6 +691,10 @@ ifndef V endif endif +ifdef ASCIIDOC8 + export ASCIIDOC8 +endif + # Shell quote (do not use $(call) to accommodate ancient setups); SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER)) -- cgit v0.10.2-6-g49f6 From c7c84859ad586ae5670224e1abc4f846f7c3a9ae Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 15 Jun 2007 23:58:18 -0700 Subject: GIT 1.5.2.2 Signed-off-by: Junio C Hamano diff --git a/Documentation/RelNotes-1.5.2.2.txt b/Documentation/RelNotes-1.5.2.2.txt new file mode 100644 index 0000000..f6393f8 --- /dev/null +++ b/Documentation/RelNotes-1.5.2.2.txt @@ -0,0 +1,61 @@ +GIT v1.5.2.2 Release Notes +========================== + +Fixes since v1.5.2.1 +-------------------- + +* Usability fix + + - git-gui is shipped with its updated blame interface. It is + rumored that the older one was not just unusable but was + active health hazard, but this one is actually pretty. + Please see for yourself. + +* Bugfixes + + - "git checkout fubar" was utterly confused when there is a + branch fubar and a tag fubar at the same time. It correctly + checks out the branch fubar now. + + - "git clone /path/foo" to clone a local /path/foo.git + repository left an incorrect configuration. + + - "git send-email" correctly unquotes RFC 2047 quoted names in + the patch-email before using their values. + + - We did not accept number of seconds since epoch older than + year 2000 as a valid timestamp. We now interpret positive + integers more than 8 digits as such, which allows us to + express timestamps more recent than March 1973. + + - git-cvsimport did not work when you have GIT_DIR to point + your repository at a nonstandard location. + + - Some systems (notably, Solaris) lack hstrerror() to make + h_errno human readable; prepare a replacement + implementation. + + - .gitignore file listed git-core.spec but what we generate is + git.spec, and nobody noticed for a long time. + + - "git-merge-recursive" does not try to run file level merge + on binary files. + + - "git-branch --track" did not create tracking configuration + correctly when the branch name had slash in it. + + - The email address of the user specified with user.email + configuration was overriden by EMAIL environment variable. + + - The tree parser did not warn about tree entries with + nonsense file modes, and assumed they must be blobs. + + - "git log -z" without any other request to generate diff still + invoked the diff machinery, wasting cycles. + +* Documentation + + - Many updates to fix stale or missing documentation. + + - Although our documentation was primarily meant to be formatted + with AsciiDoc7, formatting with AsciiDoc8 is supported better. diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index bd30398..3c3cd2f 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.5.2.1.GIT +DEF_VER=v1.5.2.2.GIT LF=' ' diff --git a/RelNotes b/RelNotes index 403fb97..61f9778 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes-1.5.2.1.txt \ No newline at end of file +Documentation/RelNotes-1.5.2.2.txt \ No newline at end of file -- cgit v0.10.2-6-g49f6