Skip to content

Commit 8080906

Browse files
committed
Merge branch 'maint'
* maint: Document accumulated fixes since 1.7.9.2 Git 1.7.8.5 grep -P: Fix matching ^ and $ am: don't infloop for an empty input file rebase -m: only call "notes copy" when rewritten exists and is non-empty git-p4: remove bash-ism in t9800 git-p4: remove bash-ism in t9809 git-p4: fix submit regression with clientSpec and subdir clone git-p4: set useClientSpec variable on initial clone Makefile: add thread-utils.h to LIB_H Conflicts: RelNotes t/t9809-git-p4-client-view.sh
2 parents ba998d3 + 62ed072 commit 8080906

File tree

12 files changed

+291
-72
lines changed

12 files changed

+291
-72
lines changed

Documentation/RelNotes/1.7.10.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,6 @@ Unless otherwise noted, all the fixes since v1.7.9 in the maintenance
8787
releases are contained in this release (see release notes to them for
8888
details).
8989

90-
* The config.mak.autogen generated by optional autoconf support tried
91-
to link the binary with -lintl even when libintl.h is missing from
92-
the system.
93-
(merge a8356d4 js/configure-libintl later to maint).
94-
95-
* "git add --refresh <pathspec>" used to warn about unmerged paths
96-
outside the given pathspec.
97-
(merge 3d1f148 jc/add-refresh-unmerged later to maint).
98-
9990
* "gitweb" used to drop warnings in the log file when "heads" view is
10091
accessed in a repository whose HEAD does not point at a valid
10192
branch.

Documentation/RelNotes/1.7.8.5.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Git v1.7.8.5 Release Notes
2+
==========================
3+
4+
Fixes since v1.7.8.4
5+
--------------------
6+
7+
* Dependency on our thread-utils.h header file was missing for
8+
objects that depend on it in the Makefile.
9+
10+
* "git am" when fed an empty file did not correctly finish reading it
11+
when it attempts to guess the input format.
12+
13+
* "git grep -P" (when PCRE is enabled in the build) did not match the
14+
beginning and the end of the line correctly with ^ and $.
15+
16+
* "git rebase -m" tried to run "git notes copy" needlessly when
17+
nothing was rewritten.
18+
19+
Also contains minor fixes and documentation updates.

Documentation/RelNotes/1.7.9.3.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Git v1.7.9.3 Release Notes
2+
==========================
3+
4+
Fixes since v1.7.9.2
5+
--------------------
6+
7+
* "git p4" (in contrib/) submit the changes to a wrong place when the
8+
"--use-client-spec" option is set.
9+
10+
* The config.mak.autogen generated by optional autoconf support tried
11+
to link the binary with -lintl even when libintl.h is missing from
12+
the system.
13+
14+
* "git add --refresh <pathspec>" used to warn about unmerged paths
15+
outside the given pathspec.
16+
17+
Also contains minor fixes and documentation updates.

Documentation/git-p4.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,13 @@ CLIENT SPEC
303303
-----------
304304
The p4 client specification is maintained with the 'p4 client' command
305305
and contains among other fields, a View that specifies how the depot
306-
is mapped into the client repository. Git-p4 can consult the client
307-
spec when given the '--use-client-spec' option or useClientSpec
308-
variable.
306+
is mapped into the client repository. The 'clone' and 'sync' commands
307+
can consult the client spec when given the '--use-client-spec' option or
308+
when the useClientSpec variable is true. After 'git p4 clone', the
309+
useClientSpec variable is automatically set in the repository
310+
configuration file. This allows future 'git p4 submit' commands to
311+
work properly; the submit command looks only at the variable and does
312+
not have a command-line option.
309313

310314
The full syntax for a p4 view is documented in 'p4 help views'. Git-p4
311315
knows only a subset of the view syntax. It understands multi-line

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,7 @@ LIB_H += streaming.h
620620
LIB_H += string-list.h
621621
LIB_H += submodule.h
622622
LIB_H += tag.h
623+
LIB_H += thread-utils.h
623624
LIB_H += transport.h
624625
LIB_H += tree.h
625626
LIB_H += tree-walk.h

