Merge branch 'maint'
* maint: rev-parse: clarify documentation of $name@{upstream} syntax sha1_name: pass object name length to diagnose_invalid_sha1_path() Makefile: keep LIB_H entries together and sorted
This commit is contained in:
commit
bb79a827a2
@ -88,10 +88,10 @@ some output processing may assume ref names in UTF-8.
|
|||||||
The construct '@\{-<n>\}' means the <n>th branch checked out
|
The construct '@\{-<n>\}' means the <n>th branch checked out
|
||||||
before the current one.
|
before the current one.
|
||||||
|
|
||||||
'<refname>@\{upstream\}', e.g. 'master@\{upstream\}', '@\{u\}'::
|
'<branchname>@\{upstream\}', e.g. 'master@\{upstream\}', '@\{u\}'::
|
||||||
The suffix '@\{upstream\}' to a ref (short form '<refname>@\{u\}') refers to
|
The suffix '@\{upstream\}' to a branchname (short form '<branchname>@\{u\}')
|
||||||
the branch the ref is set to build on top of. A missing ref defaults
|
refers to the branch that the branch specified by branchname is set to build on
|
||||||
to the current branch.
|
top of. A missing branchname defaults to the current one.
|
||||||
|
|
||||||
'<rev>{caret}', e.g. 'HEAD{caret}, v1.5.1{caret}0'::
|
'<rev>{caret}', e.g. 'HEAD{caret}, v1.5.1{caret}0'::
|
||||||
A suffix '{caret}' to a revision parameter means the first parent of
|
A suffix '{caret}' to a revision parameter means the first parent of
|
||||||
|
29
Makefile
29
Makefile
@ -617,22 +617,6 @@ LIB_FILE = libgit.a
|
|||||||
XDIFF_LIB = xdiff/lib.a
|
XDIFF_LIB = xdiff/lib.a
|
||||||
VCSSVN_LIB = vcs-svn/lib.a
|
VCSSVN_LIB = vcs-svn/lib.a
|
||||||
|
|
||||||
LIB_H += xdiff/xinclude.h
|
|
||||||
LIB_H += xdiff/xmacros.h
|
|
||||||
LIB_H += xdiff/xdiff.h
|
|
||||||
LIB_H += xdiff/xtypes.h
|
|
||||||
LIB_H += xdiff/xutils.h
|
|
||||||
LIB_H += xdiff/xprepare.h
|
|
||||||
LIB_H += xdiff/xdiffi.h
|
|
||||||
LIB_H += xdiff/xemit.h
|
|
||||||
|
|
||||||
LIB_H += vcs-svn/line_buffer.h
|
|
||||||
LIB_H += vcs-svn/sliding_window.h
|
|
||||||
LIB_H += vcs-svn/repo_tree.h
|
|
||||||
LIB_H += vcs-svn/fast_export.h
|
|
||||||
LIB_H += vcs-svn/svndiff.h
|
|
||||||
LIB_H += vcs-svn/svndump.h
|
|
||||||
|
|
||||||
GENERATED_H += common-cmds.h
|
GENERATED_H += common-cmds.h
|
||||||
|
|
||||||
LIB_H += advice.h
|
LIB_H += advice.h
|
||||||
@ -734,11 +718,24 @@ LIB_H += url.h
|
|||||||
LIB_H += userdiff.h
|
LIB_H += userdiff.h
|
||||||
LIB_H += utf8.h
|
LIB_H += utf8.h
|
||||||
LIB_H += varint.h
|
LIB_H += varint.h
|
||||||
|
LIB_H += vcs-svn/fast_export.h
|
||||||
|
LIB_H += vcs-svn/line_buffer.h
|
||||||
|
LIB_H += vcs-svn/repo_tree.h
|
||||||
|
LIB_H += vcs-svn/sliding_window.h
|
||||||
|
LIB_H += vcs-svn/svndiff.h
|
||||||
|
LIB_H += vcs-svn/svndump.h
|
||||||
LIB_H += walker.h
|
LIB_H += walker.h
|
||||||
LIB_H += wildmatch.h
|
LIB_H += wildmatch.h
|
||||||
LIB_H += wt-status.h
|
LIB_H += wt-status.h
|
||||||
LIB_H += xdiff-interface.h
|
LIB_H += xdiff-interface.h
|
||||||
LIB_H += xdiff/xdiff.h
|
LIB_H += xdiff/xdiff.h
|
||||||
|
LIB_H += xdiff/xdiffi.h
|
||||||
|
LIB_H += xdiff/xemit.h
|
||||||
|
LIB_H += xdiff/xinclude.h
|
||||||
|
LIB_H += xdiff/xmacros.h
|
||||||
|
LIB_H += xdiff/xprepare.h
|
||||||
|
LIB_H += xdiff/xtypes.h
|
||||||
|
LIB_H += xdiff/xutils.h
|
||||||
|
|
||||||
LIB_OBJS += abspath.o
|
LIB_OBJS += abspath.o
|
||||||
LIB_OBJS += advice.o
|
LIB_OBJS += advice.o
|
||||||
|
32
sha1_name.c
32
sha1_name.c
@ -1137,7 +1137,8 @@ int get_sha1_blob(const char *name, unsigned char *sha1)
|
|||||||
static void diagnose_invalid_sha1_path(const char *prefix,
|
static void diagnose_invalid_sha1_path(const char *prefix,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
const unsigned char *tree_sha1,
|
const unsigned char *tree_sha1,
|
||||||
const char *object_name)
|
const char *object_name,
|
||||||
|
int object_name_len)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
@ -1147,8 +1148,8 @@ static void diagnose_invalid_sha1_path(const char *prefix,
|
|||||||
prefix = "";
|
prefix = "";
|
||||||
|
|
||||||
if (!lstat(filename, &st))
|
if (!lstat(filename, &st))
|
||||||
die("Path '%s' exists on disk, but not in '%s'.",
|
die("Path '%s' exists on disk, but not in '%.*s'.",
|
||||||
filename, object_name);
|
filename, object_name_len, object_name);
|
||||||
if (errno == ENOENT || errno == ENOTDIR) {
|
if (errno == ENOENT || errno == ENOTDIR) {
|
||||||
char *fullname = xmalloc(strlen(filename)
|
char *fullname = xmalloc(strlen(filename)
|
||||||
+ strlen(prefix) + 1);
|
+ strlen(prefix) + 1);
|
||||||
@ -1158,16 +1159,16 @@ static void diagnose_invalid_sha1_path(const char *prefix,
|
|||||||
if (!get_tree_entry(tree_sha1, fullname,
|
if (!get_tree_entry(tree_sha1, fullname,
|
||||||
sha1, &mode)) {
|
sha1, &mode)) {
|
||||||
die("Path '%s' exists, but not '%s'.\n"
|
die("Path '%s' exists, but not '%s'.\n"
|
||||||
"Did you mean '%s:%s' aka '%s:./%s'?",
|
"Did you mean '%.*s:%s' aka '%.*s:./%s'?",
|
||||||
fullname,
|
fullname,
|
||||||
filename,
|
filename,
|
||||||
object_name,
|
object_name_len, object_name,
|
||||||
fullname,
|
fullname,
|
||||||
object_name,
|
object_name_len, object_name,
|
||||||
filename);
|
filename);
|
||||||
}
|
}
|
||||||
die("Path '%s' does not exist in '%s'",
|
die("Path '%s' does not exist in '%.*s'",
|
||||||
filename, object_name);
|
filename, object_name_len, object_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1332,13 +1333,8 @@ static int get_sha1_with_context_1(const char *name,
|
|||||||
}
|
}
|
||||||
if (*cp == ':') {
|
if (*cp == ':') {
|
||||||
unsigned char tree_sha1[20];
|
unsigned char tree_sha1[20];
|
||||||
char *object_name = NULL;
|
int len = cp - name;
|
||||||
if (only_to_die) {
|
if (!get_sha1_1(name, len, tree_sha1, GET_SHA1_TREEISH)) {
|
||||||
object_name = xmalloc(cp-name+1);
|
|
||||||
strncpy(object_name, name, cp-name);
|
|
||||||
object_name[cp-name] = '\0';
|
|
||||||
}
|
|
||||||
if (!get_sha1_1(name, cp-name, tree_sha1, GET_SHA1_TREEISH)) {
|
|
||||||
const char *filename = cp+1;
|
const char *filename = cp+1;
|
||||||
char *new_filename = NULL;
|
char *new_filename = NULL;
|
||||||
|
|
||||||
@ -1348,8 +1344,8 @@ static int get_sha1_with_context_1(const char *name,
|
|||||||
ret = get_tree_entry(tree_sha1, filename, sha1, &oc->mode);
|
ret = get_tree_entry(tree_sha1, filename, sha1, &oc->mode);
|
||||||
if (ret && only_to_die) {
|
if (ret && only_to_die) {
|
||||||
diagnose_invalid_sha1_path(prefix, filename,
|
diagnose_invalid_sha1_path(prefix, filename,
|
||||||
tree_sha1, object_name);
|
tree_sha1,
|
||||||
free(object_name);
|
name, len);
|
||||||
}
|
}
|
||||||
hashcpy(oc->tree, tree_sha1);
|
hashcpy(oc->tree, tree_sha1);
|
||||||
strncpy(oc->path, filename,
|
strncpy(oc->path, filename,
|
||||||
@ -1360,7 +1356,7 @@ static int get_sha1_with_context_1(const char *name,
|
|||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
if (only_to_die)
|
if (only_to_die)
|
||||||
die("Invalid object name '%s'.", object_name);
|
die("Invalid object name '%.*s'.", len, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user