283b62 | 2013-03-26 | Martin Nilsson | | #pike __REAL_VERSION__
|
92253b | 2011-11-16 | Henrik Grubbström (Grubba) | |
|
948667 | 2013-07-20 | Henrik Grubbström (Grubba) | |
|
92253b | 2011-11-16 | Henrik Grubbström (Grubba) | | string git_binary = "git";
constant MODE_FILE = 0100644;
constant MODE_EXE = 0100755;
constant MODE_SYMLINK = 0120000;
constant MODE_GITLINK = 0160000;
constant MODE_DIR = 040000;
constant NULL_SHA1 = "0000000000000000000000000000000000000000";
|
948667 | 2013-07-20 | Henrik Grubbström (Grubba) | |
|
92253b | 2011-11-16 | Henrik Grubbström (Grubba) | | Process.Process low_git(mapping(string:mixed) options,
string git_dir, string command, string ... args)
{
|
948667 | 2013-07-20 | Henrik Grubbström (Grubba) | | if (git_dir) {
return Process.Process(({ git_binary, "--git-dir", git_dir,
command, @args }), options);
}
return Process.Process(({ git_binary, command, @args }), options);
|
92253b | 2011-11-16 | Henrik Grubbström (Grubba) | | }
|
948667 | 2013-07-20 | Henrik Grubbström (Grubba) | |
|
92253b | 2011-11-16 | Henrik Grubbström (Grubba) | | string git(string git_dir, string command, string ... args)
{
|
948667 | 2013-07-20 | Henrik Grubbström (Grubba) | | array(string) cmd;
if (git_dir) {
cmd = ({ git_binary, "--git-dir", git_dir, command, @args });
} else {
cmd = ({ git_binary, command, @args });
}
|
92253b | 2011-11-16 | Henrik Grubbström (Grubba) | | mapping(string:string|int) res = Process.run(cmd);
if (res->exitcode) {
werror("CWD: %O\n", getcwd());
error("Git command '%s' failed with code %d:\n"
"%s", cmd*"' '", res->exitcode, res->stderr||"");
}
return res->stdout||"";
}
string hash_blob(string data)
{
Crypto.SHA1 sha1 = Crypto.SHA1();
sha1->update(sprintf("blob %d\0", sizeof(data)));
sha1->update(data);
return String.string2hex(sha1->digest());
}
|