Merge branch 'master' into next

* master:
  Fix missing 'does' in man-page for 'git checkout'
  dir.c: squelch false uninitialized memory warning
  git-send-email.perl: ensure $domain is defined before using it
  wt-status.c: don't leak directory entries when processing untracked,ignored
  t6050 (replace): fix bogus "fetch branch with replacement" test
  Documentation: Refer to git-commit-tree in git-filter-branch help
  update comment and documentation for :/foo syntax
  Improvements to `git checkout -h`
  contrib/completion: --no-index option to git diff
  prefer test -h over test -L in shell scripts
  CodingGuidelines: spell Arithmetic Expansion with $(($var))
  t1503: Fix arithmetic expansion syntax error when using dash
  strbuf.h: fix comment typo
This commit is contained in:
Junio C Hamano
2010-09-27 15:19:53 -07:00
16 changed files with 50 additions and 40 deletions

View File

@@ -43,6 +43,10 @@ For shell scripts specifically (not exhaustive):
- We use Arithmetic Expansion $(( ... )).
- Inside Arithmetic Expansion, spell shell variables with $ in front
of them, as some shells do not grok $((x)) while accepting $(($x))
just fine (e.g. dash older than 0.5.4).
- No "Substring Expansion" ${parameter:offset:length}.
- No shell arrays.

View File

@@ -45,14 +45,14 @@ successful.
'git checkout' [--patch] [<tree-ish>] [--] <pathspec>...::
When <paths> or `--patch` are given, 'git checkout' *not* switch
branches. It updates the named paths in the working tree from
the index file or from a named <tree-ish> (most often a commit). In
this case, the `-b` and `--track` options are meaningless and giving
either of them results in an error. The <tree-ish> argument can be
used to specify a specific tree-ish (i.e. commit, tag or tree)
to update the index for the given paths before updating the
working tree.
When <paths> or `--patch` are given, 'git checkout' does *not*
switch branches. It updates the named paths in the working tree
from the index file or from a named <tree-ish> (most often a
commit). In this case, the `-b` and `--track` options are
meaningless and giving either of them results in an error. The
<tree-ish> argument can be used to specify a specific tree-ish
(i.e. commit, tag or tree) to update the index for the given
paths before updating the working tree.
+
The index may contain unmerged entries because of a previous failed merge.
By default, if you try to check out such an entry from the index, the

View File

@@ -81,7 +81,7 @@ OPTIONS
This filter may be used if you only need to modify the environment
in which the commit will be performed. Specifically, you might
want to rewrite the author/committer name/email/time environment
variables (see linkgit:git-commit[1] for details). Do not forget
variables (see linkgit:git-commit-tree[1] for details). Do not forget
to re-export the variables.
--tree-filter <command>::

View File

@@ -107,11 +107,13 @@ the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.
found.
* A colon, followed by a slash, followed by a text (e.g. `:/fix nasty bug`): this names
a commit whose commit message starts with the specified text.
a commit whose commit message matches the specified regular expression.
This name returns the youngest matching commit which is
reachable from any ref. If the commit message starts with a
'!', you have to repeat that; the special sequence ':/!',
followed by something else than '!' is reserved for now.
The regular expression can match any part of the commit message. To
match messages starting with a string, one can use e.g. `:/^foo`.
* A suffix ':' followed by a path (e.g. `HEAD:README`); this names the blob or tree
at the given path in the tree-ish object named by the part

View File

