mirror of
https://github.com/git/git.git
synced 2024-10-31 14:27:54 +01:00
Merge branch 'maint'
* maint: test: checkout shouldn't say that HEAD has moved if it didn't completion: enhance "current branch" display completion: simplify "current branch" in __git_ps1() completion: fix PS1 display during a merge on detached HEAD builtin-checkout: Don't tell user that HEAD has moved before it has pre-commit.sample: don't print incidental SHA1 tests: Add tests for missing format-patch long options api-parse-options.txt: use 'func' instead of 'funct' Turn on USE_ST_TIMESPEC for OpenBSD ls-tree manpage: output of ls-tree is compatible with update-index ls-tree manpage: use "unless" instead of "when ... is not"
This commit is contained in:
commit
671d1bc6a0
9 changed files with 61 additions and 21 deletions
|
@ -82,8 +82,10 @@ Output Format
|
|||
-------------
|
||||
<mode> SP <type> SP <object> TAB <file>
|
||||
|
||||
When the `-z` option is not used, TAB, LF, and backslash characters
|
||||
Unless the `-z` option is used, TAB, LF, and backslash characters
|
||||
in pathnames are represented as `\t`, `\n`, and `\\`, respectively.
|
||||
This output format is compatible with what '--index-info --stdin' of
|
||||
'git update-index' expects.
|
||||
|
||||
When the `-l` option is used, format changes to
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ The function must be defined in this form:
|
|||
|
||||
The callback mechanism is as follows:
|
||||
|
||||
* Inside `funct`, the only interesting member of the structure
|
||||
* Inside `func`, the only interesting member of the structure
|
||||
given by `opt` is the void pointer `opt->value`.
|
||||
`\*opt->value` will be the value that is saved into `var`, if you
|
||||
use `OPT_CALLBACK()`.
|
||||
|
|
1
Makefile
1
Makefile
|
@ -749,6 +749,7 @@ endif
|
|||
ifeq ($(uname_S),OpenBSD)
|
||||
NO_STRCASESTR = YesPlease
|
||||
NO_MEMMEM = YesPlease
|
||||
USE_ST_TIMESPEC = YesPlease
|
||||
NEEDS_LIBICONV = YesPlease
|
||||
BASIC_CFLAGS += -I/usr/local/include
|
||||
BASIC_LDFLAGS += -L/usr/local/lib
|
||||
|
|
|
@ -541,14 +541,6 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
|
|||
parse_commit(new->commit);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we were on a detached HEAD, but we are now moving to
|
||||
* a new commit, we want to mention the old commit once more
|
||||
* to remind the user that it might be lost.
|
||||
*/
|
||||
if (!opts->quiet && !old.path && old.commit && new->commit != old.commit)
|
||||
describe_detached_head("Previous HEAD position was", old.commit);
|
||||
|
||||
if (!old.commit && !opts->force) {
|
||||
if (!opts->quiet) {
|
||||
warning("You appear to be on a branch yet to be born.");
|
||||
|
@ -561,6 +553,14 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* If we were on a detached HEAD, but have now moved to
|
||||
* a new commit, we want to mention the old commit once more
|
||||
* to remind the user that it might be lost.
|
||||
*/
|
||||
if (!opts->quiet && !old.path && old.commit && new->commit != old.commit)
|
||||
describe_detached_head("Previous HEAD position was", old.commit);
|
||||
|
||||
update_refs_for_switch(opts, &old, new);
|
||||
|
||||
ret = post_checkout_hook(old.commit, new->commit, 1);
|
||||
|
|
|
@ -99,20 +99,32 @@ __git_ps1 ()
|
|||
elif [ -d "$g/rebase-merge" ]; then
|
||||
r="|REBASE-m"
|
||||
b="$(cat "$g/rebase-merge/head-name")"
|
||||
elif [ -f "$g/MERGE_HEAD" ]; then
|
||||
r="|MERGING"
|
||||
b="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||
else
|
||||
if [ -f "$g/MERGE_HEAD" ]; then
|
||||
r="|MERGING"
|
||||
fi
|
||||
if [ -f "$g/BISECT_LOG" ]; then
|
||||
r="|BISECTING"
|
||||
fi
|
||||
if ! b="$(git symbolic-ref HEAD 2>/dev/null)"; then
|
||||
if ! b="$(git describe --exact-match HEAD 2>/dev/null)"; then
|
||||
if [ -r "$g/HEAD" ]; then
|
||||
b="$(cut -c1-7 "$g/HEAD")..."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
b="$(git symbolic-ref HEAD 2>/dev/null)" || {
|
||||
|
||||
b="$(
|
||||
case "${GIT_PS1_DESCRIBE_STYLE-}" in
|
||||
(contains)
|
||||
git describe --contains HEAD ;;
|
||||
(branch)
|
||||
git describe --contains --all HEAD ;;
|
||||
(describe)
|
||||
git describe HEAD ;;
|
||||
(* | default)
|
||||
git describe --exact-match HEAD ;;
|
||||
esac 2>/dev/null)" ||
|
||||
|
||||
b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." ||
|
||||
b="unknown"
|
||||
b="($b)"
|
||||
}
|
||||
fi
|
||||
|
||||
local w
|
||||
|
|
|
@ -505,4 +505,15 @@ test_expect_success 'format-patch from a subdirectory (3)' '
|
|||
test -f "$basename"
|
||||
'
|
||||
|
||||
test_expect_success 'format-patch --in-reply-to' '
|
||||
git format-patch -1 --stdout --in-reply-to "baz@foo.bar" > patch8 &&
|
||||
grep "^In-Reply-To: <baz@foo.bar>" patch8 &&
|
||||
grep "^References: <baz@foo.bar>" patch8
|
||||
'
|
||||
|
||||
test_expect_success 'format-patch --signoff' '
|
||||
git format-patch -1 --signoff --stdout |
|
||||
grep "^Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -108,4 +108,10 @@ test_expect_success 'format.numbered = auto && --no-numbered' '
|
|||
|
||||
'
|
||||
|
||||
test_expect_success '--start-number && --numbered' '
|
||||
|
||||
git format-patch --start-number 3 --numbered --stdout HEAD~1 > patch8 &&
|
||||
grep "^Subject: \[PATCH 3/3\]" patch8
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -534,4 +534,12 @@ test_expect_success 'failing checkout -b should not break working tree' '
|
|||
|
||||
'
|
||||
|
||||
test_expect_success 'switch out of non-branch' '
|
||||
git reset --hard master &&
|
||||
git checkout master^0 &&
|
||||
echo modified >one &&
|
||||
test_must_fail git checkout renamer 2>error.log &&
|
||||
! grep "^Previous HEAD" error.log
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#
|
||||
# To enable this hook, rename this file to "pre-commit".
|
||||
|
||||
if git-rev-parse --verify HEAD 2>/dev/null
|
||||
if git-rev-parse --verify HEAD >/dev/null 2>&1
|
||||
then
|
||||
against=HEAD
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue