summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-03-24 07:41:18 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-03-24 07:41:18 (GMT)
commit84a9b58c421f9b2d1cc6c195ed441fac48e60392 (patch)
treeb3862a8325f87bd5cf4948117da1b0269664ca13
parentc51d13692d4e451c755dd7da3521c5db395df192 (diff)
downloadgit-84a9b58c421f9b2d1cc6c195ed441fac48e60392.zip
git-84a9b58c421f9b2d1cc6c195ed441fac48e60392.tar.gz
git-84a9b58c421f9b2d1cc6c195ed441fac48e60392.tar.bz2
sha1_name: warning ambiguous refs.
This makes sure that many commands that take refs on the command line to honor core.warnambiguousrefs configuration. Earlier, the commands affected by this patch did not read the configuration file. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--blame.c1
-rw-r--r--cat-file.c1
-rw-r--r--ls-tree.c1
-rw-r--r--merge-base.c1
-rw-r--r--name-rev.c1
-rw-r--r--read-tree.c1
-rw-r--r--rev-parse.c2
-rw-r--r--send-pack.c2
-rw-r--r--sha1_name.c5
-rw-r--r--tar-tree.c1
-rw-r--r--unpack-file.c1
-rw-r--r--update-ref.c1
12 files changed, 15 insertions, 3 deletions
diff --git a/blame.c b/blame.c
index 9c97aec..270ca52 100644
--- a/blame.c
+++ b/blame.c
@@ -752,6 +752,7 @@ int main(int argc, const char **argv)
int found_rename;
const char* prefix = setup_git_directory();
+ git_config(git_default_config);
for(i = 1; i < argc; i++) {
if(options) {
diff --git a/cat-file.c b/cat-file.c
index 1a613f3..761111e 100644
--- a/cat-file.c
+++ b/cat-file.c
@@ -100,6 +100,7 @@ int main(int argc, char **argv)
int opt;
setup_git_directory();
+ git_config(git_default_config);
if (argc != 3 || get_sha1(argv[2], sha1))
usage("git-cat-file [-t|-s|-e|-p|<type>] <sha1>");
diff --git a/ls-tree.c b/ls-tree.c
index d005643..58663ff 100644
--- a/ls-tree.c
+++ b/ls-tree.c
@@ -87,6 +87,7 @@ int main(int argc, const char **argv)
struct tree *tree;
prefix = setup_git_directory();
+ git_config(git_default_config);
if (prefix && *prefix)
chomp_prefix = strlen(prefix);
while (1 < argc && argv[1][0] == '-') {
diff --git a/merge-base.c b/merge-base.c
index e73fca7..07f5ab4 100644
--- a/merge-base.c
+++ b/merge-base.c
@@ -237,6 +237,7 @@ int main(int argc, char **argv)
unsigned char rev1key[20], rev2key[20];
setup_git_directory();
+ git_config(git_default_config);
while (1 < argc && argv[1][0] == '-') {
char *arg = argv[1];
diff --git a/name-rev.c b/name-rev.c
index 0c3f547..bad8a53 100644
--- a/name-rev.c
+++ b/name-rev.c
@@ -127,6 +127,7 @@ int main(int argc, char **argv)
int as_is = 0, all = 0, transform_stdin = 0;
setup_git_directory();
+ git_config(git_default_config);
if (argc < 2)
usage(name_rev_usage);
diff --git a/read-tree.c b/read-tree.c
index 1c3b09b..eaff444 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -717,6 +717,7 @@ int main(int argc, char **argv)
merge_fn_t fn = NULL;
setup_git_directory();
+ git_config(git_default_config);
newfd = hold_index_file_for_update(&cache_file, get_index_file());
if (newfd < 0)
diff --git a/rev-parse.c b/rev-parse.c
index f90e999..19a5ef7 100644
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -166,6 +166,8 @@ int main(int argc, char **argv)
unsigned char sha1[20];
const char *prefix = setup_git_directory();
+ git_config(git_default_config);
+
for (i = 1; i < argc; i++) {
struct stat st;
char *arg = argv[i];
diff --git a/send-pack.c b/send-pack.c
index c8ffc8d..409f188 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -362,6 +362,8 @@ int main(int argc, char **argv)
pid_t pid;
setup_git_directory();
+ git_config(git_default_config);
+
argv++;
for (i = 1; i < argc; i++, argv++) {
char *arg = *argv;
diff --git a/sha1_name.c b/sha1_name.c
index 3adaec3..4f92e12 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -236,7 +236,7 @@ static int ambiguous_path(const char *path, int len)
static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
{
static const char *fmt[] = {
- "/%.*s",
+ "%.*s",
"refs/%.*s",
"refs/tags/%.*s",
"refs/heads/%.*s",
@@ -263,8 +263,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
pathname = git_path(*p, len, str);
if (!read_ref(pathname, this_result)) {
if (warn_ambiguous_refs) {
- if (already_found &&
- !memcmp(sha1, sha1_from_ref, 20))
+ if (already_found)
fprintf(stderr, warning, len, str);
already_found++;
}
diff --git a/tar-tree.c b/tar-tree.c
index e478e13..92035f5 100644
--- a/tar-tree.c
+++ b/tar-tree.c
@@ -380,6 +380,7 @@ int main(int argc, char **argv)
struct tree_desc tree;
setup_git_directory();
+ git_config(git_default_config);
switch (argc) {
case 3:
diff --git a/unpack-file.c b/unpack-file.c
index 07303f8..3accb97 100644
--- a/unpack-file.c
+++ b/unpack-file.c
@@ -30,6 +30,7 @@ int main(int argc, char **argv)
usage("git-unpack-file <sha1>");
setup_git_directory();
+ git_config(git_default_config);
puts(create_temp_file(sha1));
return 0;
diff --git a/update-ref.c b/update-ref.c
index e6fbddb..ba4bf51 100644
--- a/update-ref.c
+++ b/update-ref.c
@@ -25,6 +25,7 @@ int main(int argc, char **argv)
int fd, written;
setup_git_directory();
+ git_config(git_default_config);
if (argc < 3 || argc > 4)
usage(git_update_ref_usage);