mirror of
https://github.com/git/git.git
synced 2026-03-14 02:43:25 +01:00
Merge branch 'jc/cdup' into next
* jc/cdup: git-reset [--mixed] <tree> [--] <paths>... git-reset: make it work from within a subdirectory. git-fetch: make it work from within a subdirectory. INSTALL: no need to have GNU diff installed Bypass expensive content comparsion during rename detection. Update git-diff documentation git-svn: allow both diff.color and color.diff repacked packs should be read-only
This commit is contained in:
@@ -14,30 +14,48 @@ DESCRIPTION
|
||||
-----------
|
||||
Show changes between two trees, a tree and the working tree, a
|
||||
tree and the index file, or the index file and the working tree.
|
||||
The combination of what is compared with what is determined by
|
||||
the number of trees given to the command.
|
||||
|
||||
* When no <tree-ish> is given, the working tree and the index
|
||||
file are compared, using `git-diff-files`.
|
||||
'git-diff' [--options] [--] [<path>...]::
|
||||
|
||||
* When one <tree-ish> is given, the working tree and the named
|
||||
tree are compared, using `git-diff-index`. The option
|
||||
`--cached` can be given to compare the index file and
|
||||
the named tree.
|
||||
This form is to view the changes you made relative to
|
||||
the index (staging area for the next commit). In other
|
||||
words, the differences are what you _could_ tell git to
|
||||
further add to the index but you still haven't. You can
|
||||
stage these changes by using gitlink:git-add[1].
|
||||
|
||||
'git-diff' [--options] --cached [<commit>] [--] [<path>...]::
|
||||
|
||||
This form is to view the changes you staged for the next
|
||||
commit relative to the named <tree-ish>. Typically you
|
||||
would want comparison with the latest commit, so if you
|
||||
do not give <commit>, it defaults to HEAD.
|
||||
|
||||
'git-diff' [--options] <commit> -- [<path>...]::
|
||||
|
||||
This form is to view the changes you have in your
|
||||
working tree relative to the named <commit>. You can
|
||||
use HEAD to compare it with the latest commit, or a
|
||||
branch name to compare with the tip of a different
|
||||
branch.
|
||||
|
||||
'git-diff' [--options] <commit> <commit> -- [<path>...]::
|
||||
|
||||
This form is to view the changes between two <commit>,
|
||||
for example, tips of two branches.
|
||||
|
||||
Just in case if you are doing something exotic, it should be
|
||||
noted that all of the <commit> in the above description can be
|
||||
any <tree-ish>.
|
||||
|
||||
* When two <tree-ish>s are given, these two trees are compared
|
||||
using `git-diff-tree`.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
--diff-options::
|
||||
'--diff-options' are passed to the `git-diff-files`,
|
||||
`git-diff-index`, and `git-diff-tree` commands. See the
|
||||
documentation for these commands for description.
|
||||
include::diff-options.txt[]
|
||||
|
||||
<path>...::
|
||||
The <path> arguments are also passed to `git-diff-\*`
|
||||
commands.
|
||||
The <paths> parameters, when given, are used to limit
|
||||
the diff to the named paths (you can give directory
|
||||
names and get diff for all files under them).
|
||||
|
||||
|
||||
EXAMPLES
|
||||
@@ -51,7 +69,7 @@ $ git diff --cached <2>
|
||||
$ git diff HEAD <3>
|
||||
------------
|
||||
+
|
||||
<1> changes in the working tree since your last git-update-index.
|
||||
<1> changes in the working tree not yet staged for the next commit.
|
||||
<2> changes between the index and your last commit; what you
|
||||
would be committing if you run "git commit" without "-a" option.
|
||||
<3> changes in the working tree since your last commit; what you
|
||||
|
||||
10
INSTALL
10
INSTALL
@@ -72,16 +72,6 @@ Issues of note:
|
||||
- expat library; git-http-push uses it for remote lock
|
||||
management over DAV. Similar to "curl" above, this is optional.
|
||||
|
||||
- "GNU diff" to generate patches. Of course, you don't _have_ to
|
||||
generate patches if you don't want to, but let's face it, you'll
|
||||
be wanting to. Or why did you get git in the first place?
|
||||
|
||||
Non-GNU versions of the diff/patch programs don't generally support
|
||||
the unified patch format (which is the one git uses), so you
|
||||
really do want to get the GNU one. Trust me, you will want to
|
||||
do that even if it wasn't for git. There's no point in living
|
||||
in the dark ages any more.
|
||||
|
||||
- "wish", the Tcl/Tk windowing shell is used in gitk to show the
|
||||
history graphically
|
||||
|
||||
|
||||
@@ -109,6 +109,8 @@ static int is_exact_match(struct diff_filespec *src,
|
||||
return 0;
|
||||
if (src->size != dst->size)
|
||||
return 0;
|
||||
if (src->sha1_valid && dst->sha1_valid)
|
||||
return !hashcmp(src->sha1, dst->sha1);
|
||||
if (diff_populate_filespec(src, 0) || diff_populate_filespec(dst, 0))
|
||||
return 0;
|
||||
if (src->size == dst->size &&
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
#
|
||||
|
||||
USAGE='<fetch-options> <repository> <refspec>...'
|
||||
SUBDIRECTORY_OK=Yes
|
||||
. git-sh-setup
|
||||
TOP=$(git-rev-parse --show-cdup)
|
||||
if test ! -z "$TOP"
|
||||
then
|
||||
cd "$TOP"
|
||||
fi
|
||||
. git-parse-remote
|
||||
_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
|
||||
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
|
||||
|
||||
@@ -67,6 +67,8 @@ name=$(git-pack-objects --non-empty --all $args </dev/null "$PACKTMP") ||
|
||||
if [ -z "$name" ]; then
|
||||
echo Nothing new to pack.
|
||||
else
|
||||
chmod a-w "$PACKTMP-$name.pack"
|
||||
chmod a-w "$PACKTMP-$name.idx"
|
||||
if test "$quiet" != '-q'; then
|
||||
echo "Pack pack-$name created."
|
||||
fi
|
||||
|
||||
70
git-reset.sh
70
git-reset.sh
@@ -1,28 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
USAGE='[--mixed | --soft | --hard] [<commit-ish>]'
|
||||
#
|
||||
# Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano
|
||||
#
|
||||
USAGE='[--mixed | --soft | --hard] [<commit-ish>] [ [--] <paths>...]'
|
||||
SUBDIRECTORY_OK=Yes
|
||||
. git-sh-setup
|
||||
|
||||
update=
|
||||
reset_type=--mixed
|
||||
case "$1" in
|
||||
--mixed | --soft | --hard)
|
||||
reset_type="$1"
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
usage ;;
|
||||
esac
|
||||
update= reset_type=--mixed
|
||||
unset rev
|
||||
|
||||
case $# in
|
||||
0) rev=HEAD ;;
|
||||
1) rev=$(git-rev-parse --verify "$1") || exit ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
while case $# in 0) break ;; esac
|
||||
do
|
||||
case "$1" in
|
||||
--mixed | --soft | --hard)
|
||||
reset_type="$1"
|
||||
;;
|
||||
--)
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
rev=$(git-rev-parse --verify "$1") || exit
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
: ${rev=HEAD}
|
||||
rev=$(git-rev-parse --verify $rev^0) || exit
|
||||
|
||||
# We need to remember the set of paths that _could_ be left
|
||||
# behind before a hard reset, so that we can remove them.
|
||||
# Skip -- in "git reset HEAD -- foo" and "git reset -- foo".
|
||||
case "$1" in --) shift ;; esac
|
||||
|
||||
# git reset --mixed tree [--] paths... can be used to
|
||||
# load chosen paths from the tree into the index without
|
||||
# affecting the working tree nor HEAD.
|
||||
if test $# != 0
|
||||
then
|
||||
test "$reset_type" == "--mixed" ||
|
||||
die "Cannot do partial $reset_type reset."
|
||||
git ls-tree -r --full-name $rev -- "$@" |
|
||||
git update-index --add --index-info || exit
|
||||
git update-index --refresh
|
||||
exit
|
||||
fi
|
||||
|
||||
TOP=$(git-rev-parse --show-cdup)
|
||||
if test ! -z "$TOP"
|
||||
then
|
||||
cd "$TOP"
|
||||
fi
|
||||
|
||||
if test "$reset_type" = "--hard"
|
||||
then
|
||||
update=-u
|
||||
|
||||
31
git-svn.perl
31
git-svn.perl
@@ -925,19 +925,38 @@ sub cmt_showable {
|
||||
|
||||
sub log_use_color {
|
||||
return 1 if $_color;
|
||||
my $dc;
|
||||
chomp($dc = `git-repo-config --get diff.color`);
|
||||
my ($dc, $dcvar);
|
||||
$dcvar = 'color.diff';
|
||||
$dc = `git-repo-config --get $dcvar`;
|
||||
if ($dc eq '') {
|
||||
# nothing at all; fallback to "diff.color"
|
||||
$dcvar = 'diff.color';
|
||||
$dc = `git-repo-config --get $dcvar`;
|
||||
}
|
||||
chomp($dc);
|
||||
if ($dc eq 'auto') {
|
||||
if (-t *STDOUT || (defined $_pager &&
|
||||
`git-repo-config --bool --get pager.color` !~ /^false/)) {
|
||||
my $pc;
|
||||
$pc = `git-repo-config --get color.pager`;
|
||||
if ($pc eq '') {
|
||||
# does not have it -- fallback to pager.color
|
||||
$pc = `git-repo-config --bool --get pager.color`;
|
||||
}
|
||||
else {
|
||||
$pc = `git-repo-config --bool --get color.pager`;
|
||||
if ($?) {
|
||||
$pc = 'false';
|
||||
}
|
||||
}
|
||||
chomp($pc);
|
||||
if (-t *STDOUT || (defined $_pager && $pc eq 'true')) {
|
||||
return ($ENV{TERM} && $ENV{TERM} ne 'dumb');
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0 if $dc eq 'never';
|
||||
return 1 if $dc eq 'always';
|
||||
chomp($dc = `git-repo-config --bool --get diff.color`);
|
||||
$dc eq 'true';
|
||||
chomp($dc = `git-repo-config --bool --get $dcvar`);
|
||||
return ($dc eq 'true');
|
||||
}
|
||||
|
||||
sub git_svn_log_cmd {
|
||||
|
||||
Reference in New Issue
Block a user