Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* 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>"
  • Loading branch information
Junio C Hamano committed Nov 17, 2010
2 parents d6b634f + 1c7d402 commit 5a7a0fa
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 24 deletions.
26 changes: 12 additions & 14 deletions Documentation/diff-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 8 additions & 6 deletions Documentation/git-pull.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions Documentation/rev-list-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
41 changes: 41 additions & 0 deletions Documentation/technical/api-sigchain.txt
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 4 additions & 4 deletions builtin/clean.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand All @@ -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) {
Expand All @@ -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++;
}
}
Expand Down
21 changes: 21 additions & 0 deletions t/t3402-rebase-merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5a7a0fa

Please sign in to comment.