Merge branch 'jk/diff-blob'
The result from "git diff" that compares two blobs, e.g. "git diff $commit1:$path $commit2:$path", used to be shown with the full object name as given on the command line, but it is more natural to use the $path in the output and use it to look up .gitattributes. * jk/diff-blob: diff: use blob path for blob/file diffs diff: use pending "path" if it is available diff: use the word "path" instead of "name" for blobs diff: pass whole pending entry in blobinfo handle_revision_arg: record paths for pending objects handle_revision_arg: record modes for "a..b" endpoints t4063: add tests of direct blob diffs get_sha1_with_context: dynamically allocate oc->path get_sha1_with_context: always initialize oc->symlink_path sha1_name: consistently refer to object_context as "oc" handle_revision_arg: add handle_dotdot() helper handle_revision_arg: hoist ".." check out of range parsing handle_revision_arg: stop using "dotdot" as a generic pointer handle_revision_arg: simplify commit reference lookups handle_revision_arg: reset "dotdot" consistently
This commit is contained in:
10
cache.h
10
cache.h
@ -1334,13 +1334,18 @@ static inline int hex2chr(const char *s)
|
||||
|
||||
struct object_context {
|
||||
unsigned char tree[20];
|
||||
char path[PATH_MAX];
|
||||
unsigned mode;
|
||||
/*
|
||||
* symlink_path is only used by get_tree_entry_follow_symlinks,
|
||||
* and only for symlinks that point outside the repository.
|
||||
*/
|
||||
struct strbuf symlink_path;
|
||||
/*
|
||||
* If GET_SHA1_RECORD_PATH is set, this will record path (if any)
|
||||
* found when resolving the name. The caller is responsible for
|
||||
* releasing the memory.
|
||||
*/
|
||||
char *path;
|
||||
};
|
||||
|
||||
#define GET_SHA1_QUIETLY 01
|
||||
@ -1350,6 +1355,7 @@ struct object_context {
|
||||
#define GET_SHA1_TREEISH 020
|
||||
#define GET_SHA1_BLOB 040
|
||||
#define GET_SHA1_FOLLOW_SYMLINKS 0100
|
||||
#define GET_SHA1_RECORD_PATH 0200
|
||||
#define GET_SHA1_ONLY_TO_DIE 04000
|
||||
|
||||
#define GET_SHA1_DISAMBIGUATORS \
|
||||
@ -1364,7 +1370,7 @@ extern int get_sha1_tree(const char *str, unsigned char *sha1);
|
||||
extern int get_sha1_treeish(const char *str, unsigned char *sha1);
|
||||
extern int get_sha1_blob(const char *str, unsigned char *sha1);
|
||||
extern void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);
|
||||
extern int get_sha1_with_context(const char *str, unsigned flags, unsigned char *sha1, struct object_context *orc);
|
||||
extern int get_sha1_with_context(const char *str, unsigned flags, unsigned char *sha1, struct object_context *oc);
|
||||
|
||||
extern int get_oid(const char *str, struct object_id *oid);
|
||||
|
||||
|
Reference in New Issue
Block a user