Code

Merge branch 'jc/maint-merge-autoedit' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 2 Apr 2012 19:56:35 +0000 (12:56 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Apr 2012 19:56:35 +0000 (12:56 -0700)
* jc/maint-merge-autoedit:
  merge: backport GIT_MERGE_AUTOEDIT support

17 files changed:
Documentation/RelNotes/1.7.9.5.txt [new file with mode: 0644]
Documentation/git-grep.txt
Documentation/git-rebase.txt
Documentation/git-rerere.txt
Documentation/git.txt
Documentation/technical/api-string-list.txt
GIT-VERSION-GEN
RelNotes
advice.c
builtin/revert.c
config.c
fast-import.c
gitweb/gitweb.perl
t/Makefile
t/t1300-repo-config.sh
t/t9300-fast-import.sh
t/t9500-gitweb-standalone-no-errors.sh

diff --git a/Documentation/RelNotes/1.7.9.5.txt b/Documentation/RelNotes/1.7.9.5.txt
new file mode 100644 (file)
index 0000000..95cc2bb
--- /dev/null
@@ -0,0 +1,23 @@
+Git v1.7.9.5 Release Notes
+==========================
+
+Fixes since v1.7.9.4
+--------------------
+
+ * When "git config" diagnoses an error in a configuration file and
+   shows the line number for the offending line, it miscounted if the
+   error was at the end of line.
+
+ * "git fast-import" accepted "ls" command with an empty path by
+   mistake.
+
+ * Various new-ish output decoration modes of "git grep" were not
+   documented in the manual's synopsis section.
+
+ * The "remaining" subcommand to "git rerere" was not documented.
+
+ * "gitweb" used to drop warnings in the log file when "heads" view is
+   accessed in a repository whose HEAD does not point at a valid
+   branch.
+
+Also contains minor fixes and documentation updates.
index 6a8b1e3a7d06218903ce5614f51c4e7cbba73b17..343eadd4076664cc66c9d22db22d800e92cc6dc6 100644 (file)
@@ -20,7 +20,9 @@ SYNOPSIS
           [-c | --count] [--all-match] [-q | --quiet]
           [--max-depth <depth>]
           [--color[=<when>] | --no-color]
+          [--break] [--heading] [-p | --show-function]
           [-A <post-context>] [-B <pre-context>] [-C <context>]
+          [-W | --function-context]
           [-f <file>] [-e] <pattern>
           [--and|--or|--not|(|)|-e <pattern>...]
           [ [--exclude-standard] [--cached | --no-index | --untracked] | <tree>...]
index 504945c69153a30252527c16945836fd2aa2ec5a..520aaa94fb7b2be7c11e7eed013acf36055a41ab 100644 (file)
@@ -409,10 +409,13 @@ The interactive mode is meant for this type of workflow:
 
 where point 2. consists of several instances of
 
-a. regular use
+a) regular use
+
  1. finish something worthy of a commit
  2. commit
-b. independent fixup
+
+b) independent fixup
+
  1. realize that something does not work
  2. fix that
  3. commit it
index a6253ba617f5ebcd82e4cfb1702999c145fa346c..b43b7c8c0ed67fa37e20c41f35a703c28c4d9844 100644 (file)
@@ -8,7 +8,7 @@ git-rerere - Reuse recorded resolution of conflicted merges
 SYNOPSIS
 --------
 [verse]
-'git rerere' ['clear'|'forget' <pathspec>|'diff'|'status'|'gc']
+'git rerere' ['clear'|'forget' <pathspec>|'diff'|'remaining'|'status'|'gc']
 
 DESCRIPTION
 -----------
@@ -37,30 +37,35 @@ its working state.
 
 'clear'::
 
-This resets the metadata used by rerere if a merge resolution is to be
+Reset the metadata used by rerere if a merge resolution is to be
 aborted.  Calling 'git am [--skip|--abort]' or 'git rebase [--skip|--abort]'
 will automatically invoke this command.
 
 'forget' <pathspec>::
 
-This resets the conflict resolutions which rerere has recorded for the current
+Reset the conflict resolutions which rerere has recorded for the current
 conflict in <pathspec>.
 
 'diff'::
 
-This displays diffs for the current state of the resolution.  It is
+Display diffs for the current state of the resolution.  It is
 useful for tracking what has changed while the user is resolving
 conflicts.  Additional arguments are passed directly to the system
 'diff' command installed in PATH.
 
 'status'::
 
