Merge branch 'maint' of git://github.com/git-l10n/git-po into maint
authorJunio C Hamano <gitster@pobox.com>
Fri, 1 Jun 2012 19:50:41 +0000 (12:50 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Jun 2012 19:50:41 +0000 (12:50 -0700)
By Peter Krefting
via Peter Krefting
* 'maint' of git://github.com/git-l10n/git-po:
Update Swedish translation (728t0f0u)

20 files changed:
Documentation/RelNotes/1.7.10.3.txt
Documentation/git-config.txt
Documentation/git-status.txt
GIT-VERSION-GEN
builtin/commit.c
builtin/fmt-merge-msg.c
cache.h
contrib/credential/osxkeychain/Makefile
diff-no-index.c
sha1_file.c
submodule.c
t/t3404-rebase-interactive.sh
t/t4041-diff-submodule-option.sh
t/t4053-diff-no-index.sh [new file with mode: 0755]
t/t7408-submodule-reference.sh
t/t7508-status.sh
t/t9300-fast-import.sh
unpack-trees.c
wt-status.c
wt-status.h
index 9c9ec25946666a7b43c18d1e9d2a1cb432d1d30d..703fbf1d60a7c2689af98bd368cd870fc954ea09 100644 (file)
@@ -4,6 +4,8 @@ Git v1.7.10.3 Release Notes
 Fixes since v1.7.10.2
 ---------------------
 
+ * The message file for German translation has been updated a bit.
+
  * Running "git checkout" on an unborn branch used to corrupt HEAD.
 
  * When checking out another commit from an already detached state, we
@@ -15,6 +17,9 @@ Fixes since v1.7.10.2
    "checkout" phase; when run without any "--quiet" option, it should
    give progress to the lengthy operation.
 
+ * The directory path used in "git diff --no-index", when it recurses
+   down, was broken with a recent update after v1.7.10.1 release.
+
  * "log -z --pretty=tformat:..." did not terminate each record with
    NUL.  The fix is not entirely correct when the output also asks for
    --patch and/or --stat, though.
@@ -23,4 +28,16 @@ Fixes since v1.7.10.2
    broken and gave undue precedence to configured log.date, causing
    "git stash list" to show "stash@{time stamp string}".
 
+ * "git status --porcelain" ignored "--branch" option by mistake.  The
+   output for "git status --branch -z" was also incorrect and did not
+   terminate the record for the current branch name with NUL as asked.
+
+ * When a submodule repository uses alternate object store mechanism,
+   some commands that were started from the superproject did not
+   notice it and failed with "No such object" errors.  The subcommands
+   of "git submodule" command that recursed into the submodule in a
+   separate process were OK; only the ones that cheated and peeked
+   directly into the submodule's repository from the primary process
+   were affected.
+
 Also contains minor fixes and documentation updates.
index 3f5d216a09e4c6bf6ed3351d074a72e782f005ed..d9463cb3874181456138d4ca54da4e3540bbeb4f 100644 (file)
@@ -198,9 +198,7 @@ If not set explicitly with '--file', there are three files where
 'git config' will search for configuration options:
 
 $GIT_DIR/config::
-       Repository specific configuration file. (The filename is
-       of course relative to the repository root, not the working
-       directory.)
+       Repository specific configuration file.
 
 ~/.gitconfig::
        User-specific configuration file. Also called "global"
index a29aae60cded28263785b3f35640246837b0df30..277e1e2ca31f1b3a8d5a32d9955ff22ecd82ec37 100644 (file)
@@ -177,7 +177,7 @@ order is reversed (e.g 'from \-> to' becomes 'to from'). Second, a NUL
 and the terminating newline (but a space still separates the status
 field from the first filename).  Third, filenames containing special
 characters are not specially formatted; no quoting or
-backslash-escaping is performed. Fourth, there is no branch line.
+backslash-escaping is performed.
 
 CONFIGURATION
 -------------
index 1df7b0ff662ba83fdf2d1a9e6ed2084f4995912f..86458311a15cfa8481011345081618499f442540 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.7.10.2
+DEF_VER=v1.7.10.3
 
 LF='
 '
index b257ae87740fb0887d285e88476a6ba423e6c25c..e2d9cbe3e387340e14103473e984f5b382df3134 100644 (file)
@@ -109,13 +109,11 @@ static int show_ignored_in_status;
 static const char *only_include_assumed;
 static struct strbuf message = STRBUF_INIT;
 
-static int null_termination;
 static enum {
        STATUS_FORMAT_LONG,
        STATUS_FORMAT_SHORT,
        STATUS_FORMAT_PORCELAIN
 } status_format = STATUS_FORMAT_LONG;
-static int status_show_branch;
 
 static int opt_parse_m(const struct option *opt, const char *arg, int unset)
 {
@@ -129,59 +127,6 @@ static int opt_parse_m(const struct option *opt, const char *arg, int unset)
        return 0;
 }
 
-static struct option builtin_commit_options[] = {
-       OPT__QUIET(&quiet, "suppress summary after successful commit"),
-       OPT__VERBOSE(&verbose, "show diff in commit message template"),
-
-       OPT_GROUP("Commit message options"),
-       OPT_FILENAME('F', "file", &logfile, "read message from file"),
-       OPT_STRING(0, "author", &force_author, "author", "override author for commit"),
-       OPT_STRING(0, "date", &force_date, "date", "override date for commit"),
-       OPT_CALLBACK('m', "message", &message, "message", "commit message", opt_parse_m),
-       OPT_STRING('c', "reedit-message", &edit_message, "commit", "reuse and edit message from specified commit"),
-       OPT_STRING('C', "reuse-message", &use_message, "commit", "reuse message from specified commit"),
-       OPT_STRING(0, "fixup", &fixup_message, "commit", "use autosquash formatted message to fixup specified commit"),
-       OPT_STRING(0, "squash", &squash_message, "commit", "use autosquash formatted message to squash specified commit"),
-       OPT_BOOLEAN(0, "reset-author", &renew_authorship, "the commit is authored by me now (used with -C/-c/--amend)"),
-       OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
-       OPT_FILENAME('t', "template", &template_file, "use specified template file"),
-       OPT_BOOL('e', "edit", &edit_flag, "force edit of commit"),
-       OPT_STRING(0, "cleanup", &cleanup_arg, "default", "how to strip spaces and #comments from message"),
-       OPT_BOOLEAN(0, "status", &include_status, "include status in commit message template"),
-       { OPTION_STRING, 'S', "gpg-sign", &sign_commit, "key id",
-         "GPG sign commit", PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
-       /* end commit message options */
-
-       OPT_GROUP("Commit contents options"),
-       OPT_BOOLEAN('a', "all", &all, "commit all changed files"),
-       OPT_BOOLEAN('i', "include", &also, "add specified files to index for commit"),
-       OPT_BOOLEAN(0, "interactive", &interactive, "interactively add files"),
-       OPT_BOOLEAN('p', "patch", &patch_interactive, "interactively add changes"),
-       OPT_BOOLEAN('o', "only", &only, "commit only specified files"),
-       OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"),
-       OPT_BOOLEAN(0, "dry-run", &dry_run, "show what would be committed"),
-       OPT_SET_INT(0, "short", &status_format, "show status concisely",
-                   STATUS_FORMAT_SHORT),
-       OPT_BOOLEAN(0, "branch", &status_show_branch, "show branch information"),
-       OPT_SET_INT(0, "porcelain", &status_format,
-                   "machine-readable output", STATUS_FORMAT_PORCELAIN),
-       OPT_BOOLEAN('z', "null", &null_termination,
-                   "terminate entries with NUL"),
-       OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"),
-       OPT_BOOLEAN(0, "no-post-rewrite", &no_post_rewrite, "bypass post-rewrite hook"),
-       { 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" },
-       /* end commit contents options */
-
-       { OPTION_BOOLEAN, 0, "allow-empty", &allow_empty, NULL,
-         "ok to record an empty change",
-         PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
-       { OPTION_BOOLEAN, 0, "allow-empty-message", &allow_empty_message, NULL,
-         "ok to record a change with an empty message",
-         PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
-
-       OPT_END()
-};
-
 static void determine_whence(struct wt_status *s)
 {
        if (file_exists(git_path("MERGE_HEAD")))
@@ -513,10 +458,10 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
 
        switch (status_format) {
        case STATUS_FORMAT_SHORT:
-               wt_shortstatus_print(s, null_termination, status_show_branch);
+               wt_shortstatus_print(s);
                break;
        case STATUS_FORMAT_PORCELAIN:
-               wt_porcelain_print(s, null_termination);
+               wt_porcelain_print(s);
                break;
        case STATUS_FORMAT_LONG:
                wt_status_print(s);
@@ -1046,6 +991,7 @@ static const char *read_commit_message(const char *name)
 }
 
 static int parse_and_validate_options(int argc, const char *argv[],
+                                     const struct option *options,
                                      const char * const usage[],
                                      const char *prefix,
                                      struct commit *current_head,
@@ -1053,8 +999,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
 {
        int f = 0;
 
-       argc = parse_options(argc, argv, prefix, builtin_commit_options, usage,
-                            0);
+       argc = parse_options(argc, argv, prefix, options, usage, 0);
 
        if (force_author && !strchr(force_author, '>'))
                force_author = find_author_by_nickname(force_author);
@@ -1135,7 +1080,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
        if (all && argc > 0)
                die(_("Paths with -a does not make sense."));
 
-       if (null_termination && status_format == STATUS_FORMAT_LONG)
+       if (s->null_termination && status_format == STATUS_FORMAT_LONG)
                status_format = STATUS_FORMAT_PORCELAIN;
        if (status_format != STATUS_FORMAT_LONG)
                dry_run = 1;
@@ -1222,19 +1167,19 @@ static int git_status_config(const char *k, const char *v, void *cb)
 
 int cmd_status(int argc, const char **argv, const char *prefix)
 {
-       struct wt_status s;
+       static struct wt_status s;
        int fd;
        unsigned char sha1[20];
        static struct option builtin_status_options[] = {
                OPT__VERBOSE(&verbose, "be verbose"),
                OPT_SET_INT('s', "short", &status_format,
                            "show status concisely", STATUS_FORMAT_SHORT),
-               OPT_BOOLEAN('b', "branch", &status_show_branch,
+               OPT_BOOLEAN('b', "branch", &s.show_branch,
                            "show branch information"),
                OPT_SET_INT(0, "porcelain", &status_format,
                            "machine-readable output",
                            STATUS_FORMAT_PORCELAIN),
-               OPT_BOOLEAN('z', "null", &null_termination,
+               OPT_BOOLEAN('z', "null", &s.null_termination,
                            "terminate entries with NUL"),
                { OPTION_STRING, 'u', "untracked-files", &untracked_files_arg,
                  "mode",
@@ -1259,7 +1204,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
                             builtin_status_options,
                             builtin_status_usage, 0);
 
-       if (null_termination && status_format == STATUS_FORMAT_LONG)
+       if (s.null_termination && status_format == STATUS_FORMAT_LONG)
                status_format = STATUS_FORMAT_PORCELAIN;
 
        handle_untracked_files_arg(&s);
@@ -1284,10 +1229,10 @@ int cmd_status(int argc, const char **argv, const char *prefix)
 
        switch (status_format) {
        case STATUS_FORMAT_SHORT:
-               wt_shortstatus_print(&s, null_termination, status_show_branch);
+               wt_shortstatus_print(&s);
                break;
        case STATUS_FORMAT_PORCELAIN:
-               wt_porcelain_print(&s, null_termination);
+               wt_porcelain_print(&s);
                break;
        case STATUS_FORMAT_LONG:
                s.verbose = verbose;
@@ -1422,6 +1367,60 @@ static int run_rewrite_hook(const unsigned char *oldsha1,
 
 int cmd_commit(int argc, const char **argv, const char *prefix)
 {
+       static struct wt_status s;
+       static struct option builtin_commit_options[] = {
+               OPT__QUIET(&quiet, "suppress summary after successful commit"),
+               OPT__VERBOSE(&verbose, "show diff in commit message template"),
+
+               OPT_GROUP("Commit message options"),
+               OPT_FILENAME('F', "file", &logfile, "read message from file"),
+               OPT_STRING(0, "author", &force_author, "author", "override author for commit"),
+               OPT_STRING(0, "date", &force_date, "date", "override date for commit"),
+               OPT_CALLBACK('m', "message", &message, "message", "commit message", opt_parse_m),
+               OPT_STRING('c', "reedit-message", &edit_message, "commit", "reuse and edit message from specified commit"),
+               OPT_STRING('C', "reuse-message", &use_message, "commit", "reuse message from specified commit"),
+               OPT_STRING(0, "fixup", &fixup_message, "commit", "use autosquash formatted message to fixup specified commit"),
+               OPT_STRING(0, "squash", &squash_message, "commit", "use autosquash formatted message to squash specified commit"),
+               OPT_BOOLEAN(0, "reset-author", &renew_authorship, "the commit is authored by me now (used with -C/-c/--amend)"),
+               OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
+               OPT_FILENAME('t', "template", &template_file, "use specified template file"),
+               OPT_BOOL('e', "edit", &edit_flag, "force edit of commit"),
+               OPT_STRING(0, "cleanup", &cleanup_arg, "default", "how to strip spaces and #comments from message"),
+               OPT_BOOLEAN(0, "status", &include_status, "include status in commit message template"),
+               { OPTION_STRING, 'S', "gpg-sign", &sign_commit, "key id",
+                 "GPG sign commit", PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
+               /* end commit message options */
+
+               OPT_GROUP("Commit contents options"),
+               OPT_BOOLEAN('a', "all", &all, "commit all changed files"),
+               OPT_BOOLEAN('i', "include", &also, "add specified files to index for commit"),
+               OPT_BOOLEAN(0, "interactive", &interactive, "interactively add files"),
+               OPT_BOOLEAN('p', "patch", &patch_interactive, "interactively add changes"),
+               OPT_BOOLEAN('o', "only", &only, "commit only specified files"),
+               OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"),
+               OPT_BOOLEAN(0, "dry-run", &dry_run, "show what would be committed"),
+               OPT_SET_INT(0, "short", &status_format, "show status concisely",
+                           STATUS_FORMAT_SHORT),
+               OPT_BOOLEAN(0, "branch", &s.show_branch, "show branch information"),
+               OPT_SET_INT(0, "porcelain", &status_format,
+                           "machine-readable output", STATUS_FORMAT_PORCELAIN),
+               OPT_BOOLEAN('z', "null", &s.null_termination,
+                           "terminate entries with NUL"),
+               OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"),
+               OPT_BOOLEAN(0, "no-post-rewrite", &no_post_rewrite, "bypass post-rewrite hook"),
+               { 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" },
+               /* end commit contents options */
+
+               { OPTION_BOOLEAN, 0, "allow-empty", &allow_empty, NULL,
+                 "ok to record an empty change",
+                 PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
+               { OPTION_BOOLEAN, 0, "allow-empty-message", &allow_empty_message, NULL,
+                 "ok to record a change with an empty message",
+                 PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
+
+               OPT_END()
+       };
+
        struct strbuf sb = STRBUF_INIT;
        struct strbuf author_ident = STRBUF_INIT;
        const char *index_file, *reflog_msg;
@@ -1431,7 +1430,6 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
        struct commit_list *parents = NULL, **pptr = &parents;
        struct stat statbuf;
        int allow_fast_forward = 1;
-       struct wt_status s;
        struct commit *current_head = NULL;
        struct commit_extra_header *extra = NULL;
 
@@ -1449,7 +1447,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                if (!current_head || parse_commit(current_head))
                        die(_("could not parse HEAD commit"));
        }
-       argc = parse_and_validate_options(argc, argv, builtin_commit_usage,
+       argc = parse_and_validate_options(argc, argv, builtin_commit_options,
+                                         builtin_commit_usage,
                                          prefix, current_head, &s);
        if (dry_run)
                return dry_run_commit(argc, argv, prefix, current_head, &s);
index fc083e3c5cdddc1696c42846e3a624361fc26e5a..fb1ebcbe68c2183468a782e068a59143f66366d5 100644 (file)
@@ -356,7 +356,10 @@ static void fmt_tag_signature(struct strbuf *tagbuf,
                strbuf_add(tagbuf, tag_body, buf + len - tag_body);
        }
        strbuf_complete_line(tagbuf);
-       strbuf_add_lines(tagbuf, "# ", sig->buf, sig->len);
+       if (sig->len) {
+               strbuf_addch(tagbuf, '\n');
+               strbuf_add_lines(tagbuf, "# ", sig->buf, sig->len);
+       }
 }
 
 static void fmt_merge_msg_sigs(struct strbuf *out)
@@ -521,8 +524,7 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
                rev.ignore_merges = 1;
                rev.limited = 1;
 
-               if (suffixcmp(out->buf, "\n"))
-                       strbuf_addch(out, '\n');
+               strbuf_complete_line(out);
 
                for (i = 0; i < origins.nr; i++)
                        shortlog(origins.items[i].string,
diff --git a/cache.h b/cache.h
index 5bf59ff5c33919ac42ee79dea7911a773c1f698d..84b82297484df95c6908c5d4571d63f9f04e601f 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -992,6 +992,7 @@ extern struct alternate_object_database {
        char base[FLEX_ARRAY]; /* more */
 } *alt_odb_list;
 extern void prepare_alt_odb(void);
+extern void read_info_alternates(const char * relative_base, int depth);
 extern void add_to_alternates_file(const char *reference);
 typedef int alt_odb_fn(struct alternate_object_database *, void *);
 extern void foreach_alt_odb(alt_odb_fn, void*);
index 75c07f8be4ae6ece8adb5c7190e4de38891f8787..4b3a08a2bac441f3841367d98f425b9b6a5a3598 100644 (file)
@@ -2,10 +2,13 @@ all:: git-credential-osxkeychain
 
 CC = gcc
 RM = rm -f
-CFLAGS = -g -Wall
+CFLAGS = -g -O2 -Wall
+
+-include ../../../config.mak.autogen
+-include ../../../config.mak
 
 git-credential-osxkeychain: git-credential-osxkeychain.o
-       $(CC) -o $@ $< -Wl,-framework -Wl,Security
+       $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) -Wl,-framework -Wl,Security
 
 git-credential-osxkeychain.o: git-credential-osxkeychain.c
        $(CC) -c $(CFLAGS) $<
index b44473e3c1fd5c2bdc4dce3af7aabc86fd37eb08..f0b0010aedd67f9b34f43426c47e837dfe2a522b 100644 (file)
@@ -68,6 +68,7 @@ static int queue_diff(struct diff_options *o,
                struct string_list p1 = STRING_LIST_INIT_DUP;
                struct string_list p2 = STRING_LIST_INIT_DUP;
                int i1, i2, ret = 0;
+               size_t len1 = 0, len2 = 0;
 
                if (name1 && read_directory(name1, &p1))
                        return -1;
@@ -80,18 +81,23 @@ static int queue_diff(struct diff_options *o,
                        strbuf_addstr(&buffer1, name1);
                        if (buffer1.len && buffer1.buf[buffer1.len - 1] != '/')
                                strbuf_addch(&buffer1, '/');
+                       len1 = buffer1.len;
                }
 
                if (name2) {
                        strbuf_addstr(&buffer2, name2);
                        if (buffer2.len && buffer2.buf[buffer2.len - 1] != '/')
                                strbuf_addch(&buffer2, '/');
+                       len2 = buffer2.len;
                }
 
                for (i1 = i2 = 0; !ret && (i1 < p1.nr || i2 < p2.nr); ) {
                        const char *n1, *n2;
                        int comp;
 
+                       strbuf_setlen(&buffer1, len1);
+                       strbuf_setlen(&buffer2, len2);
+
                        if (i1 == p1.nr)
                                comp = 1;
                        else if (i2 == p2.nr)
@@ -117,8 +123,8 @@ static int queue_diff(struct diff_options *o,
                }
                string_list_clear(&p1, 0);
                string_list_clear(&p2, 0);
-               strbuf_reset(&buffer1);
-               strbuf_reset(&buffer2);
+               strbuf_release(&buffer1);
+               strbuf_release(&buffer2);
 
                return ret;
        } else {
index 4f06a0e450359744528d3b125fb09eacebf1eb4a..f615fc72064ef17f989ebdb5bb6a3ac2256d872c 100644 (file)
@@ -228,7 +228,6 @@ char *sha1_pack_index_name(const unsigned char *sha1)
 struct alternate_object_database *alt_odb_list;
 static struct alternate_object_database **alt_odb_tail;
 
-static void read_info_alternates(const char * alternates, int depth);
 static int git_open_noatime(const char *name);
 
 /*
@@ -353,7 +352,7 @@ static void link_alt_odb_entries(const char *alt, const char *ep, int sep,
        }
 }
 
-static void read_info_alternates(const char * relative_base, int depth)
+void read_info_alternates(const char * relative_base, int depth)
 {
        char *map;
        size_t mapsz;
index 9a2806067954c55a27c068706b5bfe67a1189fd5..b63978a161c84101b41728d95f48326de897b12d 100644 (file)
@@ -63,6 +63,9 @@ static int add_submodule_odb(const char *path)
        alt_odb->name[40] = '\0';
        alt_odb->name[41] = '\0';
        alt_odb_list = alt_odb;
+
+       /* add possible alternates from the submodule */
+       read_info_alternates(objects_directory.buf, 0);
        prepare_alt_odb();
 done:
        strbuf_release(&objects_directory);
index 7fd2127625506c39371bda873ec2f56593b65aca..eab8501e11b31a65abc405885be425359220fdaa 100755 (executable)
@@ -247,6 +247,7 @@ test_expect_success '-p handles "no changes" gracefully' '
 '
 
 test_expect_failure 'exchange two commits with -p' '
+       git checkout H &&
        FAKE_LINES="2 1" git rebase -i -p HEAD~2 &&
        test H = $(git cat-file commit HEAD^ | sed -ne \$p) &&
        test G = $(git cat-file commit HEAD | sed -ne \$p)
index bf9a7526bd38a17e0e991739db8c4a1f8541b2f6..6c01d0c056e2608393ed16eea29dd45fc79d786c 100755 (executable)
@@ -458,4 +458,38 @@ EOF
        test_cmp expected actual
 '
 
+test_expect_success 'diff --submodule with objects referenced by alternates' '
+       mkdir sub_alt &&
+       (cd sub_alt &&
+               git init &&
+               echo a >a &&
+               git add a &&
+               git commit -m a
+       ) &&
+       mkdir super &&
+       (cd super &&
+               git clone -s ../sub_alt sub &&
+               git init &&
+               git add sub &&
+               git commit -m "sub a"
+       ) &&
+       (cd sub_alt &&
+               sha1_before=$(git rev-parse --short HEAD)
+               echo b >b &&
+               git add b &&
+               git commit -m b
+               sha1_after=$(git rev-parse --short HEAD)
+               echo "Submodule sub $sha1_before..$sha1_after:
+  > b" >../expected
+       ) &&
+       (cd super &&
+               (cd sub &&
+                       git fetch &&
+                       git checkout origin/master
+               ) &&
+               git diff --submodule > ../actual
+       )
+       test_cmp expected actual
+'
+
 test_done
diff --git a/t/t4053-diff-no-index.sh b/t/t4053-diff-no-index.sh
new file mode 100755 (executable)
index 0000000..4dc8c67
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+test_description='diff --no-index'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+       mkdir a &&
+       mkdir b &&
+       echo 1 >a/1 &&
+       echo 2 >a/2
+'
+
+test_expect_success 'git diff --no-index directories' '
+       git diff --no-index a b >cnt
+       test $? = 1 && test_line_count = 14 cnt
+'
+
+test_done
index a45fadc58e047aa0e6637b9ef5dce86a28ddc4f1..b770b2f04d56336f92b9394b4a2ce22a241480c4 100755 (executable)
@@ -28,7 +28,7 @@ git prune'
 
 cd "$base_dir"
 
-test_expect_success 'preparing supermodule' \
+test_expect_success 'preparing superproject' \
 'test_create_repo super && cd super &&
 echo file > file &&
 git add file &&
@@ -55,7 +55,7 @@ diff expected current'
 
 cd "$base_dir"
 
-test_expect_success 'cloning supermodule' \
+test_expect_success 'cloning superproject' \
 'git clone super super-clone'
 
 cd "$base_dir"
index fc57b135c50e34ab86c04d0a0ec81052ce40f8ff..5d0e79fe2a09c469c61b54957f5098c0928bca9c 100755 (executable)
@@ -271,6 +271,15 @@ test_expect_success 'status -s -b' '
 
 '
 
+test_expect_success 'status -s -z -b' '
+       tr "\\n" Q <expect >expect.q &&
+       mv expect.q expect &&
+       git status -s -z -b >output &&
+       nul_to_q <output >output.q &&
+       mv output.q output &&
+       test_cmp expect output
+'
+
 test_expect_success 'setup dir3' '
        mkdir dir3 &&
        : >dir3/untracked1 &&
@@ -647,9 +656,14 @@ test_expect_success 'status --porcelain ignores color.status' '
 git config --unset color.status
 git config --unset color.ui
 
-test_expect_success 'status --porcelain ignores -b' '
+test_expect_success 'status --porcelain respects -b' '
 
        git status --porcelain -b >output &&
+       {
+               echo "## master" &&
+               cat expect
+       } >tmp &&
+       mv tmp expect &&
        test_cmp expect output
 
 '
index 7da0e8da7bfd68c0ac4e0b987664c7340078eb99..2aa1824a940aa955fab408995d2479e50bd42b96 100755 (executable)
@@ -1657,7 +1657,7 @@ M 160000 :6 sub
 INPUT_END
 
 test_expect_success \
-       'P: supermodule & submodule mix' \
+       'P: superproject & submodule mix' \
        'git fast-import <input &&
         git checkout subuse1 &&
         rm -rf sub && mkdir sub && (cd sub &&
index 36523da22aedba160c5a29f95bf339f05dfc6feb..f0ac24b9f5306d6b805cc5a578cc7110f2cc09f3 100644 (file)
@@ -1209,7 +1209,7 @@ static int verify_uptodate_1(struct cache_entry *ce,
                        return 0;
                /*
                 * NEEDSWORK: the current default policy is to allow
-                * submodule to be out of sync wrt the supermodule
+                * submodule to be out of sync wrt the superproject
                 * index.  This needs to be tightened later for
                 * submodules that are marked to be automatically
                 * checked out.
index 9ffc535f1ab0296fd0a3330b1f136d69f9ac9bb2..bc268ceda0c639fdefd5ba70552a2ea250ddb8e6 100644 (file)
@@ -777,7 +777,7 @@ void wt_status_print(struct wt_status *s)
        }
 }
 
-static void wt_shortstatus_unmerged(int null_termination, struct string_list_item *it,
+static void wt_shortstatus_unmerged(struct string_list_item *it,
                           struct wt_status *s)
 {
        struct wt_status_change_data *d = it->util;
@@ -793,7 +793,7 @@ static void wt_shortstatus_unmerged(int null_termination, struct string_list_ite
        case 7: how = "UU"; break; /* both modified */
        }
        color_fprintf(s->fp, color(WT_STATUS_UNMERGED, s), "%s", how);
-       if (null_termination) {
+       if (s->null_termination) {
                fprintf(stdout, " %s%c", it->string, 0);
        } else {
                struct strbuf onebuf = STRBUF_INIT;
@@ -804,7 +804,7 @@ static void wt_shortstatus_unmerged(int null_termination, struct string_list_ite
        }
 }
 
-static void wt_shortstatus_status(int null_termination, struct string_list_item *it,
+static void wt_shortstatus_status(struct string_list_item *it,
                         struct wt_status *s)
 {
        struct wt_status_change_data *d = it->util;
@@ -818,7 +818,7 @@ static void wt_shortstatus_status(int null_termination, struct string_list_item
        else
                putchar(' ');
        putchar(' ');
-       if (null_termination) {
+       if (s->null_termination) {
                fprintf(stdout, "%s%c", it->string, 0);
                if (d->head_path)
                        fprintf(stdout, "%s%c", d->head_path, 0);
@@ -846,10 +846,10 @@ static void wt_shortstatus_status(int null_termination, struct string_list_item
        }
 }
 
-static void wt_shortstatus_other(int null_termination, struct string_list_item *it,
+static void wt_shortstatus_other(struct string_list_item *it,
                                 struct wt_status *s, const char *sign)
 {
-       if (null_termination) {
+       if (s->null_termination) {
                fprintf(stdout, "%s %s%c", sign, it->string, 0);
        } else {
                struct strbuf onebuf = STRBUF_INIT;
@@ -889,8 +889,8 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
        if (s->is_initial)
                color_fprintf(s->fp, header_color, _("Initial commit on "));
        if (!stat_tracking_info(branch, &num_ours, &num_theirs)) {
-               color_fprintf_ln(s->fp, branch_color_local,
-                       "%s", branch_name);
+               color_fprintf(s->fp, branch_color_local, "%s", branch_name);
+               fputc(s->null_termination ? '\0' : '\n', s->fp);
                return;
        }
 
@@ -914,14 +914,15 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
                color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
        }
 
-       color_fprintf_ln(s->fp, header_color, "]");
+       color_fprintf(s->fp, header_color, "]");
+       fputc(s->null_termination ? '\0' : '\n', s->fp);
 }
 
-void wt_shortstatus_print(struct wt_status *s, int null_termination, int show_branch)
+void wt_shortstatus_print(struct wt_status *s)
 {
        int i;
 
-       if (show_branch)
+       if (s->show_branch)
                wt_shortstatus_print_tracking(s);
 
        for (i = 0; i < s->change.nr; i++) {
@@ -931,28 +932,28 @@ void wt_shortstatus_print(struct wt_status *s, int null_termination, int show_br
                it = &(s->change.items[i]);
                d = it->util;
                if (d->stagemask)
-                       wt_shortstatus_unmerged(null_termination, it, s);
+                       wt_shortstatus_unmerged(it, s);
                else
-                       wt_shortstatus_status(null_termination, it, s);
+                       wt_shortstatus_status(it, s);
        }
        for (i = 0; i < s->untracked.nr; i++) {
                struct string_list_item *it;
 
                it = &(s->untracked.items[i]);
-               wt_shortstatus_other(null_termination, it, s, "??");
+               wt_shortstatus_other(it, s, "??");
        }
        for (i = 0; i < s->ignored.nr; i++) {
                struct string_list_item *it;
 
                it = &(s->ignored.items[i]);
-               wt_shortstatus_other(null_termination, it, s, "!!");
+               wt_shortstatus_other(it, s, "!!");
        }
 }
 
-void wt_porcelain_print(struct wt_status *s, int null_termination)
+void wt_porcelain_print(struct wt_status *s)
 {
        s->use_color = 0;
        s->relative_paths = 0;
        s->prefix = NULL;
-       wt_shortstatus_print(s, null_termination, 0);
+       wt_shortstatus_print(s);
 }
index 682b4c8f7da2c58f741a958f6488a48fd7b483b4..ab3c7cc8a130002c855a4f398c8ee9372c79144b 100644 (file)
@@ -56,6 +56,8 @@ struct wt_status {
        enum untracked_status_type show_untracked_files;
        const char *ignore_submodule_arg;
        char color_palette[WT_STATUS_MAXSLOT][COLOR_MAXLEN];
+       int null_termination;
+       int show_branch;
 
        /* These are computed during processing of the individual sections */
        int commitable;
@@ -72,8 +74,8 @@ void wt_status_prepare(struct wt_status *s);
 void wt_status_print(struct wt_status *s);
 void wt_status_collect(struct wt_status *s);
 
-void wt_shortstatus_print(struct wt_status *s, int null_termination, int show_branch);
-void wt_porcelain_print(struct wt_status *s, int null_termination);
+void wt_shortstatus_print(struct wt_status *s);
+void wt_porcelain_print(struct wt_status *s);
 
 void status_printf_ln(struct wt_status *s, const char *color, const char *fmt, ...)
        ;