githelper.git
/
githelper.pike
version
»
Context lines:
10
20
40
80
file
none
3
githelper.git/githelper.pike:43:
return run_git_ex(0, @args); } /* Hooks */ class PostCheckoutHook { int hook(string ... args) { write("post-checkout %O\n", args);
+
return 0;
} } /* Filters */ class NiceIdentFilter {
-
int
clean
(string ...
args
)
+
static string replace_id(string f, function(string:string) replace) {
+
int
p=0;
+
while
(
(p=search(f, "$Id", p)) >= 0) {
+
int p2 = search(f, "$", p+3), p3 = search(f, "\n", p+3);
+
if (p2 > p && p2 < p3) {
+
string
r = replace(f[p
..
p2]);
+
if (r) {
+
f = f[
.
.p-1]+r+f[p2+1..];
+
p += sizeof(r
)
;
+
} else p = p2+1;
+
} else p += 3;
+
}
+
return f;
+
}
+
+
static string clean_ident(string i)
{
-
werror
("
clean
%O\n
"
,
args
)
;
-
Process.system(
"
cat
"
)
;
+
if
(
has_prefix(i,
"
$Id:")
&& sizeof(i/
"
"
)
==3)
+
return
"
$Id$
";
}
-
+
static string smudge_ident(string i)
+
{
+
return "$Id$";
+
}
+
+
int clean()
+
{
+
write(replace_id(Stdio.stdin->read(), clean_ident));
+
return 0;
+
}
+
int smudge(string ... args) {
-
werror
(
"smudge %O\n"
,
args
);
-
Process.system("cat")
;
+
write
(
replace_id(Stdio.stdin->read()
,
smudge_ident
)
)
;
+
return 0
;
} } /* Main helper */ class GitHelper { void setup_hooks() { constant hooksdir = "hooks";