-Like 'diff', but this only prints the filenames that will be tracked
-for resolutions.
+Print paths with conflicts whose merge resolution rerere will record.
+
+'remaining'::
+
+Print paths with conflicts that have not been autoresolved by rerere.
+This includes paths whose resolutions cannot be tracked by rerere,
+such as conflicting submodules.
 
 'gc'::
 
-This prunes records of conflicted merges that
+Prune records of conflicted merges that
 occurred a long time ago.  By default, unresolved conflicts older
 than 15 days and resolved conflicts older than 60
 days are pruned.  These defaults are controlled via the
index d5b7667c15ef45e371b3fd3c4ecdf513f8f7cc02..7ccb55d148e476993e7f5bd31f8d80dc2f05d7f7 100644 (file)
@@ -44,9 +44,10 @@ unreleased) version of git, that is available from 'master'
 branch of the `git.git` repository.
 Documentation for older releases are available here:
 
-* link:v1.7.9.4/git.html[documentation for release 1.7.9.4]
+* link:v1.7.9.5/git.html[documentation for release 1.7.9.5]
 
 * release notes for
+  link:RelNotes/1.7.9.5.txt[1.7.9.5],
   link:RelNotes/1.7.9.4.txt[1.7.9.4],
   link:RelNotes/1.7.9.3.txt[1.7.9.3],
   link:RelNotes/1.7.9.2.txt[1.7.9.2],
@@ -711,6 +712,12 @@ other
        a pager.  See also the `core.pager` option in
        linkgit:git-config[1].
 
+'GIT_EDITOR'::
+       This environment variable overrides `$EDITOR` and `$VISUAL`.
+       It is used by several git comands when, on interactive mode,
+       an editor is to be launched. See also linkgit:git-var[1]
+       and the `core.editor` option in linkgit:git-config[1].
+
 'GIT_SSH'::
        If this environment variable is set then 'git fetch'
        and 'git push' will use this command instead
index ce24eb96f5efdee579f8600323731368fee4048b..5a0c14fcebfcf4d5cbad4900d062703412c501e1 100644 (file)
@@ -83,7 +83,9 @@ Functions
 
        Insert a new element to the string_list. The returned pointer can be
        handy if you want to write something to the `util` pointer of the
-       string_list_item containing the just added string.
+       string_list_item containing the just added string. If the given
+       string already exists the insertion will be skipped and the
+       pointer to the existing item returned.
 +
 Since this function uses xrealloc() (which die()s if it fails) if the
 list needs to grow, it is safe not to check the pointer. I.e. you may
index 8ddc96d952c48bd87055591f5b03118f00724010..0a5135c05df7f1e5a01dba0157d0986060225096 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.7.9.4
+DEF_VER=v1.7.9.5
 
 LF='
 '
index f9f04dd382737edd1e0caba5326e892017224a1d..d71b26d1196f6bd851c0bdc7005331e8822c10de 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/1.7.9.4.txt
\ No newline at end of file
+Documentation/RelNotes/1.7.9.5.txt
\ No newline at end of file
index e02e632df380a8e9772d9cd9b1282204c56a7d4e..65a07859f261e12e88d638a1f4546583e0133d4c 100644 (file)
--- a/advice.c
+++ b/advice.c
@@ -21,11 +21,21 @@ static struct {
 
 void advise(const char *advice, ...)
 {
+       struct strbuf buf = STRBUF_INIT;
        va_list params;
+       const char *cp, *np;
 
        va_start(params, advice);
-       vreportf("hint: ", advice, params);
+       strbuf_addf(&buf, advice, params);
        va_end(params);
+
+       for (cp = buf.buf; *cp; cp = np) {
+               np = strchrnul(cp, '\n');
+               fprintf(stderr, _("hint: %.*s\n"), (int)(np - cp), cp);
+               if (*np)
+                       np++;
+       }
+       strbuf_release(&buf);
 }
 
 int git_default_advice_config(const char *var, const char *value)
@@ -46,16 +56,15 @@ int git_default_advice_config(const char *var, const char *value)
 int error_resolve_conflict(const char *me)
 {
        error("'%s' is not possible because you have unmerged files.", me);
-       if (advice_resolve_conflict) {
+       if (advice_resolve_conflict)
                /*
                 * Message used both when 'git commit' fails and when
                 * other commands doing a merge do.
                 */
-               advise("Fix them up in the work tree,");
-               advise("and then use 'git add/rm <file>' as");
-               advise("appropriate to mark resolution and make a commit,");
-               advise("or use 'git commit -a'.");
-       }
+               advise(_("Fix them up in the work tree,\n"
+                        "and then use 'git add/rm <file>' as\n"
+                        "appropriate to mark resolution and make a commit,\n"
+                        "or use 'git commit -a'."));
        return -1;
 }
 
index 0d8020cf640e1abe6898308a1656446b327c83f4..df63794e050b0a27082952f458d93e0b254ce310 100644 (file)
@@ -343,11 +343,10 @@ static void print_advice(int show_hint)
                return;
        }
 
