Compare commits
26 Commits
v2.12.0-rc
...
v2.12.0-rc
Author | SHA1 | Date | |
---|---|---|---|
5588dbffbd | |||
653078bbdd | |||
c1462b8405 | |||
e53c7f8731 | |||
dd19bca827 | |||
0ffe1c9c5f | |||
163d24dc4d | |||
cf36a4dc35 | |||
65fecf0c08 | |||
f7490fdf85 | |||
5c40e9ce81 | |||
8e7c1f3240 | |||
f5022b5fed | |||
bec5ab8997 | |||
209df269a6 | |||
1ce515f09d | |||
a83c2d2972 | |||
e66adcadfe | |||
56c2da57fe | |||
2488dcab22 | |||
c86000c1a7 | |||
2cbad17642 | |||
d81345ce09 | |||
7326451bed | |||
446624ce35 | |||
9c24c8741e |
@ -436,6 +436,20 @@ notes for details).
|
||||
with AsciiDoc. "make USE_ASCIIDOCTOR=YesPlease" to use it out of
|
||||
the box to document our pages is getting closer to reality.
|
||||
|
||||
* Correct command line completion (in contrib/) on "git svn"
|
||||
(merge 2cbad17642 ew/complete-svn-authorship-options later to maint).
|
||||
|
||||
* Incorrect usage help message for "git worktree prune" has been fixed.
|
||||
(merge 2488dcab22 ps/worktree-prune-help-fix later to maint).
|
||||
|
||||
* Adjust a perf test to new world order where commands that do
|
||||
require a repository are really strict about having a repository.
|
||||
(merge c86000c1a7 rs/p5302-create-repositories-before-tests later to maint).
|
||||
|
||||
* "git log --graph" did not work well with "--name-only", even though
|
||||
other forms of "diff" output were handled correctly.
|
||||
(merge f5022b5fed jk/log-graph-name-only later to maint).
|
||||
|
||||
* Other minor doc, test and build updates and code cleanups.
|
||||
(merge f2627d9b19 sb/submodule-config-cleanup later to maint).
|
||||
(merge 384f1a167b sb/unpack-trees-cleanup later to maint).
|
||||
@ -444,3 +458,4 @@ notes for details).
|
||||
(merge 0aaad415bc rs/absolute-pathdup later to maint).
|
||||
(merge 4432dd6b5b rs/receive-pack-cleanup later to maint).
|
||||
(merge 540a398e9c sg/mailmap-self later to maint).
|
||||
(merge 209df269a6 nd/rev-list-all-includes-HEAD-doc later to maint).
|
||||
|
@ -86,10 +86,11 @@ instead. `--no-symlinks` is the default on Windows.
|
||||
Additionally, `$BASE` is set in the environment.
|
||||
|
||||
-g::
|
||||
--gui::
|
||||
--[no-]gui::
|
||||
When 'git-difftool' is invoked with the `-g` or `--gui` option
|
||||
the default diff tool will be read from the configured
|
||||
`diff.guitool` variable instead of `diff.tool`.
|
||||
`diff.guitool` variable instead of `diff.tool`. The `--no-gui`
|
||||
option can be used to override this setting.
|
||||
|
||||
--[no-]trust-exit-code::
|
||||
'git-difftool' invokes a diff tool individually on each file.
|
||||
|
@ -272,7 +272,7 @@ origin +master` to force a push to the `master` branch). See the
|
||||
standard error stream is not directed to a terminal.
|
||||
|
||||
--no-recurse-submodules::
|
||||
--recurse-submodules=check|on-demand|no::
|
||||
--recurse-submodules=check|on-demand|only|no::
|
||||
May be used to make sure all submodule commits used by the
|
||||
revisions to be pushed are available on a remote-tracking branch.
|
||||
If 'check' is used Git will verify that all submodule commits that
|
||||
@ -280,11 +280,12 @@ origin +master` to force a push to the `master` branch). See the
|
||||
remote of the submodule. If any commits are missing the push will
|
||||
be aborted and exit with non-zero status. If 'on-demand' is used
|
||||
all submodules that changed in the revisions to be pushed will be
|
||||
pushed. If on-demand was not able to push all necessary revisions
|
||||
it will also be aborted and exit with non-zero status. A value of
|
||||
'no' or using `--no-recurse-submodules` can be used to override the
|
||||
push.recurseSubmodules configuration variable when no submodule
|
||||
recursion is required.
|
||||
pushed. If on-demand was not able to push all necessary revisions it will
|
||||
also be aborted and exit with non-zero status. If 'only' is used all
|
||||
submodules will be recursively pushed while the superproject is left
|
||||
unpushed. A value of 'no' or using `--no-recurse-submodules` can be used
|
||||
to override the push.recurseSubmodules configuration variable when no
|
||||
submodule recursion is required.
|
||||
|
||||
--[no-]verify::
|
||||
Toggle the pre-push hook (see linkgit:githooks[5]). The
|
||||
|
@ -292,6 +292,44 @@ $ git reset --keep start <3>
|
||||
<3> But you can use "reset --keep" to remove the unwanted commit after
|
||||
you switched to "branch2".
|
||||
|
||||
Split a commit into two::
|
||||
+
|
||||
Suppose that you have created a commit, but later decide that you want to break
|
||||
apart the changes into two logical chunks and commit each separately. You want
|
||||
to include part of the original commit into the first commit, while including
|
||||
the remainder in a second commit. You can use git reset to rewind the history
|
||||
without changing the index, and then use git add -p to interactively select
|
||||
which hunks to put into the first commit.
|
||||
+
|
||||
------------
|
||||
$ git reset HEAD^ <1>
|
||||
$ git add -p <2>
|
||||
$ git diff --cached <3>
|
||||
$ git commit -c HEAD@{1} <4>
|
||||
...
|
||||
$ git add ... <5>
|
||||
$ git diff --cached <6>
|
||||
$ git commit ... <7>
|
||||
------------
|
||||
+
|
||||
<1> First, reset the history back one commit so that we remove the original
|
||||
commit, but leave the working tree with all the changes.
|
||||
<2> Now, interactively select hunks to add to a new commit using git add -p.
|
||||
This will ask for each hunk separately and you can use simple commands like
|
||||
"yes, include", "no don't include" or even "edit".
|
||||
<3> Once satisfied with the hunks, you should verify that it is what you
|
||||
expected by using git diff --cached to show all changes in the index.
|
||||
<4> Next, commit the changes stored in the index. "-c" specifies to load the
|
||||
editor with a commit message from a previous commit so that you can re-use the
|
||||
original commit message. HEAD@{1} is special notation to reference what
|
||||
HEAD used to be prior to the reset command. See linkgit:git-reflog[1] for
|
||||
more details.
|
||||
<5> Now you've created the first commit, and can repeat steps 2-4 as often as
|
||||
you like to break the work into any number of commits. Here we show a second
|
||||
step which simply adds the remaining changes.
|
||||
<6> Then check again that the changes are what you expected to add.
|
||||
<7> And finally commit the remaining changes.
|
||||
|
||||
|
||||
DISCUSSION
|
||||
----------
|
||||
|
@ -133,8 +133,8 @@ parents) and `--max-parents=-1` (negative numbers denote no upper limit).
|
||||
for all following revision specifiers, up to the next `--not`.
|
||||
|
||||
--all::
|
||||
Pretend as if all the refs in `refs/` are listed on the
|
||||
command line as '<commit>'.
|
||||
Pretend as if all the refs in `refs/`, along with `HEAD`, are
|
||||
listed on the command line as '<commit>'.
|
||||
|
||||
--branches[=<pattern>]::
|
||||
Pretend as if all the refs in `refs/heads` are listed
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
GVF=GIT-VERSION-FILE
|
||||
DEF_VER=v2.12.0-rc0
|
||||
DEF_VER=v2.12.0-rc1
|
||||
|
||||
LF='
|
||||
'
|
||||
|
@ -647,10 +647,6 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
/* NEEDSWORK: once we no longer spawn anything, remove this */
|
||||
setenv(GIT_DIR_ENVIRONMENT, absolute_path(get_git_dir()), 1);
|
||||
setenv(GIT_WORK_TREE_ENVIRONMENT, absolute_path(get_git_work_tree()), 1);
|
||||
|
||||
git_config(difftool_config, NULL);
|
||||
symlinks = has_symlinks;
|
||||
|
||||
@ -661,6 +657,10 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
|
||||
if (tool_help)
|
||||
return print_tool_help();
|
||||
|
||||
/* NEEDSWORK: once we no longer spawn anything, remove this */
|
||||
setenv(GIT_DIR_ENVIRONMENT, absolute_path(get_git_dir()), 1);
|
||||
setenv(GIT_WORK_TREE_ENVIRONMENT, absolute_path(get_git_work_tree()), 1);
|
||||
|
||||
if (use_gui_tool && diff_gui_tool && *diff_gui_tool)
|
||||
setenv("GIT_DIFF_TOOL", diff_gui_tool, 1);
|
||||
else if (difftool_cmd) {
|
||||
|
@ -125,9 +125,9 @@ static int prune(int ac, const char **av, const char *prefix)
|
||||
{
|
||||
struct option options[] = {
|
||||
OPT__DRY_RUN(&show_only, N_("do not remove, show only")),
|
||||
OPT__VERBOSE(&verbose, N_("report pruned objects")),
|
||||
OPT__VERBOSE(&verbose, N_("report pruned working trees")),
|
||||
OPT_EXPIRY_DATE(0, "expire", &expire,
|
||||
N_("expire objects older than <time>")),
|
||||
N_("expire working trees older than <time>")),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
|
@ -1674,7 +1674,7 @@ _git_pull ()
|
||||
__git_complete_remote_or_refspec
|
||||
}
|
||||
|
||||
__git_push_recurse_submodules="check on-demand"
|
||||
__git_push_recurse_submodules="check on-demand only"
|
||||
|
||||
__git_complete_force_with_lease ()
|
||||
{
|
||||
@ -2587,14 +2587,14 @@ _git_svn ()
|
||||
--no-metadata --use-svm-props --use-svnsync-props
|
||||
--log-window-size= --no-checkout --quiet
|
||||
--repack-flags --use-log-author --localtime
|
||||
--add-author-from
|
||||
--ignore-paths= --include-paths= $remote_opts
|
||||
"
|
||||
local init_opts="
|
||||
--template= --shared= --trunk= --tags=
|
||||
--branches= --stdlayout --minimize-url
|
||||
--no-metadata --use-svm-props --use-svnsync-props
|
||||
--rewrite-root= --prefix= --use-log-author
|
||||
--add-author-from $remote_opts
|
||||
--rewrite-root= --prefix= $remote_opts
|
||||
"
|
||||
local cmt_opts="
|
||||
--edit --rmdir --find-copies-harder --copy-similarity=
|
||||
|
1
diff.c
1
diff.c
@ -4450,6 +4450,7 @@ static void flush_one_pair(struct diff_filepair *p, struct diff_options *opt)
|
||||
name_a = p->two->path;
|
||||
name_b = NULL;
|
||||
strip_prefix(opt->prefix_length, &name_a, &name_b);
|
||||
fprintf(opt->file, "%s", diff_line_prefix(opt));
|
||||
write_name_quoted(name_a, opt->file, opt->line_termination);
|
||||
}
|
||||
}
|
||||
|
7
dir.c
7
dir.c
@ -174,20 +174,19 @@ char *common_prefix(const struct pathspec *pathspec)
|
||||
|
||||
int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec)
|
||||
{
|
||||
char *prefix;
|
||||
const char *prefix;
|
||||
size_t prefix_len;
|
||||
|
||||
/*
|
||||
* Calculate common prefix for the pathspec, and
|
||||
* use that to optimize the directory walk
|
||||
*/
|
||||
prefix = common_prefix(pathspec);
|
||||
prefix_len = prefix ? strlen(prefix) : 0;
|
||||
prefix_len = common_prefix_len(pathspec);
|
||||
prefix = prefix_len ? pathspec->items[0].match : "";
|
||||
|
||||
/* Read the directory and prune it */
|
||||
read_directory(dir, prefix, prefix_len, pathspec);
|
||||
|
||||
free(prefix);
|
||||
return prefix_len;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,13 @@ test_expect_success 'repack' '
|
||||
export PACK
|
||||
'
|
||||
|
||||
test_expect_success 'create target repositories' '
|
||||
for repo in t1 t2 t3 t4 t5 t6
|
||||
do
|
||||
git init --bare $repo
|
||||
done
|
||||
'
|
||||
|
||||
test_perf 'index-pack 0 threads' '
|
||||
GIT_DIR=t1 git index-pack --threads=1 --stdin < $PACK
|
||||
'
|
||||
|
@ -1212,6 +1212,54 @@ test_expect_success 'log --line-prefix="*** " --graph with diff and stats' '
|
||||
test_i18ncmp expect actual.sanitized
|
||||
'
|
||||
|
||||
cat >expect <<-\EOF
|
||||
* reach
|
||||
|
|
||||
| A reach.t
|
||||
* Merge branch 'tangle'
|
||||
* Merge branch 'side'
|
||||
|\
|
||||
| * side-2
|
||||
|
|
||||
| A 2
|
||||
* Second
|
||||
|
|
||||
| A one
|
||||
* sixth
|
||||
|
||||
D a/two
|
||||
EOF
|
||||
|
||||
test_expect_success 'log --graph with --name-status' '
|
||||
git log --graph --format=%s --name-status tangle..reach >actual &&
|
||||
sanitize_output <actual >actual.sanitized &&
|
||||
test_cmp expect actual.sanitized
|
||||
'
|
||||
|
||||
cat >expect <<-\EOF
|
||||
* reach
|
||||
|
|
||||
| reach.t
|
||||
* Merge branch 'tangle'
|
||||
* Merge branch 'side'
|
||||
|\
|
||||
| * side-2
|
||||
|
|
||||
| 2
|
||||
* Second
|
||||
|
|
||||
| one
|
||||
* sixth
|
||||
|
||||
a/two
|
||||
EOF
|
||||
|
||||
test_expect_success 'log --graph with --name-only' '
|
||||
git log --graph --format=%s --name-only tangle..reach >actual &&
|
||||
sanitize_output <actual >actual.sanitized &&
|
||||
test_cmp expect actual.sanitized
|
||||
'
|
||||
|
||||
test_expect_success 'dotdot is a parent directory' '
|
||||
mkdir -p a/b &&
|
||||
( echo sixth && echo fifth ) >expect &&
|
||||
|
@ -23,6 +23,18 @@ prompt_given ()
|
||||
test "$prompt" = "Launch 'test-tool' [Y/n]? branch"
|
||||
}
|
||||
|
||||
test_expect_success 'basic usage requires no repo' '
|
||||
test_expect_code 129 git difftool -h >output &&
|
||||
grep ^usage: output &&
|
||||
# create a ceiling directory to prevent Git from finding a repo
|
||||
mkdir -p not/repo &&
|
||||
test_when_finished rm -r not &&
|
||||
test_expect_code 129 \
|
||||
env GIT_CEILING_DIRECTORIES="$(pwd)/not" \
|
||||
git -C not/repo difftool -h >output &&
|
||||
grep ^usage: output
|
||||
'
|
||||
|
||||
# Create a file on master and change it on branch
|
||||
test_expect_success 'setup' '
|
||||
echo master >file &&
|
||||
@ -278,8 +290,8 @@ test_expect_success 'difftool + mergetool config variables' '
|
||||
test_expect_success 'difftool.<tool>.path' '
|
||||
test_config difftool.tkdiff.path echo &&
|
||||
git difftool --tool=tkdiff --no-prompt branch >output &&
|
||||
lines=$(grep file output | wc -l) &&
|
||||
test "$lines" -eq 1
|
||||
grep file output >grep-output &&
|
||||
test_line_count = 1 grep-output
|
||||
'
|
||||
|
||||
test_expect_success 'difftool --extcmd=cat' '
|
||||
@ -416,9 +428,12 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory' '
|
||||
git difftool --dir-diff $symlinks --extcmd ls branch >output &&
|
||||
# "sub" must only exist in "right"
|
||||
# "file" and "file2" must be listed in both "left" and "right"
|
||||
test "1" = $(grep sub output | wc -l) &&
|
||||
test "2" = $(grep file"$" output | wc -l) &&
|
||||
test "2" = $(grep file2 output | wc -l)
|
||||
grep sub output > sub-output &&
|
||||
test_line_count = 1 sub-output &&
|
||||
grep file"$" output >file-output &&
|
||||
test_line_count = 2 file-output &&
|
||||
grep file2 output >file2-output &&
|
||||
test_line_count = 2 file2-output
|
||||
)
|
||||
'
|
||||
|
||||
@ -428,9 +443,11 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory' '
|
||||
git difftool --dir-diff $symlinks --extcmd ls v1 >output &&
|
||||
# "sub" and "file" exist in both v1 and HEAD.
|
||||
# "file2" is unchanged.
|
||||
test "2" = $(grep sub output | wc -l) &&
|
||||
test "2" = $(grep file output | wc -l) &&
|
||||
test "0" = $(grep file2 output | wc -l)
|
||||
grep sub output >sub-output &&
|
||||
test_line_count = 2 sub-output &&
|
||||
grep file output >file-output &&
|
||||
test_line_count = 2 file-output &&
|
||||
! grep file2 output
|
||||
)
|
||||
'
|
||||
|
||||
@ -440,8 +457,9 @@ run_dir_diff_test 'difftool --dir-diff branch from subdirectory w/ pathspec' '
|
||||
git difftool --dir-diff $symlinks --extcmd ls branch -- .>output &&
|
||||
# "sub" only exists in "right"
|
||||
# "file" and "file2" must not be listed
|
||||
test "1" = $(grep sub output | wc -l) &&
|
||||
test "0" = $(grep file output | wc -l)
|
||||
grep sub output >sub-output &&
|
||||
test_line_count = 1 sub-output &&
|
||||
! grep file output
|
||||
)
|
||||
'
|
||||
|
||||
@ -451,8 +469,9 @@ run_dir_diff_test 'difftool --dir-diff v1 from subdirectory w/ pathspec' '
|
||||
git difftool --dir-diff $symlinks --extcmd ls v1 -- .>output &&
|
||||
# "sub" exists in v1 and HEAD
|
||||
# "file" is filtered out by the pathspec
|
||||
test "2" = $(grep sub output | wc -l) &&
|
||||
test "0" = $(grep file output | wc -l)
|
||||
grep sub output >sub-output &&
|
||||
test_line_count = 2 sub-output &&
|
||||
! grep file output
|
||||
)
|
||||
'
|
||||
|
||||
|
Reference in New Issue
Block a user