contrib/fast-import/git-p4

Lines changed: 64 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,46 @@ def p4PathStartsWith(path, prefix):
596596
return path.lower().startswith(prefix.lower())
597597
return path.startswith(prefix)
598598

599+
def getClientSpec():
600+
"""Look at the p4 client spec, create a View() object that contains
601+
all the mappings, and return it."""
602+
603+
specList = p4CmdList("client -o")
604+
if len(specList) != 1:
605+
die('Output from "client -o" is %d lines, expecting 1' %
606+
len(specList))
607+
608+
# dictionary of all client parameters
609+
entry = specList[0]
610+
611+
# just the keys that start with "View"
612+
view_keys = [ k for k in entry.keys() if k.startswith("View") ]
613+
614+
# hold this new View
615+
view = View()
616+
617+
# append the lines, in order, to the view
618+
for view_num in range(len(view_keys)):
619+
k = "View%d" % view_num
620+
if k not in view_keys:
621+
die("Expected view key %s missing" % k)
622+
view.append(entry[k])
623+
624+
return view
625+
626+
def getClientRoot():
627+
"""Grab the client directory."""
628+
629+
output = p4CmdList("client -o")
630+
if len(output) != 1:
631+
die('Output from "client -o" is %d lines, expecting 1' % len(output))
632+
633+
entry = output[0]
634+
if "Root" not in entry:
635+
die('Client has no "Root"')
636+
637+
return entry["Root"]
638+
599639
class Command:
600640
def __init__(self):
601641
self.usage = "usage: %prog [options]"
@@ -1220,11 +1260,20 @@ class P4Submit(Command, P4UserMap):
12201260
print "Internal error: cannot locate perforce depot path from existing branches"
12211261
sys.exit(128)
12221262

1223-
self.clientPath = p4Where(self.depotPath)
1263+
self.useClientSpec = False
1264+
if gitConfig("git-p4.useclientspec", "--bool") == "true":
1265+
self.useClientSpec = True
1266+
if self.useClientSpec:
1267+
self.clientSpecDirs = getClientSpec()
12241268

1225-
if len(self.clientPath) == 0:
1226-
print "Error: Cannot locate perforce checkout of %s in client view" % self.depotPath
1227-
sys.exit(128)
1269+
if self.useClientSpec:
1270+
# all files are relative to the client spec
1271+
self.clientPath = getClientRoot()
1272+
else:
1273+
self.clientPath = p4Where(self.depotPath)
1274+
1275+
if self.clientPath == "":
1276+
die("Error: Cannot locate perforce checkout of %s in client view" % self.depotPath)
12281277

12291278
print "Perforce checkout for depot path %s located at %s" % (self.depotPath, self.clientPath)
12301279
self.oldWorkingDirectory = os.getcwd()
@@ -1530,6 +1579,7 @@ class P4Sync(Command, P4UserMap):
15301579
self.p4BranchesInGit = []
15311580
self.cloneExclude = []
15321581
self.useClientSpec = False
1582+
self.useClientSpec_from_options = False
15331583
self.clientSpecDirs = None
15341584
self.tempBranches = []
15351585
self.tempBranchLocation = "git-p4-tmp"
@@ -2223,33 +2273,6 @@ class P4Sync(Command, P4UserMap):
22232273
print self.gitError.read()
22242274

22252275

