OSDN Git Service
(root)
/
git-core
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cygwin: allow pushing to UNC paths
[git-core/git.git]
/
sha1_name.c
diff --git
a/sha1_name.c
b/sha1_name.c
index
8eec9f7
..
5e2ec37
100644
(file)
--- a/
sha1_name.c
+++ b/
sha1_name.c
@@
-1511,6
+1511,7
@@
static int get_sha1_with_context_1(const char *name,
memset(oc, 0, sizeof(*oc));
oc->mode = S_IFINVALID;
memset(oc, 0, sizeof(*oc));
oc->mode = S_IFINVALID;
+ strbuf_init(&oc->symlink_path, 0);
ret = get_sha1_1(name, namelen, sha1, flags);
if (!ret)
return ret;
ret = get_sha1_1(name, namelen, sha1, flags);
if (!ret)
return ret;
@@
-1549,7
+1550,8
@@
static int get_sha1_with_context_1(const char *name,
namelen = strlen(cp);
}
namelen = strlen(cp);
}
- strlcpy(oc->path, cp, sizeof(oc->path));
+ if (flags & GET_SHA1_RECORD_PATH)
+ oc->path = xstrdup(cp);
if (!active_cache)
read_cache();
if (!active_cache)
read_cache();
@@
-1612,7
+1614,8
@@
static int get_sha1_with_context_1(const char *name,
}
}
hashcpy(oc->tree, tree_sha1);
}
}
hashcpy(oc->tree, tree_sha1);
- strlcpy(oc->path, filename, sizeof(oc->path));
+ if (flags & GET_SHA1_RECORD_PATH)
+ oc->path = xstrdup(filename);
free(new_filename);
return ret;
free(new_filename);
return ret;
@@
-1638,9
+1641,9
@@
void maybe_die_on_misspelt_object_name(const char *name, const char *prefix)
get_sha1_with_context_1(name, GET_SHA1_ONLY_TO_DIE, prefix, sha1, &oc);
}
get_sha1_with_context_1(name, GET_SHA1_ONLY_TO_DIE, prefix, sha1, &oc);
}
-int get_sha1_with_context(const char *str, unsigned flags, unsigned char *sha1, struct object_context *o
r
c)
+int get_sha1_with_context(const char *str, unsigned flags, unsigned char *sha1, struct object_context *oc)
{
if (flags & GET_SHA1_FOLLOW_SYMLINKS && flags & GET_SHA1_ONLY_TO_DIE)
die("BUG: incompatible flags for get_sha1_with_context");
{
if (flags & GET_SHA1_FOLLOW_SYMLINKS && flags & GET_SHA1_ONLY_TO_DIE)
die("BUG: incompatible flags for get_sha1_with_context");
- return get_sha1_with_context_1(str, flags, NULL, sha1, o
r
c);
+ return get_sha1_with_context_1(str, flags, NULL, sha1, oc);
}
}