@@ -691,16 +691,16 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
"create and checkout a new branch"),
OPT_STRING('B', NULL, &opts.new_branch_force, "branch",
"create/reset and checkout a branch"),
OPT_BOOLEAN('l', NULL, &opts.new_branch_log, "log for new branch"),
OPT_SET_INT('t', "track", &opts.track, "track",
OPT_BOOLEAN('l', NULL, &opts.new_branch_log, "create reflog for new branch"),
OPT_SET_INT('t', "track", &opts.track, "set upstream info for new branch",
BRANCH_TRACK_EXPLICIT),
OPT_STRING(0, "orphan", &opts.new_orphan_branch, "new branch", "new unparented branch"),
OPT_SET_INT('2', "ours", &opts.writeout_stage, "stage",
OPT_SET_INT('2', "ours", &opts.writeout_stage, "checkout our version for unmerged files",
2),
OPT_SET_INT('3', "theirs", &opts.writeout_stage, "stage",
OPT_SET_INT('3', "theirs", &opts.writeout_stage, "checkout their version for unmerged files",
3),
OPT_BOOLEAN('f', "force", &opts.force, "force"),
OPT_BOOLEAN('m', "merge", &opts.merge, "merge"),
OPT_BOOLEAN('f', "force", &opts.force, "force checkout (throw away local modifications)"),
OPT_BOOLEAN('m', "merge", &opts.merge, "perform a 3-way merge with the new branch"),
OPT_STRING(0, "conflict", &conflict_style, "style",
"conflict style (merge or diff3)"),
OPT_BOOLEAN('p', "patch", &patch_mode, "select hunks interactively"),

View File

@@ -1131,7 +1131,7 @@ _git_diff ()
case "$cur" in
--*)
__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
--base --ours --theirs
--base --ours --theirs --no-index
$__git_diff_common_options
"
return

View File

@@ -42,7 +42,7 @@ then
fi
# don't link to a workdir
if test -L "$git_dir/config"
if test -h "$git_dir/config"
then
die "\"$orig_git\" is a working directory only, please specify" \
"a complete repository."

2
dir.c
View File

@@ -232,7 +232,7 @@ int add_excludes_from_file_to_list(const char *fname,
{
struct stat st;
int fd, i;
size_t size;
size_t size = 0;
char *buf, *entry;
fd = open(fname, O_RDONLY);

View File

@@ -913,7 +913,7 @@ sub sanitize_address {
sub valid_fqdn {
my $domain = shift;
return !($^O eq 'darwin' && $domain =~ /\.local$/) && $domain =~ /\./;
return defined $domain && !($^O eq 'darwin' && $domain =~ /\.local$/) && $domain =~ /\./;
}
sub maildomain_net {

View File

@@ -1062,6 +1062,7 @@ int get_sha1_with_context_1(const char *name, unsigned char *sha1,
/* sha1:path --> object name of path in ent sha1
* :path -> object name of path in index
* :[0-3]:path -> object name of path in index at stage
* :/foo -> recent commit matching foo
*/
if (name[0] == ':') {
int stage = 0;

View File

@@ -16,7 +16,7 @@
*
* 2. the ->buf member is a byte array that has at least ->len + 1 bytes
* allocated. The extra byte is used to store a '\0', allowing the ->buf
* member to be a valid C-string. Every strbuf function ensure this
* member to be a valid C-string. Every strbuf function ensures this
* invariant is preserved.
*
* Note that it is OK to "play" with the buffer directly if you work it

View File

@@ -106,8 +106,8 @@ test_expect_success 'use --default' '
test_expect_success 'master@{n} for various n' '
N=$(git reflog | wc -l) &&
Nm1=$((N-1)) &&
Np1=$((N+1)) &&
Nm1=$(($N-1)) &&
Np1=$(($N+1)) &&
git rev-parse --verify master@{0} &&
git rev-parse --verify master@{1} &&
git rev-parse --verify master@{$Nm1} &&

View File

@@ -205,9 +205,16 @@ test_expect_success 'fetch branch with replacement' '
git branch tofetch $HASH6 &&
(
cd clone_dir &&
git fetch origin refs/heads/tofetch:refs/heads/parallel3
git log --pretty=oneline parallel3 | grep $PARA3
git show $PARA3 | grep "A U Thor"
git fetch origin refs/heads/tofetch:refs/heads/parallel3 &&
git log --pretty=oneline parallel3 > output.txt &&
! grep $PARA3 output.txt &&
git show $PARA3 > para3.txt &&
grep "A U Thor" para3.txt &&
git fetch origin "refs/replace/*:refs/replace/*" &&
git log --pretty=oneline parallel3 > output.txt &&
grep $PARA3 output.txt &&
git show $PARA3 > para3.txt &&
grep "O Thor" para3.txt
)
'

View File

@@ -143,7 +143,7 @@ test_expect_success "$name" '
git svn set-tree --find-copies-harder --rmdir \
${remotes_git_svn}..mybranch5 &&
svn_cmd up "$SVN_TREE" &&
test -L "$SVN_TREE"/exec.sh'
test -h "$SVN_TREE"/exec.sh'
name='new symlink is added to a file that was also just made executable'
@@ -156,7 +156,7 @@ test_expect_success "$name" '
${remotes_git_svn}..mybranch5 &&
svn_cmd up "$SVN_TREE" &&
test -x "$SVN_TREE"/bar/zzz &&
test -L "$SVN_TREE"/exec-2.sh'
test -h "$SVN_TREE"/exec-2.sh'
name='modify a symlink to become a file'
test_expect_success "$name" '
@@ -169,7 +169,7 @@ test_expect_success "$name" '
${remotes_git_svn}..mybranch5 &&
svn_cmd up "$SVN_TREE" &&
test -f "$SVN_TREE"/exec-2.sh &&
test ! -L "$SVN_TREE"/exec-2.sh &&
test ! -h "$SVN_TREE"/exec-2.sh &&
test_cmp help "$SVN_TREE"/exec-2.sh'
name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"

View File

@@ -88,7 +88,7 @@ test_expect_success 'enable broken symlink workaround' \
test_expect_success '"bar" is an empty file' 'test -f x/bar && ! test -s x/bar'
test_expect_success 'get "bar" => symlink fix from svn' \
'(cd x && git svn rebase)'
test_expect_success SYMLINKS '"bar" becomes a symlink' 'test -L x/bar'
test_expect_success SYMLINKS '"bar" becomes a symlink' 'test -h x/bar'
test_expect_success 'clone using git svn' 'git svn clone -r1 "$svnrepo" y'

View File

@@ -390,11 +390,9 @@ static void wt_status_collect_untracked(struct wt_status *s)
fill_directory(&dir, s->pathspec);
for (i = 0; i < dir.nr; i++) {
struct dir_entry *ent = dir.entries[i];
if (!cache_name_is_other(ent->name, ent->len))
continue;
if (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))
continue;
string_list_insert(&s->untracked, ent->name);
if (cache_name_is_other(ent->name, ent->len) &&
match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))
string_list_insert(&s->untracked, ent->name);
free(ent);
}
@@ -404,11 +402,9 @@ static void wt_status_collect_untracked(struct wt_status *s)
fill_directory(&dir, s->pathspec);
for (i = 0; i < dir.nr; i++) {
struct dir_entry *ent = dir.entries[i];
if (!cache_name_is_other(ent->name, ent->len))
continue;
if (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))
continue;
string_list_insert(&s->ignored, ent->name);
if (cache_name_is_other(ent->name, ent->len) &&
match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))
string_list_insert(&s->ignored, ent->name);
free(ent);
}
}