2226-
def getClientSpec(self):
2227-
specList = p4CmdList("client -o")
2228-
if len(specList) != 1:
2229-
die('Output from "client -o" is %d lines, expecting 1' %
2230-
len(specList))
2231-
2232-
# dictionary of all client parameters
2233-
entry = specList[0]
2234-
2235-
# just the keys that start with "View"
2236-
view_keys = [ k for k in entry.keys() if k.startswith("View") ]
2237-
2238-
# hold this new View
2239-
view = View()
2240-
2241-
# append the lines, in order, to the view
2242-
for view_num in range(len(view_keys)):
2243-
k = "View%d" % view_num
2244-
if k not in view_keys:
2245-
die("Expected view key %s missing" % k)
2246-
view.append(entry[k])
2247-
2248-
self.clientSpecDirs = view
2249-
if self.verbose:
2250-
for i, m in enumerate(self.clientSpecDirs.mappings):
2251-
print "clientSpecDirs %d: %s" % (i, str(m))
2252-
22532276
def run(self, args):
22542277
self.depotPaths = []
22552278
self.changeRange = ""
@@ -2282,11 +2305,15 @@ class P4Sync(Command, P4UserMap):
22822305
if not gitBranchExists(self.refPrefix + "HEAD") and self.importIntoRemotes and gitBranchExists(self.branch):
22832306
system("git symbolic-ref %sHEAD %s" % (self.refPrefix, self.branch))
22842307

2285-
if not self.useClientSpec:
2308+
# accept either the command-line option, or the configuration variable
2309+
if self.useClientSpec:
2310+
# will use this after clone to set the variable
2311+
self.useClientSpec_from_options = True
2312+
else:
22862313
if gitConfig("git-p4.useclientspec", "--bool") == "true":
22872314
self.useClientSpec = True
22882315
if self.useClientSpec:
2289-
self.getClientSpec()
2316+
self.clientSpecDirs = getClientSpec()
22902317

22912318
# TODO: should always look at previous commits,
22922319
# merge with previous imports, if possible.
@@ -2607,6 +2634,10 @@ class P4Clone(P4Sync):
26072634
else:
26082635
print "Could not detect main branch. No checkout/master branch created."
26092636

2637+
# auto-set this variable if invoked with --use-client-spec
2638+
if self.useClientSpec_from_options:
2639+
system("git config --bool git-p4.useclientspec true")
2640+
26102641
return True
26112642

26122643
class P4Branches(Command):

git-am.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ check_patch_format () {
202202
l1=
203203
while test -z "$l1"
204204
do
205-
read l1
205+
read l1 || break
206206
done
207207
read l2
208208
read l3

git-rebase--merge.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,13 @@ call_merge () {
9090

9191
finish_rb_merge () {
9292
move_to_original_branch
93-
git notes copy --for-rewrite=rebase < "$state_dir"/rewritten
94-
if test -x "$GIT_DIR"/hooks/post-rewrite &&
95-
test -s "$state_dir"/rewritten; then
96-
"$GIT_DIR"/hooks/post-rewrite rebase < "$state_dir"/rewritten
93+
if test -s "$state_dir"/rewritten
94+
then
95+
git notes copy --for-rewrite=rebase <"$state_dir"/rewritten
96+
if test -x "$GIT_DIR"/hooks/post-rewrite
97+
then
98+
"$GIT_DIR"/hooks/post-rewrite rebase <"$state_dir"/rewritten
99+
fi
97100
fi
98101
rm -r "$state_dir"
99102
say All done.

grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static void compile_pcre_regexp(struct grep_pat *p, const struct grep_opt *opt)
7979
{
8080
const char *error;
8181
int erroffset;
82-
int options = 0;
82+
int options = PCRE_MULTILINE;
8383

8484
if (opt->ignore_case)
8585
options |= PCRE_CASELESS;

t/t4150-am.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,4 +505,14 @@ test_expect_success 'am -q is quiet' '
505505
! test -s output.out
506506
'
507507

508+
test_expect_success 'am empty-file does not infloop' '
509+
rm -fr .git/rebase-apply &&
510+
git reset --hard &&
511+
touch empty-file &&
512+
test_tick &&
513+
{ git am empty-file > actual 2>&1 && false || :; } &&
514+
echo Patch format detection failed. >expected &&
515+
test_cmp expected actual
516+
'
517+
508518
test_done

0 commit comments

Comments
 (0)