Skip to content

Commit 03f8bc2

Browse files
Revert touching other tests
1 parent 757eb86 commit 03f8bc2

File tree

265 files changed

+657
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+657
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
545ffc79786f268524c35e1e05b1770c7c74faf1 not-for-merge branch 'master' of ../working

tests/files/working/re/dot_git/HEAD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ref: refs/heads/git_grep

tests/files/working/re/dot_git/config

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[user]
2+
name = Scott Chacon
3+
email = schacon@gmail.com
4+
[commit]
5+
gpgsign = false
6+
[core]
7+
repositoryformatversion = 0
8+
filemode = true
9+
bare = false
10+
logallrefupdates = true
11+
[gui]
12+
geometry = 986x682+365+124 211 500
13+
[remote "working"]
14+
url = ../working.git
15+
fetch = +refs/heads/*:refs/remotes/working/*
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Unnamed repository; edit this file to name it for gitweb.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script to check the commit log message taken by
4+
# applypatch from an e-mail message.
5+
#
6+
# The hook should exit with non-zero status after issuing an
7+
# appropriate message if it wants to stop the commit. The hook is
8+
# allowed to edit the commit message file.
9+
#
10+
# To enable this hook, make this file executable.
11+
12+
. git-sh-setup
13+
test -x "$GIT_DIR/hooks/commit-msg" &&
14+
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
15+
:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script to check the commit log message.
4+
# Called by git-commit with one argument, the name of the file
5+
# that has the commit message. The hook should exit with non-zero
6+
# status after issuing an appropriate message if it wants to stop the
7+
# commit. The hook is allowed to edit the commit message file.
8+
#
9+
# To enable this hook, make this file executable.
10+
11+
# Uncomment the below to add a Signed-off-by line to the message.
12+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
13+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
14+
15+
# This example catches duplicate Signed-off-by lines.
16+
17+
test "" = "$(grep '^Signed-off-by: ' "$1" |
18+
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
19+
echo >&2 Duplicate Signed-off-by lines.
20+
exit 1
21+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script that is called after a successful
4+
# commit is made.
5+
#
6+
# To enable this hook, make this file executable.
7+
8+
: Nothing
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script for the post-receive event
4+
#
5+
# This script is run after receive-pack has accepted a pack and the
6+
# repository has been updated. It is passed arguments in through stdin
7+
# in the form
8+
# <oldrev> <newrev> <refname>
9+
# For example:
10+
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
11+
#
12+
# see contrib/hooks/ for an sample, or uncomment the next line (on debian)
13+
#
14+
15+
16+
#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script to prepare a packed repository for use over
4+
# dumb transports.
5+
#
6+
# To enable this hook, make this file executable by "chmod +x post-update".
7+
8+
exec git-update-server-info
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script to verify what is about to be committed
4+
# by applypatch from an e-mail message.
5+
#
6+
# The hook should exit with non-zero status after issuing an
7+
# appropriate message if it wants to stop the commit.
8+
#
9+
# To enable this hook, make this file executable.
10+
11+
. git-sh-setup
12+
test -x "$GIT_DIR/hooks/pre-commit" &&
13+
exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
14+
:
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script to verify what is about to be committed.
4+
# Called by git-commit with no arguments. The hook should
5+
# exit with non-zero status after issuing an appropriate message if
6+
# it wants to stop the commit.
7+
#
8+
# To enable this hook, make this file executable.
9+
10+
# This is slightly modified from Andrew Morton's Perfect Patch.
11+
# Lines you introduce should not have trailing whitespace.
12+
# Also check for an indentation that has SP before a TAB.
13+
14+
if git-rev-parse --verify HEAD 2>/dev/null
15+
then
16+
git-diff-index -p -M --cached HEAD
17+
else
18+
# NEEDSWORK: we should produce a diff with an empty tree here
19+
# if we want to do the same verification for the initial import.
20+
:
21+
fi |
22+
perl -e '
23+
my $found_bad = 0;
24+
my $filename;
25+
my $reported_filename = "";
26+
my $lineno;
27+
sub bad_line {
28+
my ($why, $line) = @_;
29+
if (!$found_bad) {
30+
print STDERR "*\n";
31+
print STDERR "* You have some suspicious patch lines:\n";
32+
print STDERR "*\n";
33+
$found_bad = 1;
34+
}
35+
if ($reported_filename ne $filename) {
36+
print STDERR "* In $filename\n";
37+
$reported_filename = $filename;
38+
}
39+
print STDERR "* $why (line $lineno)\n";
40+
print STDERR "$filename:$lineno:$line\n";
41+
}
42+
while (<>) {
43+
if (m|^diff --git a/(.*) b/\1$|) {
44+
$filename = $1;
45+
next;
46+
}
47+
if (/^@@ -\S+ \+(\d+)/) {
48+
$lineno = $1 - 1;
49+
next;
50+
}
51+
if (/^ /) {
52+
$lineno++;
53+
next;
54+
}
55+
if (s/^\+//) {
56+
$lineno++;
57+
chomp;
58+
if (/\s$/) {
59+
bad_line("trailing whitespace", $_);
60+
}
61+
if (/^\s* /) {
62+
bad_line("indent SP followed by a TAB", $_);
63+
}
64+
if (/^(?:[<>=]){7}/) {
65+
bad_line("unresolved merge conflict", $_);
66+
}
67+
}
68+
}
69+
exit($found_bad);
70+
'
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2006 Junio C Hamano
4+
#
5+
6+
publish=next
7+
basebranch="$1"
8+
if test "$#" = 2
9+
then
10+
topic="refs/heads/$2"
11+
else
12+
topic=`git symbolic-ref HEAD`
13+
fi
14+
15+
case "$basebranch,$topic" in
16+
master,refs/heads/??/*)
17+
;;
18+
*)
19+
exit 0 ;# we do not interrupt others.
20+
;;
21+
esac
22+
23+
# Now we are dealing with a topic branch being rebased
24+
# on top of master. Is it OK to rebase it?
25+
26+
# Is topic fully merged to master?
27+
not_in_master=`git-rev-list --pretty=oneline ^master "$topic"`
28+
if test -z "$not_in_master"
29+
then
30+
echo >&2 "$topic is fully merged to master; better remove it."
31+
exit 1 ;# we could allow it, but there is no point.
32+
fi
33+
34+
# Is topic ever merged to next? If so you should not be rebasing it.
35+
only_next_1=`git-rev-list ^master "^$topic" ${publish} | sort`
36+
only_next_2=`git-rev-list ^master ${publish} | sort`
37+
if test "$only_next_1" = "$only_next_2"
38+
then
39+
not_in_topic=`git-rev-list "^$topic" master`
40+
if test -z "$not_in_topic"
41+
then
42+
echo >&2 "$topic is already up-to-date with master"
43+
exit 1 ;# we could allow it, but there is no point.
44+
else
45+
exit 0
46+
fi
47+
else
48+
not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
49+
perl -e '
50+
my $topic = $ARGV[0];
51+
my $msg = "* $topic has commits already merged to public branch:\n";
52+
my (%not_in_next) = map {
53+
/^([0-9a-f]+) /;
54+
($1 => 1);
55+
} split(/\n/, $ARGV[1]);
56+
for my $elem (map {
57+
/^([0-9a-f]+) (.*)$/;
58+
[$1 => $2];
59+
} split(/\n/, $ARGV[2])) {
60+
if (!exists $not_in_next{$elem->[0]}) {
61+
if ($msg) {
62+
print STDERR $msg;
63+
undef $msg;
64+
}
65+
print STDERR " $elem->[1]\n";
66+
}
67+
}
68+
' "$topic" "$not_in_next" "$not_in_master"
69+
exit 1
70+
fi
71+
72+
exit 0
73+
74+
################################################################
75+
76+
This sample hook safeguards topic branches that have been
77+
published from being rewound.
78+
79+
The workflow assumed here is:
80+
81+
* Once a topic branch forks from "master", "master" is never
82+
merged into it again (either directly or indirectly).
83+
84+
* Once a topic branch is fully cooked and merged into "master",
85+
it is deleted. If you need to build on top of it to correct
86+
earlier mistakes, a new topic branch is created by forking at
87+
the tip of the "master". This is not strictly necessary, but
88+
it makes it easier to keep your history simple.
89+
90+
* Whenever you need to test or publish your changes to topic
91+
branches, merge them into "next" branch.
92+
93+
The script, being an example, hardcodes the publish branch name
94+
to be "next", but it is trivial to make it configurable via
95+
$GIT_DIR/config mechanism.
96+
97+
With this workflow, you would want to know:
98+
99+
(1) ... if a topic branch has ever been merged to "next". Young
100+
topic branches can have stupid mistakes you would rather
101+
clean up before publishing, and things that have not been
102+
merged into other branches can be easily rebased without
103+
affecting other people. But once it is published, you would
104+
not want to rewind it.
105+
106+
(2) ... if a topic branch has been fully merged to "master".
107+
Then you can delete it. More importantly, you should not
108+
build on top of it -- other people may already want to
109+
change things related to the topic as patches against your
110+
"master", so if you need further changes, it is better to
111+
fork the topic (perhaps with the same name) afresh from the
112+
tip of "master".
113+
114+
Let's look at this example:
115+
116+
o---o---o---o---o---o---o---o---o---o "next"
117+
/ / / /
118+
/ a---a---b A / /
119+
/ / / /
120+
/ / c---c---c---c B /
121+
/ / / \ /
122+
/ / / b---b C \ /
123+
/ / / / \ /
124+
---o---o---o---o---o---o---o---o---o---o---o "master"
125+
126+
127+
A, B and C are topic branches.
128+
129+
* A has one fix since it was merged up to "next".
130+
131+
* B has finished. It has been fully merged up to "master" and "next",
132+
and is ready to be deleted.
133+
134+
* C has not merged to "next" at all.
135+
136+
We would want to allow C to be rebased, refuse A, and encourage
137+
B to be deleted.
138+
139+
To compute (1):
140+
141+
git-rev-list ^master ^topic next
142+
git-rev-list ^master next
143+
144+
if these match, topic has not merged in next at all.
145+
146+
To compute (2):
147+
148+
git-rev-list master..topic
149+
150+
if this is empty, it is fully merged to "master".

0 commit comments

Comments
 (0)