зеркало из https://github.com/microsoft/git.git
Merge branch 'ar/unconfuse-three-dots'
Ancient part of codebase still shows dots after an abbreviated object name just to show that it is not a full object name, but these ellipses are confusing to people who newly discovered Git who are used to seeing abbreviated object names and find them confusing with the range syntax. * ar/unconfuse-three-dots: t2020: test variations that matter t4013: test new output from diff --abbrev --raw diff: diff_aligned_abbrev: remove ellipsis after abbreviated SHA-1 value t4013: prepare for upcoming "diff --raw --abbrev" output format change checkout: describe_detached_head: remove ellipsis after committish print_sha1_ellipsis: introduce helper Documentation: user-manual: limit usage of ellipsis Documentation: revisions: fix typo: "three dot" ---> "three-dot" (in line with "two-dot").
This commit is contained in:
Коммит
8d7fefaac4
|
@ -736,6 +736,15 @@ corresponding standard handle, and if `GIT_REDIRECT_STDERR` is
|
|||
`2>&1`, standard error will be redirected to the same handle as
|
||||
standard output.
|
||||
|
||||
`GIT_PRINT_SHA1_ELLIPSIS` (deprecated)::
|
||||
If set to `yes`, print an ellipsis following an
|
||||
(abbreviated) SHA-1 value. This affects indications of
|
||||
detached HEADs (linkgit:git-checkout[1]) and the raw
|
||||
diff output (linkgit:git-diff[1]). Printing an
|
||||
ellipsis in the cases mentioned is no longer considered
|
||||
adequate and support for it is likely to be removed in the
|
||||
foreseeable future (along with the variable).
|
||||
|
||||
Discussion[[Discussion]]
|
||||
------------------------
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ The '..' (two-dot) Range Notation::
|
|||
for commits that are reachable from r2 excluding those that are reachable
|
||||
from r1 by '{caret}r1 r2' and it can be written as 'r1..r2'.
|
||||
|
||||
The '...' (three dot) Symmetric Difference Notation::
|
||||
The '...' (three-dot) Symmetric Difference Notation::
|
||||
A similar notation 'r1\...r2' is called symmetric difference
|
||||
of 'r1' and 'r2' and is defined as
|
||||
'r1 r2 --not $(git merge-base --all r1 r2)'.
|
||||
|
|
|
@ -319,7 +319,7 @@ do so (now or later) by using -b with the checkout command again. Example:
|
|||
|
||||
git checkout -b new_branch_name
|
||||
|
||||
HEAD is now at 427abfa... Linux v2.6.17
|
||||
HEAD is now at 427abfa Linux v2.6.17
|
||||
------------------------------------------------
|
||||
|
||||
The HEAD then refers to the SHA-1 of the commit instead of to a branch,
|
||||
|
@ -508,7 +508,7 @@ Bisecting: 3537 revisions left to test after this
|
|||
|
||||
If you run `git branch` at this point, you'll see that Git has
|
||||
temporarily moved you in "(no branch)". HEAD is now detached from any
|
||||
branch and points directly to a commit (with commit id 65934...) that
|
||||
branch and points directly to a commit (with commit id 65934) that
|
||||
is reachable from "master" but not from v2.6.18. Compile and test it,
|
||||
and see whether it crashes. Assume it does crash. Then:
|
||||
|
||||
|
@ -549,14 +549,14 @@ says "bisect". Choose a safe-looking commit nearby, note its commit
|
|||
id, and check it out with:
|
||||
|
||||
-------------------------------------------------
|
||||
$ git reset --hard fb47ddb2db...
|
||||
$ git reset --hard fb47ddb2db
|
||||
-------------------------------------------------
|
||||
|
||||
then test, run `bisect good` or `bisect bad` as appropriate, and
|
||||
continue.
|
||||
|
||||
Instead of `git bisect visualize` and then `git reset --hard
|
||||
fb47ddb2db...`, you might just want to tell Git that you want to skip
|
||||
fb47ddb2db`, you might just want to tell Git that you want to skip
|
||||
the current commit:
|
||||
|
||||
-------------------------------------------------
|
||||
|
@ -3416,7 +3416,7 @@ commit abc
|
|||
Author:
|
||||
Date:
|
||||
...
|
||||
:100644 100644 4b9458b... newsha... M somedirectory/myfile
|
||||
:100644 100644 4b9458b newsha M somedirectory/myfile
|
||||
|
||||
|
||||
commit xyz
|
||||
|
@ -3424,7 +3424,7 @@ Author:
|
|||
Date:
|
||||
|
||||
...
|
||||
:100644 100644 oldsha... 4b9458b... M somedirectory/myfile
|
||||
:100644 100644 oldsha 4b9458b M somedirectory/myfile
|
||||
------------------------------------------------
|
||||
|
||||
This tells you that the immediately following version of the file was
|
||||
|
@ -3449,7 +3449,7 @@ and your repository is good again!
|
|||
$ git log --raw --all
|
||||
------------------------------------------------
|
||||
|
||||
and just looked for the sha of the missing object (4b9458b..) in that
|
||||
and just looked for the sha of the missing object (4b9458b) in that
|
||||
whole thing. It's up to you--Git does *have* a lot of information, it is
|
||||
just missing one particular blob version.
|
||||
|
||||
|
@ -4114,9 +4114,9 @@ program, e.g. `diff3`, `merge`, or Git's own merge-file, on
|
|||
the blob objects from these three stages yourself, like this:
|
||||
|
||||
------------------------------------------------
|
||||
$ git cat-file blob 263414f... >hello.c~1
|
||||
$ git cat-file blob 06fa6a2... >hello.c~2
|
||||
$ git cat-file blob cc44c73... >hello.c~3
|
||||
$ git cat-file blob 263414f >hello.c~1
|
||||
$ git cat-file blob 06fa6a2 >hello.c~2
|
||||
$ git cat-file blob cc44c73 >hello.c~3
|
||||
$ git merge-file hello.c~2 hello.c~1 hello.c~3
|
||||
------------------------------------------------
|
||||
|
||||
|
@ -4374,7 +4374,7 @@ $ git log --no-merges t/
|
|||
------------------------
|
||||
|
||||
In the pager (`less`), just search for "bundle", go a few lines back,
|
||||
and see that it is in commit 18449ab0... Now just copy this object name,
|
||||
and see that it is in commit 18449ab0. Now just copy this object name,
|
||||
and paste it into the command line
|
||||
|
||||
-------------------
|
||||
|
|
|
@ -401,10 +401,16 @@ static void show_local_changes(struct object *head,
|
|||
static void describe_detached_head(const char *msg, struct commit *commit)
|
||||
{
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
if (!parse_commit(commit))
|
||||
pp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);
|
||||
fprintf(stderr, "%s %s... %s\n", msg,
|
||||
find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV), sb.buf);
|
||||
if (print_sha1_ellipsis()) {
|
||||
fprintf(stderr, "%s %s... %s\n", msg,
|
||||
find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV), sb.buf);
|
||||
} else {
|
||||
fprintf(stderr, "%s %s %s\n", msg,
|
||||
find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV), sb.buf);
|
||||
}
|
||||
strbuf_release(&sb);
|
||||
}
|
||||
|
||||
|
|
6
cache.h
6
cache.h
|
@ -1972,4 +1972,10 @@ void sleep_millisec(int millisec);
|
|||
*/
|
||||
void safe_create_dir(const char *dir, int share);
|
||||
|
||||
/*
|
||||
* Should we print an ellipsis after an abbreviated SHA-1 value
|
||||
* when doing diff-raw output or indicating a detached HEAD?
|
||||
*/
|
||||
extern int print_sha1_ellipsis(void);
|
||||
|
||||
#endif /* CACHE_H */
|
||||
|
|
8
diff.c
8
diff.c
|
@ -4920,14 +4920,20 @@ const char *diff_aligned_abbrev(const struct object_id *oid, int len)
|
|||
int abblen;
|
||||
const char *abbrev;
|
||||
|
||||
/* Do we want all 40 hex characters? */
|
||||
if (len == GIT_SHA1_HEXSZ)
|
||||
return oid_to_hex(oid);
|
||||
|
||||
/* An abbreviated value is fine, possibly followed by an ellipsis. */
|
||||
abbrev = diff_abbrev_oid(oid, len);
|
||||
|
||||
if (!print_sha1_ellipsis())
|
||||
return abbrev;
|
||||
|
||||
abblen = strlen(abbrev);
|
||||
|
||||
/*
|
||||
* In well-behaved cases, where the abbbreviated result is the
|
||||
* In well-behaved cases, where the abbreviated result is the
|
||||
* same as the requested length, append three dots after the
|
||||
* abbreviation (hence the whole logic is limited to the case
|
||||
* where abblen < 37); when the actual abbreviated result is a
|
||||
|
|
|
@ -344,3 +344,18 @@ int use_optional_locks(void)
|
|||
{
|
||||
return git_env_bool(GIT_OPTIONAL_LOCKS_ENVIRONMENT, 1);
|
||||
}
|
||||
|
||||
int print_sha1_ellipsis(void)
|
||||
{
|
||||
/*
|
||||
* Determine if the calling environment contains the variable
|
||||
* GIT_PRINT_SHA1_ELLIPSIS set to "yes".
|
||||
*/
|
||||
static int cached_result = -1; /* unknown */
|
||||
|
||||
if (cached_result < 0) {
|
||||
const char *v = getenv("GIT_PRINT_SHA1_ELLIPSIS");
|
||||
cached_result = (v && !strcasecmp(v, "yes"));
|
||||
}
|
||||
return cached_result;
|
||||
}
|
||||
|
|
|
@ -186,4 +186,127 @@ test_expect_success 'no advice given for explicit detached head state' '
|
|||
test_cmp expect.no-advice actual
|
||||
'
|
||||
|
||||
# Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS (new format)
|
||||
test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not asked to' "
|
||||
|
||||
# The first detach operation is more chatty than the following ones.
|
||||
cat >1st_detach <<-'EOF' &&
|
||||
Note: checking out 'HEAD^'.
|
||||
|
||||
You are in 'detached HEAD' state. You can look around, make experimental
|
||||
changes and commit them, and you can discard any commits you make in this
|
||||
state without impacting any branches by performing another checkout.
|
||||
|
||||
If you want to create a new branch to retain commits you create, you may
|
||||
do so (now or later) by using -b with the checkout command again. Example:
|
||||
|
||||
git checkout -b <new-branch-name>
|
||||
|
||||
HEAD is now at 7c7cd714e262 three
|
||||
EOF
|
||||
|
||||
# The remaining ones just show info about previous and current HEADs.
|
||||
cat >2nd_detach <<-'EOF' &&
|
||||
Previous HEAD position was 7c7cd714e262 three
|
||||
HEAD is now at 139b20d8e6c5 two
|
||||
EOF
|
||||
|
||||
cat >3rd_detach <<-'EOF' &&
|
||||
Previous HEAD position was 139b20d8e6c5 two
|
||||
HEAD is now at d79ce1670bdc one
|
||||
EOF
|
||||
|
||||
reset &&
|
||||
check_not_detached &&
|
||||
|
||||
# Various ways of *not* asking for ellipses
|
||||
|
||||
sane_unset GIT_PRINT_SHA1_ELLIPSIS &&
|
||||
git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
|
||||
check_detached &&
|
||||
test_i18ncmp 1st_detach actual &&
|
||||
|
||||
GIT_PRINT_SHA1_ELLIPSIS="no" git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
|
||||
check_detached &&
|
||||
test_i18ncmp 2nd_detach actual &&
|
||||
|
||||
GIT_PRINT_SHA1_ELLIPSIS= git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
|
||||
check_detached &&
|
||||
test_i18ncmp 3rd_detach actual &&
|
||||
|
||||
sane_unset GIT_PRINT_SHA1_ELLIPSIS &&
|
||||
|
||||
# We only have four commits, but we can re-use them
|
||||
reset &&
|
||||
check_not_detached &&
|
||||
|
||||
# Make no mention of the env var at all
|
||||
git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
|
||||
check_detached &&
|
||||
test_i18ncmp 1st_detach actual &&
|
||||
|
||||
GIT_PRINT_SHA1_ELLIPSIS='nope' &&
|
||||
git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
|
||||
check_detached &&
|
||||
test_i18ncmp 2nd_detach actual &&
|
||||
|
||||
GIT_PRINT_SHA1_ELLIPSIS=nein &&
|
||||
git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
|
||||
check_detached &&
|
||||
test_i18ncmp 3rd_detach actual &&
|
||||
|
||||
true
|
||||
"
|
||||
|
||||
# Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS (old format)
|
||||
test_expect_success 'describe_detached_head does print SHA-1 ellipsis when asked to' "
|
||||
|
||||
# The first detach operation is more chatty than the following ones.
|
||||
cat >1st_detach <<-'EOF' &&
|
||||
Note: checking out 'HEAD^'.
|
||||
|
||||
You are in 'detached HEAD' state. You can look around, make experimental
|
||||
changes and commit them, and you can discard any commits you make in this
|
||||
state without impacting any branches by performing another checkout.
|
||||
|
||||
If you want to create a new branch to retain commits you create, you may
|
||||
do so (now or later) by using -b with the checkout command again. Example:
|
||||
|
||||
git checkout -b <new-branch-name>
|
||||
|
||||
HEAD is now at 7c7cd714e262... three
|
||||
EOF
|
||||
|
||||
# The remaining ones just show info about previous and current HEADs.
|
||||
cat >2nd_detach <<-'EOF' &&
|
||||
Previous HEAD position was 7c7cd714e262... three
|
||||
HEAD is now at 139b20d8e6c5... two
|
||||
EOF
|
||||
|
||||
cat >3rd_detach <<-'EOF' &&
|
||||
Previous HEAD position was 139b20d8e6c5... two
|
||||
HEAD is now at d79ce1670bdc... one
|
||||
EOF
|
||||
|
||||
reset &&
|
||||
check_not_detached &&
|
||||
|
||||
# Various ways of asking for ellipses...
|
||||
# The user can just use any kind of quoting (including none).
|
||||
|
||||
GIT_PRINT_SHA1_ELLIPSIS=yes git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
|
||||
check_detached &&
|
||||
test_i18ncmp 1st_detach actual &&
|
||||
|
||||
GIT_PRINT_SHA1_ELLIPSIS=Yes git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
|
||||
check_detached &&
|
||||
test_i18ncmp 2nd_detach actual &&
|
||||
|
||||
GIT_PRINT_SHA1_ELLIPSIS=YES git -c 'core.abbrev=12' checkout HEAD^ >actual 2>&1 &&
|
||||
check_detached &&
|
||||
test_i18ncmp 3rd_detach actual &&
|
||||
|
||||
true
|
||||
"
|
||||
|
||||
test_done
|
||||
|
|
|
@ -19,7 +19,7 @@ test_expect_success 'setup: create subprojects' '
|
|||
git update-index --add sub1 &&
|
||||
git add sub2 &&
|
||||
git commit -q -m "subprojects added" &&
|
||||
git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current &&
|
||||
GIT_PRINT_SHA1_ELLIPSIS="yes" git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current &&
|
||||
git branch save HEAD &&
|
||||
cat >expected <<-\EOF &&
|
||||
:000000 160000 00000... A sub1
|
||||
|
|
|
@ -118,20 +118,37 @@ test_expect_success setup '
|
|||
EOF
|
||||
|
||||
V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g')
|
||||
while read cmd
|
||||
while read magic cmd
|
||||
do
|
||||
case "$cmd" in
|
||||
'' | '#'*) continue ;;
|
||||
case "$magic" in
|
||||
'' | '#'*)
|
||||
continue ;;
|
||||
:*)
|
||||
magic=${magic#:}
|
||||
label="$magic-$cmd"
|
||||
case "$magic" in
|
||||
noellipses) ;;
|
||||
*)
|
||||
die "bug in t4103: unknown magic $magic" ;;
|
||||
esac ;;
|
||||
*)
|
||||
cmd="$magic $cmd" magic=
|
||||
label="$cmd" ;;
|
||||
esac
|
||||
test=$(echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g')
|
||||
test=$(echo "$label" | sed -e 's|[/ ][/ ]*|_|g')
|
||||
pfx=$(printf "%04d" $test_count)
|
||||
expect="$TEST_DIRECTORY/t4013/diff.$test"
|
||||
actual="$pfx-diff.$test"
|
||||
|
||||
test_expect_success "git $cmd" '
|
||||
test_expect_success "git $cmd # magic is ${magic:-"(not used)"}" '
|
||||
{
|
||||
echo "\$ git $cmd"
|
||||
git $cmd |
|
||||
echo "$ git $cmd"
|
||||
case "$magic" in
|
||||
"")
|
||||
GIT_PRINT_SHA1_ELLIPSIS=yes git $cmd ;;
|
||||
noellipses)
|
||||
git $cmd ;;
|
||||
esac |
|
||||
sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \
|
||||
-e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
|
||||
echo "\$"
|
||||
|
@ -158,9 +175,12 @@ diff-tree -r --abbrev initial
|
|||
diff-tree -r --abbrev=4 initial
|
||||
diff-tree --root initial
|
||||
diff-tree --root --abbrev initial
|
||||
:noellipses diff-tree --root --abbrev initial
|
||||
diff-tree --root -r initial
|
||||
diff-tree --root -r --abbrev initial
|
||||
:noellipses diff-tree --root -r --abbrev initial
|
||||
diff-tree --root -r --abbrev=4 initial
|
||||
:noellipses diff-tree --root -r --abbrev=4 initial
|
||||
diff-tree -p initial
|
||||
diff-tree --root -p initial
|
||||
diff-tree --patch-with-stat initial
|
||||
|
@ -209,6 +229,7 @@ diff-tree -p master
|
|||
diff-tree -p -m master
|
||||
diff-tree -c master
|
||||
diff-tree -c --abbrev master
|
||||
:noellipses diff-tree -c --abbrev master
|
||||
diff-tree --cc master
|
||||
# stat only should show the diffstat with the first parent
|
||||
diff-tree -c --stat master
|
||||
|
@ -255,8 +276,10 @@ rev-list --parents HEAD
|
|||
rev-list --children HEAD
|
||||
|
||||
whatchanged master
|
||||
:noellipses whatchanged master
|
||||
whatchanged -p master
|
||||
whatchanged --root master
|
||||
:noellipses whatchanged --root master
|
||||
whatchanged --root -p master
|
||||
whatchanged --patch-with-stat master
|
||||
whatchanged --root --patch-with-stat master
|
||||
|
@ -266,6 +289,7 @@ whatchanged --root -c --patch-with-stat --summary master
|
|||
# improved by Timo's patch
|
||||
whatchanged --root --cc --patch-with-stat --summary master
|
||||
whatchanged -SF master
|
||||
:noellipses whatchanged -SF master
|
||||
whatchanged -SF -p master
|
||||
|
||||
log --patch-with-stat master -- dir/
|
||||
|
@ -284,6 +308,7 @@ show --stat side
|
|||
show --stat --summary side
|
||||
show --patch-with-stat side
|
||||
show --patch-with-raw side
|
||||
:noellipses show --patch-with-raw side
|
||||
show --patch-with-stat --summary side
|
||||
|
||||
format-patch --stdout initial..side
|
||||
|
@ -311,8 +336,10 @@ diff -r --stat initial..side
|
|||
diff initial..side
|
||||
diff --patch-with-stat initial..side
|
||||
diff --patch-with-raw initial..side
|
||||
:noellipses diff --patch-with-raw initial..side
|
||||
diff --patch-with-stat -r initial..side
|
||||
diff --patch-with-raw -r initial..side
|
||||
:noellipses diff --patch-with-raw -r initial..side
|
||||
diff --name-status dir2 dir
|
||||
diff --no-index --name-status dir2 dir
|
||||
diff --no-index --name-status -- dir2 dir
|
||||
|
@ -325,10 +352,14 @@ diff --dirstat initial rearrange
|
|||
diff --dirstat-by-file initial rearrange
|
||||
# No-index --abbrev and --no-abbrev
|
||||
diff --raw initial
|
||||
:noellipses diff --raw initial
|
||||
diff --raw --abbrev=4 initial
|
||||
:noellipses diff --raw --abbrev=4 initial
|
||||
diff --raw --no-abbrev initial
|
||||
diff --no-index --raw dir2 dir
|
||||
:noellipses diff --no-index --raw dir2 dir
|
||||
diff --no-index --raw --abbrev=4 dir2 dir
|
||||
:noellipses diff --no-index --raw --abbrev=4 dir2 dir
|
||||
diff --no-index --raw --no-abbrev dir2 dir
|
||||
EOF
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
$ git diff-tree --root --abbrev initial
|
||||
444ac553ac7612cc88969031b02b3767fb8a353a
|
||||
:000000 040000 0000000 da7a33f A dir
|
||||
:000000 100644 0000000 01e79c3 A file0
|
||||
:000000 100644 0000000 01e79c3 A file2
|
||||
$
|
|
@ -0,0 +1,6 @@
|
|||
$ git diff-tree --root -r --abbrev=4 initial
|
||||
444ac553ac7612cc88969031b02b3767fb8a353a
|
||||
:000000 100644 0000 35d2 A dir/sub
|
||||
:000000 100644 0000 01e7 A file0
|
||||
:000000 100644 0000 01e7 A file2
|
||||
$
|
|
@ -0,0 +1,6 @@
|
|||
$ git diff-tree --root -r --abbrev initial
|
||||
444ac553ac7612cc88969031b02b3767fb8a353a
|
||||
:000000 100644 0000000 35d242b A dir/sub
|
||||
:000000 100644 0000000 01e79c3 A file0
|
||||
:000000 100644 0000000 01e79c3 A file2
|
||||
$
|
|
@ -0,0 +1,5 @@
|
|||
$ git diff-tree -c --abbrev master
|
||||
59d314ad6f356dd08601a4cd5e530381da3e3c64
|
||||
::100644 100644 100644 cead32e 7289e35 992913c MM dir/sub
|
||||
::100644 100644 100644 b414108 f4615da 10a8a9f MM file0
|
||||
$
|
|
@ -0,0 +1,3 @@
|
|||
$ git diff --no-index --raw --abbrev=4 dir2 dir
|
||||
:000000 100644 0000 0000 A dir/sub
|
||||
$
|
|
@ -0,0 +1,3 @@
|
|||
$ git diff --no-index --raw dir2 dir
|
||||
:000000 100644 0000000 0000000 A dir/sub
|
||||
$
|
|
@ -0,0 +1,36 @@
|
|||
$ git diff --patch-with-raw -r initial..side
|
||||
:100644 100644 35d242b 7289e35 M dir/sub
|
||||
:100644 100644 01e79c3 f4615da M file0
|
||||
:000000 100644 0000000 7289e35 A file3
|
||||
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
index 35d242b..7289e35 100644
|
||||
--- a/dir/sub
|
||||
+++ b/dir/sub
|
||||
@@ -1,2 +1,4 @@
|
||||
A
|
||||
B
|
||||
+1
|
||||
+2
|
||||
diff --git a/file0 b/file0
|
||||
index 01e79c3..f4615da 100644
|
||||
--- a/file0
|
||||
+++ b/file0
|
||||
@@ -1,3 +1,6 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
+A
|
||||
+B
|
||||
+C
|
||||
diff --git a/file3 b/file3
|
||||
new file mode 100644
|
||||
index 0000000..7289e35
|
||||
--- /dev/null
|
||||
+++ b/file3
|
||||
@@ -0,0 +1,4 @@
|
||||
+A
|
||||
+B
|
||||
+1
|
||||
+2
|
||||
$
|
|
@ -0,0 +1,36 @@
|
|||
$ git diff --patch-with-raw initial..side
|
||||
:100644 100644 35d242b 7289e35 M dir/sub
|
||||
:100644 100644 01e79c3 f4615da M file0
|
||||
:000000 100644 0000000 7289e35 A file3
|
||||
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
index 35d242b..7289e35 100644
|
||||
--- a/dir/sub
|
||||
+++ b/dir/sub
|
||||
@@ -1,2 +1,4 @@
|
||||
A
|
||||
B
|
||||
+1
|
||||
+2
|
||||
diff --git a/file0 b/file0
|
||||
index 01e79c3..f4615da 100644
|
||||
--- a/file0
|
||||
+++ b/file0
|
||||
@@ -1,3 +1,6 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
+A
|
||||
+B
|
||||
+C
|
||||
diff --git a/file3 b/file3
|
||||
new file mode 100644
|
||||
index 0000000..7289e35
|
||||
--- /dev/null
|
||||
+++ b/file3
|
||||
@@ -0,0 +1,4 @@
|
||||
+A
|
||||
+B
|
||||
+1
|
||||
+2
|
||||
$
|
|
@ -0,0 +1,6 @@
|
|||
$ git diff --raw --abbrev=4 initial
|
||||
:100644 100644 35d2 9929 M dir/sub
|
||||
:100644 100644 01e7 10a8 M file0
|
||||
:000000 100644 0000 b1e6 A file1
|
||||
:100644 000000 01e7 0000 D file2
|
||||
$
|
|
@ -0,0 +1,6 @@
|
|||
$ git diff --raw initial
|
||||
:100644 100644 35d242b 992913c M dir/sub
|
||||
:100644 100644 01e79c3 10a8a9f M file0
|
||||
:000000 100644 0000000 b1e6722 A file1
|
||||
:100644 000000 01e79c3 0000000 D file2
|
||||
$
|
|
@ -0,0 +1,42 @@
|
|||
$ git show --patch-with-raw side
|
||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:03:00 2006 +0000
|
||||
|
||||
Side
|
||||
|
||||
:100644 100644 35d242b 7289e35 M dir/sub
|
||||
:100644 100644 01e79c3 f4615da M file0
|
||||
:000000 100644 0000000 7289e35 A file3
|
||||
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
index 35d242b..7289e35 100644
|
||||
--- a/dir/sub
|
||||
+++ b/dir/sub
|
||||
@@ -1,2 +1,4 @@
|
||||
A
|
||||
B
|
||||
+1
|
||||
+2
|
||||
diff --git a/file0 b/file0
|
||||
index 01e79c3..f4615da 100644
|
||||
--- a/file0
|
||||
+++ b/file0
|
||||
@@ -1,3 +1,6 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
+A
|
||||
+B
|
||||
+C
|
||||
diff --git a/file3 b/file3
|
||||
new file mode 100644
|
||||
index 0000000..7289e35
|
||||
--- /dev/null
|
||||
+++ b/file3
|
||||
@@ -0,0 +1,4 @@
|
||||
+A
|
||||
+B
|
||||
+1
|
||||
+2
|
||||
$
|
|
@ -0,0 +1,42 @@
|
|||
$ git whatchanged --root master
|
||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:03:00 2006 +0000
|
||||
|
||||
Side
|
||||
|
||||
:100644 100644 35d242b 7289e35 M dir/sub
|
||||
:100644 100644 01e79c3 f4615da M file0
|
||||
:000000 100644 0000000 7289e35 A file3
|
||||
|
||||
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:02:00 2006 +0000
|
||||
|
||||
Third
|
||||
|
||||
:100644 100644 8422d40 cead32e M dir/sub
|
||||
:000000 100644 0000000 b1e6722 A file1
|
||||
|
||||
commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:01:00 2006 +0000
|
||||
|
||||
Second
|
||||
|
||||
This is the second commit.
|
||||
|
||||
:100644 100644 35d242b 8422d40 M dir/sub
|
||||
:100644 100644 01e79c3 b414108 M file0
|
||||
:100644 000000 01e79c3 0000000 D file2
|
||||
|
||||
commit 444ac553ac7612cc88969031b02b3767fb8a353a
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:00:00 2006 +0000
|
||||
|
||||
Initial
|
||||
|
||||
:000000 100644 0000000 35d242b A dir/sub
|
||||
:000000 100644 0000000 01e79c3 A file0
|
||||
:000000 100644 0000000 01e79c3 A file2
|
||||
$
|
|
@ -0,0 +1,9 @@
|
|||
$ git whatchanged -SF master
|
||||
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:02:00 2006 +0000
|
||||
|
||||
Third
|
||||
|
||||
:100644 100644 8422d40 cead32e M dir/sub
|
||||
$
|
|
@ -0,0 +1,32 @@
|
|||
$ git whatchanged master
|
||||
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:03:00 2006 +0000
|
||||
|
||||
Side
|
||||
|
||||
:100644 100644 35d242b 7289e35 M dir/sub
|
||||
:100644 100644 01e79c3 f4615da M file0
|
||||
:000000 100644 0000000 7289e35 A file3
|
||||
|
||||
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:02:00 2006 +0000
|
||||
|
||||
Third
|
||||
|
||||
:100644 100644 8422d40 cead32e M dir/sub
|
||||
:000000 100644 0000000 b1e6722 A file1
|
||||
|
||||
commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
|
||||
Author: A U Thor <author@example.com>
|
||||
Date: Mon Jun 26 00:01:00 2006 +0000
|
||||
|
||||
Second
|
||||
|
||||
This is the second commit.
|
||||
|
||||
:100644 100644 35d242b 8422d40 M dir/sub
|
||||
:100644 100644 01e79c3 b414108 M file0
|
||||
:100644 000000 01e79c3 0000000 D file2
|
||||
$
|
|
@ -876,7 +876,7 @@ test_expect_success 'L: verify internal tree sorting' '
|
|||
EXPECT_END
|
||||
|
||||
git fast-import <input &&
|
||||
git diff-tree --abbrev --raw L^ L >output &&
|
||||
GIT_PRINT_SHA1_ELLIPSIS="yes" git diff-tree --abbrev --raw L^ L >output &&
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче