Merge branch 'maint'

* maint:
  clean: remove redundant variable baselen
  Documentation/git-pull: clarify configuration
  Document that rev-list --graph triggers parent rewriting.
  clean: avoid quoting twice
  document sigchain api
  Keep together options controlling the behaviour of diffcore-rename.
  t3402: test "rebase -s<strategy> -X<opt>"
This commit is contained in:
Junio C Hamano 2010-11-17 13:57:58 -08:00
commit 5a7a0fae8f
6 changed files with 88 additions and 24 deletions

View file

@ -250,20 +250,6 @@ endif::git-log[]
Detect copies as well as renames. See also `--find-copies-harder`.
If `n` is specified, it has the same meaning as for `-M<n>`.
ifndef::git-format-patch[]
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]::
Select only files that are Added (`A`), Copied (`C`),
Deleted (`D`), Modified (`M`), Renamed (`R`), have their
type (i.e. regular file, symlink, submodule, ...) changed (`T`),
are Unmerged (`U`), are
Unknown (`X`), or have had their pairing Broken (`B`).
Any combination of the filter characters (including none) can be used.
When `*` (All-or-none) is added to the combination, all
paths are selected if there is any file that matches
other criteria in the comparison; if there is no file
that matches other criteria, nothing is selected.
endif::git-format-patch[]
--find-copies-harder::
For performance reasons, by default, `-C` option finds copies only
if the original file of the copy was modified in the same
@ -281,6 +267,18 @@ endif::git-format-patch[]
number.
ifndef::git-format-patch[]
--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]::
Select only files that are Added (`A`), Copied (`C`),
Deleted (`D`), Modified (`M`), Renamed (`R`), have their
type (i.e. regular file, symlink, submodule, ...) changed (`T`),
are Unmerged (`U`), are
Unknown (`X`), or have had their pairing Broken (`B`).
Any combination of the filter characters (including none) can be used.
When `*` (All-or-none) is added to the combination, all
paths are selected if there is any file that matches
other criteria in the comparison; if there is no file
that matches other criteria, nothing is selected.
-S<string>::
Look for differences that introduce or remove an instance of
<string>. Note that this is different than the string simply

View file

@ -92,12 +92,14 @@ include::merge-options.txt[]
:git-pull: 1
--rebase::
Instead of a merge, perform a rebase after fetching. If
there is a remote ref for the upstream branch, and this branch
was rebased since last fetched, the rebase uses that information
to avoid rebasing non-local changes. To make this the default
for branch `<name>`, set configuration `branch.<name>.rebase`
to `true`.
Rebase the current branch on top of the upstream branch after
fetching. If there is a remote-tracking branch corresponding to
the upstream branch and the upstream branch was rebased since last
fetched, the rebase uses that information to avoid rebasing
non-local changes.
+
See `branch.<name>.rebase` in linkgit:git-config[1] if you want to make
`git pull` always use `{litdd}rebase` instead of merging.
+
[NOTE]
This is a potentially _dangerous_ mode of operation.

View file

@ -95,6 +95,8 @@ you would get an output like this:
to be printed in between commits, in order for the graph history
to be drawn properly.
+
This enables parent rewriting, see 'History Simplification' below.
+
This implies the '--topo-order' option by default, but the
'--date-order' option may also be specified.

View file

@ -0,0 +1,41 @@
sigchain API
============
Code often wants to set a signal handler to clean up temporary files or
other work-in-progress when we die unexpectedly. For multiple pieces of
code to do this without conflicting, each piece of code must remember
the old value of the handler and restore it either when:
1. The work-in-progress is finished, and the handler is no longer
necessary. The handler should revert to the original behavior
(either another handler, SIG_DFL, or SIG_IGN).
2. The signal is received. We should then do our cleanup, then chain
to the next handler (or die if it is SIG_DFL).
Sigchain is a tiny library for keeping a stack of handlers. Your handler
and installation code should look something like:
------------------------------------------
void clean_foo_on_signal(int sig)
{
clean_foo();
sigchain_pop(sig);
raise(sig);
}
void other_func()
{
sigchain_push_common(clean_foo_on_signal);
mess_up_foo();
clean_foo();
}
------------------------------------------
Handlers are given the typdef of sigchain_fun. This is the same type
that is given to signal() or sigaction(). It is perfectly reasonable to
push SIG_DFL or SIG_IGN onto the stack.
You can sigchain_push and sigchain_pop individual signals. For
convenience, sigchain_push_common will push the handler onto the stack
for many common signals.

View file

@ -38,7 +38,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
{
int i;
int show_only = 0, remove_directories = 0, quiet = 0, ignored = 0;
int ignored_only = 0, baselen = 0, config_set = 0, errors = 0;
int ignored_only = 0, config_set = 0, errors = 0;
int rm_flags = REMOVE_DIR_KEEP_NESTED_GIT;
struct strbuf directory = STRBUF_INIT;
struct dir_struct dir;
@ -138,7 +138,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
if (pathspec) {
memset(seen, 0, argc > 0 ? argc : 1);
matches = match_pathspec(pathspec, ent->name, len,
baselen, seen);
0, seen);
}
if (S_ISDIR(st.st_mode)) {
@ -153,7 +153,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
printf("Removing %s\n", qname);
if (remove_dir_recursively(&directory,
rm_flags) != 0) {
warning("failed to remove '%s'", qname);
warning("failed to remove %s", qname);
errors++;
}
} else if (show_only) {
@ -173,7 +173,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
printf("Removing %s\n", qname);
}
if (unlink(ent->name) != 0) {
warning("failed to remove '%s'", qname);
warning("failed to remove %s", qname);
errors++;
}
}

View file

@ -117,4 +117,25 @@ test_expect_success 'picking rebase' '
esac
'
test_expect_success 'rebase -s funny -Xopt' '
test_when_finished "rm -fr test-bin funny.was.run" &&
mkdir test-bin &&
cat >test-bin/git-merge-funny <<-EOF &&
#!$SHELL_PATH
case "\$1" in --opt) ;; *) exit 2 ;; esac
shift &&
>funny.was.run &&
exec git merge-recursive "\$@"
EOF
chmod +x test-bin/git-merge-funny &&
git reset --hard &&
git checkout -b test-funny master^ &&
test_commit funny &&
(
PATH=./test-bin:$PATH
git rebase -s funny -Xopt master
) &&
test -f funny.was.run
'
test_done