summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-26 00:50:02 -0800
committerJunio C Hamano <junkio@cox.net>2005-11-28 23:13:02 -0800
commit53228a5fb8e80f87803e4a3ba8ed25b70fb4871d (patch)
tree0097d17996b5c71f3fb386eef354c84ffa3caaf2
parent5a3277133d200151fe526e56e036c933d343958a (diff)
downloadgit-53228a5fb8e80f87803e4a3ba8ed25b70fb4871d.tar.gz
Make the rest of commands work from a subdirectory.
These commands are converted to run from a subdirectory. commit-tree convert-objects merge-base merge-index mktag pack-objects pack-redundant prune-packed read-tree tar-tree unpack-file unpack-objects update-server-info write-tree Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--commit-tree.c2
-rw-r--r--convert-objects.c2
-rw-r--r--merge-base.c2
-rw-r--r--merge-index.c1
-rw-r--r--mktag.c2
-rw-r--r--pack-objects.c2
-rw-r--r--pack-redundant.c2
-rw-r--r--prune-packed.c2
-rw-r--r--read-tree.c2
-rw-r--r--tar-tree.c2
-rw-r--r--unpack-file.c2
-rw-r--r--unpack-objects.c2
-rw-r--r--update-server-info.c2
-rw-r--r--write-tree.c5
14 files changed, 29 insertions, 1 deletions
diff --git a/commit-tree.c b/commit-tree.c
index b60299fed0..4634b50e6a 100644
--- a/commit-tree.c
+++ b/commit-tree.c
@@ -91,6 +91,8 @@ int main(int argc, char **argv)
if (argc < 2 || get_sha1_hex(argv[1], tree_sha1) < 0)
usage(commit_tree_usage);
+ setup_git_directory();
+
check_valid(tree_sha1, "tree");
for (i = 2; i < argc; i += 2) {
char *a, *b;
diff --git a/convert-objects.c b/convert-objects.c
index a892013f0f..d78a8b4ae3 100644
--- a/convert-objects.c
+++ b/convert-objects.c
@@ -316,6 +316,8 @@ int main(int argc, char **argv)
unsigned char sha1[20];
struct entry *entry;
+ setup_git_directory();
+
if (argc != 2 || get_sha1(argv[1], sha1))
usage("git-convert-objects <sha1>");
diff --git a/merge-base.c b/merge-base.c
index 751c3c281b..e73fca7453 100644
--- a/merge-base.c
+++ b/merge-base.c
@@ -236,6 +236,8 @@ int main(int argc, char **argv)
struct commit *rev1, *rev2;
unsigned char rev1key[20], rev2key[20];
+ setup_git_directory();
+
while (1 < argc && argv[1][0] == '-') {
char *arg = argv[1];
if (!strcmp(arg, "-a") || !strcmp(arg, "--all"))
diff --git a/merge-index.c b/merge-index.c
index 727527fd59..024196e7ac 100644
--- a/merge-index.c
+++ b/merge-index.c
@@ -102,6 +102,7 @@ int main(int argc, char **argv)
if (argc < 3)
usage("git-merge-index [-o] [-q] <merge-program> (-a | <filename>*)");
+ setup_git_directory();
read_cache();
i = 1;
diff --git a/mktag.c b/mktag.c
index 585677eb83..97e270a576 100644
--- a/mktag.c
+++ b/mktag.c
@@ -111,6 +111,8 @@ int main(int argc, char **argv)
if (argc != 1)
usage("cat <signaturefile> | git-mktag");
+ setup_git_directory();
+
// Read the signature
size = 0;
for (;;) {
diff --git a/pack-objects.c b/pack-objects.c
index 8864a31cc1..a62c9f8d18 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -473,6 +473,8 @@ int main(int argc, char **argv)
struct object_entry **list;
int i;
+ setup_git_directory();
+
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
diff --git a/pack-redundant.c b/pack-redundant.c
index 793fa08096..0a43278924 100644
--- a/pack-redundant.c
+++ b/pack-redundant.c
@@ -600,6 +600,8 @@ int main(int argc, char **argv)
unsigned char *sha1;
char buf[42]; /* 40 byte sha1 + \n + \0 */
+ setup_git_directory();
+
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
if(!strcmp(arg, "--")) {
diff --git a/prune-packed.c b/prune-packed.c
index 26123f7f6b..d24b097114 100644
--- a/prune-packed.c
+++ b/prune-packed.c
@@ -58,6 +58,8 @@ int main(int argc, char **argv)
{
int i;
+ setup_git_directory();
+
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
diff --git a/read-tree.c b/read-tree.c
index df156ea0da..e3b9c0d9fa 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -629,6 +629,8 @@ int main(int argc, char **argv)
unsigned char sha1[20];
merge_fn_t fn = NULL;
+ setup_git_directory();
+
newfd = hold_index_file_for_update(&cache_file, get_index_file());
if (newfd < 0)
die("unable to create new cachefile");
diff --git a/tar-tree.c b/tar-tree.c
index 970c4bb54e..bacb23ae63 100644
--- a/tar-tree.c
+++ b/tar-tree.c
@@ -407,6 +407,8 @@ int main(int argc, char **argv)
void *buffer;
unsigned long size;
+ setup_git_directory();
+
switch (argc) {
case 3:
basedir = argv[2];
diff --git a/unpack-file.c b/unpack-file.c
index d4ac3a5460..07303f8bb3 100644
--- a/unpack-file.c
+++ b/unpack-file.c
@@ -29,6 +29,8 @@ int main(int argc, char **argv)
if (argc != 2 || get_sha1(argv[1], sha1))
usage("git-unpack-file <sha1>");
+ setup_git_directory();
+
puts(create_temp_file(sha1));
return 0;
}
diff --git a/unpack-objects.c b/unpack-objects.c
index 8490895cf0..cfd61ae6b0 100644
--- a/unpack-objects.c
+++ b/unpack-objects.c
@@ -269,6 +269,8 @@ int main(int argc, char **argv)
int i;
unsigned char sha1[20];
+ setup_git_directory();
+
for (i = 1 ; i < argc; i++) {
const char *arg = argv[i];
diff --git a/update-server-info.c b/update-server-info.c
index e824f62eaf..0b6c3835bd 100644
--- a/update-server-info.c
+++ b/update-server-info.c
@@ -19,5 +19,7 @@ int main(int ac, char **av)
if (i != ac)
usage(update_server_info_usage);
+ setup_git_directory();
+
return !!update_server_info(force);
}
diff --git a/write-tree.c b/write-tree.c
index 2b2c6b77af..0aac32f227 100644
--- a/write-tree.c
+++ b/write-tree.c
@@ -86,9 +86,12 @@ static int write_tree(struct cache_entry **cachep, int maxentries, const char *b
int main(int argc, char **argv)
{
int i, funny;
- int entries = read_cache();
+ int entries;
unsigned char sha1[20];
+ setup_git_directory();
+
+ entries = read_cache();
if (argc == 2) {
if (!strcmp(argv[1], "--missing-ok"))
missing_ok = 1;