From: Junio C Hamano Date: Sun, 22 Jul 2012 19:55:07 +0000 (-0700) Subject: Merge branch 'jc/sha1-name-more' X-Git-Tag: v1.7.12-rc0~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0958a24d7360759902f802744c0839c8029659d7;p=git.git Merge branch 'jc/sha1-name-more' Teaches the object name parser things like a "git describe" output is always a commit object, "A" in "git log A" must be a committish, and "A" and "B" in "git log A...B" both must be committish, etc., to prolong the lifetime of abbreviated object names. * jc/sha1-name-more: (27 commits) t1512: match the "other" object names t1512: ignore whitespaces in wc -l output rev-parse --disambiguate= rev-parse: A and B in "rev-parse A..B" refer to committish reset: the command takes committish commit-tree: the command wants a tree and commits apply: --build-fake-ancestor expects blobs sha1_name.c: add support for disambiguating other types revision.c: the "log" family, except for "show", takes committish revision.c: allow handle_revision_arg() to take other flags sha1_name.c: introduce get_sha1_committish() sha1_name.c: teach lookup context to get_sha1_with_context() sha1_name.c: many short names can only be committish sha1_name.c: get_sha1_1() takes lookup flags sha1_name.c: get_describe_name() by definition groks only commits sha1_name.c: teach get_short_sha1() a commit-only option sha1_name.c: allow get_short_sha1() to take other flags get_sha1(): fix error status regression sha1_name.c: restructure disambiguation of short names sha1_name.c: correct misnamed "canonical" and "res" ... --- 0958a24d7360759902f802744c0839c8029659d7 diff --cc revision.h index 863f4f645,402f10d0a..cb5ab3513 --- a/revision.h +++ b/revision.h @@@ -183,7 -183,7 +183,8 @@@ struct setup_revision_opt const char *def; void (*tweak)(struct rev_info *, struct setup_revision_opt *); const char *submodule; + int assume_dashdash; + unsigned revarg_opt; }; extern void init_revisions(struct rev_info *revs, const char *prefix); @@@ -191,9 -191,10 +192,11 @@@ extern int setup_revisions(int argc, co extern void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx, const struct option *options, const char * const usagestr[]); - extern int handle_revision_arg(const char *arg, struct rev_info *revs,int flags,int cant_be_filename); + #define REVARG_CANNOT_BE_FILENAME 01 + #define REVARG_COMMITTISH 02 + extern int handle_revision_arg(const char *arg, struct rev_info *revs, int flags, unsigned revarg_opt); +extern void reset_revision_walk(void); extern int prepare_revision_walk(struct rev_info *revs); extern struct commit *get_revision(struct rev_info *revs); extern char *get_revision_mark(const struct rev_info *revs, const struct commit *commit); diff --cc setup.c index e11497720,233bfbe92..9139beefc --- a/setup.c +++ b/setup.c @@@ -73,17 -53,8 +73,14 @@@ int check_filename(const char *prefix, die_errno("failed to stat '%s'", arg); } -static void NORETURN die_verify_filename(const char *prefix, const char *arg) +static void NORETURN die_verify_filename(const char *prefix, + const char *arg, + int diagnose_misspelt_rev) { - unsigned char sha1[20]; - unsigned mode; - + if (!diagnose_misspelt_rev) + die("%s: no such path in the working tree.\n" + "Use '-- ...' to specify paths that do not exist locally.", + arg); /* * Saying "'(icase)foo' does not exist in the index" when the * user gave us ":(icase)foo" is just stupid. A magic pathspec