-       if (show_hint) {
-               advise("after resolving the conflicts, mark the corrected paths");
-               advise("with 'git add <paths>' or 'git rm <paths>'");
-               advise("and commit the result with 'git commit'");
-       }
+       if (show_hint)
+               advise(_("after resolving the conflicts, mark the corrected paths\n"
+                        "with 'git add <paths>' or 'git rm <paths>'\n"
+                        "and commit the result with 'git commit'"));
 }
 
 static void write_message(struct strbuf *msgbuf, const char *filename)
index 40f9c6d10317ed47f7786e5c328df3ab6f167e7c..818ba6df00e342f55fb7151b05299848240e61bd 100644 (file)
--- a/config.c
+++ b/config.c
@@ -135,8 +135,10 @@ static char *parse_value(void)
        for (;;) {
                int c = get_next_char();
                if (c == '\n') {
-                       if (quote)
+                       if (quote) {
+                               cf->linenr--;
                                return NULL;
+                       }
                        return cf->value.buf;
                }
                if (comment)
@@ -226,7 +228,7 @@ static int get_extended_base_var(char *name, int baselen, int c)
 {
        do {
                if (c == '\n')
-                       return -1;
+                       goto error_incomplete_line;
                c = get_next_char();
        } while (isspace(c));
 
@@ -238,13 +240,13 @@ static int get_extended_base_var(char *name, int baselen, int c)
        for (;;) {
                int c = get_next_char();
                if (c == '\n')
-                       return -1;
+                       goto error_incomplete_line;
                if (c == '"')
                        break;
                if (c == '\\') {
                        c = get_next_char();
                        if (c == '\n')
-                               return -1;
+                               goto error_incomplete_line;
                }
                name[baselen++] = c;
                if (baselen > MAXNAME / 2)
@@ -255,6 +257,9 @@ static int get_extended_base_var(char *name, int baselen, int c)
        if (get_next_char() != ']')
                return -1;
        return baselen;
+error_incomplete_line:
+       cf->linenr--;
+       return -1;
 }
 
 static int get_base_var(char *name)
index c1486cabbaa5f736f92994587fafd1f3afdf43af..a85275dc682d2bb8068f003b8281c3933488f010 100644 (file)
@@ -1641,6 +1641,8 @@ static int tree_content_get(
                n = slash1 - p;
        else
                n = strlen(p);
+       if (!n)
+               die("Empty path component found in input");
 
        if (!root->tree)
                load_tree(root);
@@ -3028,6 +3030,8 @@ static void parse_ls(struct branch *b)
                store_tree(&leaf);
 
        print_ls(leaf.versions[1].mode, leaf.versions[1].sha1, p);
+       if (leaf.tree)
+               release_tree_content_recursive(leaf.tree);
        if (!b || root != &b->branch_tree)
                release_tree_entry(root);
 }
index b9c33ba31d538e87f69a8f742b1f8ff2134cfd8c..b67972ec5d9e2ddd78ffccada03361ed0bc63a14 100755 (executable)
@@ -1132,8 +1132,10 @@ sub dispatch {
        if (!defined $action) {
                if (defined $hash) {
                        $action = git_get_type($hash);
+                       $action or die_error(404, "Object does not exist");
                } elsif (defined $hash_base && defined $file_name) {
                        $action = git_get_type("$hash_base:$file_name");
+                       $action or die_error(404, "File or directory does not exist");
                } elsif (defined $project) {
                        $action = 'summary';
                } else {
@@ -2400,7 +2402,7 @@ sub get_feed_info {
        return unless (defined $project);
        # some views should link to OPML, or to generic project feed,
        # or don't have specific feed yet (so they should use generic)
-       return if ($action =~ /^(?:tags|heads|forks|tag|search)$/x);
+       return if (!$action || $action =~ /^(?:tags|heads|forks|tag|search)$/x);
 
        my $branch;
        # branches refs uses 'refs/heads/' prefix (fullname) to differentiate
index 52a23fffc42384c7b3a0e409e08e5747fb939a2b..b5048ab77b9d580c3cc3f97e98f9a83209f2edb9 100644 (file)
@@ -17,9 +17,9 @@ DEFAULT_TEST_TARGET ?= test
 # Shell quote;
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 
-T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
-TSVN = $(wildcard t91[0-9][0-9]-*.sh)
-TGITWEB = $(wildcard t95[0-9][0-9]-*.sh)
+T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
+TSVN = $(sort $(wildcard t91[0-9][0-9]-*.sh))
+TGITWEB = $(sort $(wildcard t95[0-9][0-9]-*.sh))
 
 all: $(DEFAULT_TEST_TARGET)
 
index 0690e0edf4e758200d4febb1c7837b5c7059add6..728a965669e7a69014b950b8abbc672702caca27 100755 (executable)
@@ -960,4 +960,35 @@ test_expect_success 'git -c complains about empty key and value' '
        test_must_fail git -c "" rev-parse
 '
 
+# malformed configuration files
+test_expect_success 'barf on syntax error' '
+       cat >.git/config <<-\EOF &&
+       # broken section line
+       [section]
+       key garbage
+       EOF
+       test_must_fail git config --get section.key >actual 2>error &&
+       grep " line 3 " error
+'
+
+test_expect_success 'barf on incomplete section header' '
+       cat >.git/config <<-\EOF &&
+       # broken section line
+       [section
+       key = value
+       EOF
+       test_must_fail git config --get section.key >actual 2>error &&
+       grep " line 2 " error
+'
+
+test_expect_success 'barf on incomplete string' '
+       cat >.git/config <<-\EOF &&
+       # broken section line
+       [section]
+       key = "value string
+       EOF
+       test_must_fail git config --get section.key >actual 2>error &&
+       grep " line 3 " error
+'
+
 test_done
index 438aaf6b14b8ae0cb35739d6006eaf646876107c..0f5b5e5964a60f31cdfd6bc456848c2f4b820d0a 100755 (executable)
@@ -1306,6 +1306,45 @@ test_expect_success \
        M 040000 $subdir file3/
        INPUT_END'
 
+test_expect_success \
+       'N: reject foo/ syntax in copy source' \
+       'test_must_fail git fast-import <<-INPUT_END
+       commit refs/heads/N5C
+       committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+       data <<COMMIT
+       copy with invalid syntax
+       COMMIT
+
+       from refs/heads/branch^0
+       C file2/ file3
+       INPUT_END'
+
+test_expect_success \
+       'N: reject foo/ syntax in rename source' \
+       'test_must_fail git fast-import <<-INPUT_END
+       commit refs/heads/N5D
+       committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+       data <<COMMIT
+       rename with invalid syntax
+       COMMIT
+
+       from refs/heads/branch^0
+       R file2/ file3
+       INPUT_END'
+
+test_expect_success \
+       'N: reject foo/ syntax in ls argument' \
+       'test_must_fail git fast-import <<-INPUT_END
+       commit refs/heads/N5E
+       committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+       data <<COMMIT
+       copy with invalid syntax
+       COMMIT
+
+       from refs/heads/branch^0
+       ls "file2/"
+       INPUT_END'
+
 test_expect_success \
        'N: copy to root by id and modify' \
        'echo "hello, world" >expect.foo &&
index 858a649cb64e40a083a60c16e7ad818fdecb0fa9..90bb6050c13ece02199b6978e43e3c67de563c84 100755 (executable)
@@ -474,6 +474,14 @@ test_expect_success \
        'path_info: project/branch:dir/' \
        'gitweb_run "" "/.git/master:foo/"'
 
+test_expect_success \
+       'path_info: project/branch (non-existent)' \
+       'gitweb_run "" "/.git/non-existent"'
+
+test_expect_success \
+       'path_info: project/branch:filename (non-existent branch)' \
+       'gitweb_run "" "/.git/non-existent:non-existent"'
+
 test_expect_success \
        'path_info: project/branch:file (non-existent)' \
        'gitweb_run "" "/.git/master:non-existent"'