diff options
-rw-r--r-- | Documentation/git-cat-file.txt | 2 | ||||
-rw-r--r-- | builtin/cat-file.c | 2 | ||||
-rw-r--r-- | builtin/diff.c | 2 | ||||
-rw-r--r-- | commit-graph.c | 3 | ||||
-rw-r--r-- | commit.c | 2 | ||||
-rw-r--r-- | contrib/completion/git-completion.bash | 18 | ||||
-rwxr-xr-x | git-send-email.perl | 8 | ||||
-rw-r--r-- | object.h | 1 | ||||
-rw-r--r-- | revision.c | 3 | ||||
-rwxr-xr-x | t/t4211-line-log.sh | 8 | ||||
-rwxr-xr-x | t/t5537-fetch-shallow.sh | 14 | ||||
-rwxr-xr-x | t/t9001-send-email.sh | 14 |
12 files changed, 60 insertions, 17 deletions
diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt index 8eca671b82..8e192d87db 100644 --- a/Documentation/git-cat-file.txt +++ b/Documentation/git-cat-file.txt @@ -10,7 +10,7 @@ SYNOPSIS -------- [verse] 'git cat-file' (-t [--allow-unknown-type]| -s [--allow-unknown-type]| -e | -p | <type> | --textconv | --filters ) [--path=<path>] <object> -'git cat-file' (--batch | --batch-check) [ --textconv | --filters ] [--follow-symlinks] +'git cat-file' (--batch[=<format>] | --batch-check[=<format>]) [ --textconv | --filters ] [--follow-symlinks] DESCRIPTION ----------- diff --git a/builtin/cat-file.c b/builtin/cat-file.c index ae18e20a7c..5ebf13359e 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -596,7 +596,7 @@ static int batch_objects(struct batch_options *opt) static const char * const cat_file_usage[] = { N_("git cat-file (-t [--allow-unknown-type] | -s [--allow-unknown-type] | -e | -p | <type> | --textconv | --filters) [--path=<path>] <object>"), - N_("git cat-file (--batch | --batch-check) [--follow-symlinks] [--textconv | --filters]"), + N_("git cat-file (--batch[=<format>] | --batch-check[=<format>]) [--follow-symlinks] [--textconv | --filters]"), NULL }; diff --git a/builtin/diff.c b/builtin/diff.c index 8c36da09b6..cb98811c21 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -355,9 +355,9 @@ static void symdiff_prepare(struct rev_info *rev, struct symdiff *sym) sym->left = rev->pending.objects[lpos].name; sym->right = rev->pending.objects[rpos].name; - sym->base = rev->pending.objects[basepos].name; if (basecount == 0) die(_("%s...%s: no merge base"), sym->left, sym->right); + sym->base = rev->pending.objects[basepos].name; bitmap_unset(map, basepos); /* unmark the base we want */ sym->warn = basecount > 1; sym->skip = map; diff --git a/commit-graph.c b/commit-graph.c index fdd1c4fa7c..328ab06fd4 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -203,7 +203,8 @@ static int commit_graph_compatible(struct repository *r) } prepare_commit_graft(r); - if (r->parsed_objects && r->parsed_objects->grafts_nr) + if (r->parsed_objects && + (r->parsed_objects->grafts_nr || r->parsed_objects->substituted_parent)) return 0; if (is_repository_shallow(r)) return 0; @@ -423,6 +423,8 @@ int parse_commit_buffer(struct repository *r, struct commit *item, const void *b pptr = &item->parents; graft = lookup_commit_graft(r, &item->object.oid); + if (graft) + r->parsed_objects->substituted_parent = 1; while (bufptr + parent_entry_len < tail && !memcmp(bufptr, "parent ", 7)) { struct commit *new_parent; diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index de5d0fbbd1..ee468ea3b0 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -50,7 +50,7 @@ esac # variable. __git_find_repo_path () { - if [ -n "$__git_repo_path" ]; then + if [ -n "${__git_repo_path-}" ]; then # we already know where it is return fi @@ -404,12 +404,12 @@ __gitcomp_builtin () # spaces must be replaced with underscore for multi-word # commands, e.g. "git remote add" becomes remote_add. local cmd="$1" - local incl="$2" - local excl="$3" + local incl="${2-}" + local excl="${3-}" local var=__gitcomp_builtin_"${cmd/-/_}" local options - eval "options=\$$var" + eval "options=\${$var-}" if [ -z "$options" ]; then # leading and trailing spaces are significant to make @@ -801,7 +801,7 @@ __git_refs () # --remote is only compatible with --mode=refs. __git_complete_refs () { - local remote dwim pfx cur_="$cur" sfx=" " mode="refs" + local remote= dwim= pfx= cur_="$cur" sfx=" " mode="refs" while test $# != 0; do case "$1" in @@ -1152,7 +1152,7 @@ __git_find_on_cmdline () while [ $c -lt $cword ]; do for word in $wordlist; do if [ "$word" = "${words[c]}" ]; then - if [ -n "$show_idx" ]; then + if [ -n "${show_idx-}" ]; then echo "$c $word" else echo "$word" @@ -1468,7 +1468,7 @@ __git_checkout_default_dwim_mode () { local last_option dwim_opt="--dwim" - if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ]; then + if [ "${GIT_COMPLETION_CHECKOUT_NO_GUESS-}" = "1" ]; then dwim_opt="" fi @@ -3350,7 +3350,7 @@ __git_main () ((c++)) done - if [ -z "$command" ]; then + if [ -z "${command-}" ]; then case "$prev" in --git-dir|-C|--work-tree) # these need a path argument, let's fall back to @@ -3385,7 +3385,7 @@ __git_main () " ;; *) - if test -n "$GIT_TESTING_PORCELAIN_COMMAND_LIST" + if test -n "${GIT_TESTING_PORCELAIN_COMMAND_LIST-}" then __gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST" else diff --git a/git-send-email.perl b/git-send-email.perl index dc95656f75..36c47bae1d 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1699,10 +1699,14 @@ sub process_file { $xfer_encoding = $1 if not defined $xfer_encoding; } elsif (/^In-Reply-To: (.*)/i) { - $in_reply_to = $1; + if (!$initial_in_reply_to || $thread) { + $in_reply_to = $1; + } } elsif (/^References: (.*)/i) { - $references = $1; + if (!$initial_in_reply_to || $thread) { + $references = $1; + } } elsif (!/^Date:\s/i && /^[-A-Za-z]+:\s+\S/) { push @xh, $_; @@ -25,6 +25,7 @@ struct parsed_object_pool { char *alternate_shallow_file; int commit_graft_prepared; + int substituted_parent; struct buffer_slab *buffer_slab; }; diff --git a/revision.c b/revision.c index 223e99db5d..6aa7f4f567 100644 --- a/revision.c +++ b/revision.c @@ -1410,7 +1410,8 @@ static int limit_list(struct rev_info *revs) continue; break; } - if (revs->min_age != -1 && (commit->date > revs->min_age)) + if (revs->min_age != -1 && (commit->date > revs->min_age) && + !revs->line_level_traverse) continue; date = commit->date; p = &commit_list_insert(commit, p)->next; diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh index 1428eae262..e186c83250 100755 --- a/t/t4211-line-log.sh +++ b/t/t4211-line-log.sh @@ -240,10 +240,12 @@ test_expect_success 'setup for checking line-log and parent oids' ' EOF git add file.c && test_tick && + first_tick=$test_tick && git commit -m "Add func1() and func2() in file.c" && echo 1 >other-file && git add other-file && + test_tick && git commit -m "Add other-file" && sed -e "s/F1/F1 + 1/" file.c >tmp && @@ -283,4 +285,10 @@ test_expect_success 'parent oids with parent rewriting' ' test_cmp expect actual ' +test_expect_success 'line-log with --before' ' + echo $root_oid >expect && + git log --format=%h --no-patch -L:func2:file.c --before=$first_tick >actual && + test_cmp expect actual +' + test_done diff --git a/t/t5537-fetch-shallow.sh b/t/t5537-fetch-shallow.sh index d427a2d7f7..a55202d2d3 100755 --- a/t/t5537-fetch-shallow.sh +++ b/t/t5537-fetch-shallow.sh @@ -81,6 +81,20 @@ test_expect_success 'fetch --unshallow from shallow clone' ' ) ' +test_expect_success 'fetch --unshallow from a full clone' ' + git clone --no-local --depth=2 .git shallow3 && + ( + cd shallow3 && + git log --format=%s >actual && + test_write_lines 4 3 >expect && + test_cmp expect actual && + git -c fetch.writeCommitGraph fetch --unshallow && + git log origin/master --format=%s >actual && + test_write_lines 4 3 2 1 >expect && + test_cmp expect actual + ) +' + test_expect_success 'fetch something upstream has but hidden by clients shallow boundaries' ' # the blob "1" is available in .git but hidden by the # shallow2/.git/shallow and it should be resent diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 90f61c3400..ec261085ec 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -42,7 +42,8 @@ clean_fake_sendmail () { } test_expect_success $PREREQ 'Extract patches' ' - patches=$(git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1) + patches=$(git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1) && + threaded_patches=$(git format-patch -o threaded -s --in-reply-to="format" HEAD^1) ' # Test no confirm early to ensure remaining tests will not hang @@ -1219,6 +1220,17 @@ test_expect_success $PREREQ 'threading but no chain-reply-to' ' grep "In-Reply-To: " stdout ' +test_expect_success $PREREQ 'override in-reply-to if no threading' ' + git send-email \ + --dry-run \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + --no-thread \ + --in-reply-to="override" \ + $threaded_patches >stdout && + grep "In-Reply-To: <override>" stdout +' + test_expect_success $PREREQ 'sendemail.to works' ' git config --replace-all sendemail.to "Somebody <somebody@ex.com>" && git send-email \ |